From 055a6c8078a49834248c6835711a51c7b2f8a155 Mon Sep 17 00:00:00 2001 From: Dominic Reber Date: Mon, 18 Sep 2023 17:52:17 +0200 Subject: [PATCH 1/3] ci: add test workflow on pr event --- .github/workflows/test.yml | 46 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..c04de5c --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,46 @@ +name: Check CHANGELOG update and run tests + +on: + pull_request: + +jobs: + check-changelog: + name: Check if changelog has been updated + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: | + git fetch origin main ${{ github.event.pull_request.base.sha }} + PACKAGE_DIFF=$(git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -- ./source) + PACKAGE_DIFF+=$(git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -- ./python) + CL_DIFF=$(git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -- CHANGELOG.md) + if [ "${PACKAGE_DIFF}" ] && ! [ "${CL_DIFF}" ]; then + echo "::error file="CHANGELOG.md",title=Check failed::CHANGELOG.md must be updated!" + exit 1 + fi + shell: bash + + check-skippable-changes: + name: Check skippable changes + runs-on: ubuntu-latest + outputs: + skip: ${{ steps.check.outputs.should_skip }} + steps: + - id: check + uses: fkirc/skip-duplicate-actions@master + with: + paths_ignore: '["**.md", ".**/**", "**.gitignore", "**.sh"]' + + test: + needs: check-skippable-changes + if: ${{ needs.check-skippable-changes.outputs.skip == 'true' }} + runs-on: ubuntu-latest + name: Run tests + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Test + run: | + DOCKER_BUILDKIT=1 docker build --target test . + shell: bash From f6b67ad5690166d013c657107b47cb74e5ed0bec Mon Sep 17 00:00:00 2001 From: Dominic Reber Date: Mon, 18 Sep 2023 17:57:36 +0200 Subject: [PATCH 2/3] fix: test workflow --- .github/workflows/test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c04de5c..3788404 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,8 +9,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - run: | - git fetch origin main ${{ github.event.pull_request.base.sha }} PACKAGE_DIFF=$(git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -- ./source) PACKAGE_DIFF+=$(git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -- ./python) CL_DIFF=$(git diff ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -- CHANGELOG.md) @@ -33,7 +34,7 @@ jobs: test: needs: check-skippable-changes - if: ${{ needs.check-skippable-changes.outputs.skip == 'true' }} + if: ${{ needs.check-skippable-changes.outputs.skip != 'true' }} runs-on: ubuntu-latest name: Run tests steps: From 3c1aa712e8b3ddf146318e8496b5a552f8695f74 Mon Sep 17 00:00:00 2001 From: Dominic Reber Date: Mon, 18 Sep 2023 18:04:39 +0200 Subject: [PATCH 3/3] docs: update changelog --- .github/workflows/build-release.yaml | 4 ++-- CHANGELOG.md | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml index 67d781e..25a6bcf 100644 --- a/.github/workflows/build-release.yaml +++ b/.github/workflows/build-release.yaml @@ -19,7 +19,7 @@ jobs: id: parse-tag build: - needs: [get-tag] + needs: [ get-tag ] strategy: matrix: arch: [amd64, arm64] @@ -48,7 +48,7 @@ jobs: multi-arch: runs-on: ubuntu-latest name: Merge into a multi-arch image - needs: [get-tag, build] + needs: [ get-tag, build ] steps: - uses: aica-technology/.github/.github/actions/ghcr-manifest-merge@v0.6.1 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index ab6e537..a095cb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ Release Versions: - refactor!: remove network interfaces (#56) - feat: add python bindings and tests (#57) - build: rename Dockerfile and update helper scripts (#58) +- ci: add workflow to run tests on PR event (#60) ## 1.4.1