Skip to content

Commit

Permalink
[integration-test] Build image on push/PR, push to ghcr.io on release
Browse files Browse the repository at this point in the history
Adjust the workflow to rebuild the integration-test image whenever a new
commit is pushed to the repository a pull request is opened that touches
any path in the `integration-test/` subdirectory. If the workflow is
triggered by a release being published, the built image is additionally
pushed to ghcr.io.

This now allows PRs and work branches to check if the image builds
cleanly before cutting a new release.
  • Loading branch information
fabianschuiki committed Nov 25, 2024
1 parent a6718a1 commit 72e50ed
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,37 @@
name: Build and push images
name: Integration Test Image

on:
push:
paths:
- 'integration-test/**'
pull_request:
paths:
- 'integration-test/**'
release:
types: [published]
workflow_dispatch:

jobs:
build-integration-test-image:
name: Build and push Docker image for integration tests
build:
name: Build
runs-on: ubuntu-latest
defaults:
run:
working-directory: integration-test
steps:
- name: Get CIRCT images repo
- name: Checkout repository
uses: actions/checkout@v4
- name: Build and push image
working-directory: ./integration-test

- name: Setup environment
run: |
TAG=$(echo $GITHUB_REF | cut -d / -f 3)
echo "GHCR_TAG=ghcr.io/${{github.repository}}/circt-integration-test:$GIT_TAG" >> $GITHUB_ENV
- name: Build image
run: docker build . --tag $GHCR_TAG

- name: Push image
if: ${{ github.event_name == 'release' }}
run: |
echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
docker build . --tag ghcr.io/${{github.repository}}/circt-integration-test:$TAG
docker push ghcr.io/${{github.repository}}/circt-integration-test:$TAG
docker push $GHCR_TAG

0 comments on commit 72e50ed

Please sign in to comment.