From 9659d075df0982813457eac937c2bbd75d9bc12f Mon Sep 17 00:00:00 2001 From: Harvey Lynden Date: Fri, 18 Oct 2024 11:30:40 +0200 Subject: [PATCH] API Stability Autils code is fetched from the pull request using the github.event.pull_request.head.sha. The tests are fetched from the master branch by running git fetch origin master and checking out only the tests/ directory from the master branch. Reference: https://github.com/avocado-framework/autils/issues/23 Signed-off-by: Harvey Lynden --- .github/workflows/modules-tests.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.github/workflows/modules-tests.yml b/.github/workflows/modules-tests.yml index 02bcb98..3b78513 100644 --- a/.github/workflows/modules-tests.yml +++ b/.github/workflows/modules-tests.yml @@ -30,3 +30,30 @@ jobs: uses: avocado-framework/avocado-ci-tools@main with: avocado-static-checks: true + + + api-stability-tests: + runs-on: ubuntu-latest + steps: + - name: Check out Autils code from PR + uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Fetch main branch + run: git fetch origin main + + - name: Check for changes in tests directory + id: test_changes + run: | + git diff --quiet origin/main -- tests/ + continue-on-error: true + + - name: Install Avocado to run tests + if: steps.test_changes.outcome == 'failure' + run: pip3 install 'avocado-framework<104.0' + + - name: Run API stability tests + if: steps.test_changes.outcome == 'failure' + run: ./tests/test_module.py metadata/autils/archive/ar.yml +