Skip to content

Commit

Permalink
Github action fetch dev container by default
Browse files Browse the repository at this point in the history
- if no changes at utils/docker are made, we fetch the fpc dev image
  instead of building it from scratch

Signed-off-by: Marcus Brandenburger <[email protected]>
  • Loading branch information
mbrandenburger committed Oct 6, 2023
1 parent 4c43247 commit c383233
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

name: FPC test
on: [push, pull_request]

env:
DOCKER_REGISTRY: 'ghcr.io'
PUSH_TO_MAIN: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}

jobs:
docker:
runs-on: ${{ matrix.os }}
Expand All @@ -20,13 +25,29 @@ jobs:
with:
submodules: 'recursive'

- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
docker:
- 'utils/docker/**'
- name: build dev image
if: steps.filter.outputs.docker == 'true'
env:
DOCKER_QUIET_BUILD: 1
run: |
DOCKER_BUILD_OPTS="--build-arg UBUNTU_VERSION=${{ matrix.os-version }} --build-arg UBUNTU_NAME=${{ matrix.os-name }}" \
make -C utils/docker build build-dev
- name: fetch dev image
if: steps.filter.outputs.docker == 'false'
env:
DOCKER_QUIET_BUILD: 1
run: |
DOCKER_BUILD_OPTS="--build-arg UBUNTU_VERSION=${{ matrix.os-version }} --build-arg UBUNTU_NAME=${{ matrix.os-name }}" \
make -C utils/docker pull pull-dev
- name: run make inside dev container
env:
DOCKER_DEV_CI_MODE: 1
Expand All @@ -35,4 +56,20 @@ jobs:
DOCKER_DEV_RUN_OPTS=`bash <(curl -s https://codecov.io/env)` \
DOCKER_BUILD_OPTS="--build-arg UBUNTU_VERSION=${{ matrix.os-version }} --build-arg UBUNTU_NAME=${{ matrix.os-name }}" \
make -C utils/docker run-dev DOCKER_DEV_OPTIONAL_CMD='env IS_CI_RUNNING=true \
make all clobber'
make all'
#
# continue only if we push to main and rebuild docker images
#
- name: Login to the ${{ env.DOCKER_REGISTRY }} Container Registry
if: env.PUSH_TO_MAIN == 'true' && steps.filter.outputs.docker == 'true'
uses: docker/login-action@v2
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: publish images
if: env.PUSH_TO_MAIN == 'true' && steps.filter.outputs.docker == 'true'
run: |
make -C utils/docker publish

0 comments on commit c383233

Please sign in to comment.