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/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..3788404 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,47 @@ +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 + with: + fetch-depth: 0 + - run: | + 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 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