Skip to content

feat: skip contract tests if CI or doc changes #270

feat: skip contract tests if CI or doc changes

feat: skip contract tests if CI or doc changes #270

Workflow file for this run

name: PR
on:
pull_request:
branches:
- main
env:
PACT_BROKER_BASE_URL: ${{ secrets.PACT_BROKER_BASE_URL }}
PACT_BROKER_TOKEN: ${{ secrets.PACT_BROKER_TOKEN }}
GIT_COMMIT: ${{ github.sha }}
GIT_BRANCH: ${{ github.head_ref }}
jobs:
lint:
name: Lint Code
runs-on: ubuntu-20.04
steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.10.4
architecture: x64
- name: Install nox
run: |
pipx install poetry
pipx install nox
pipx inject nox nox-poetry
- name: Checkout PR branch
uses: actions/checkout@v4
- name: Run linting
run: nox --session=lint
test:
outputs:
previous_revision: ${{ steps.app.outputs.previous_revision }}
revision: ${{ steps.app.outputs.revision }}
env:
ALLURE_RESULTS: allure-results
ALLURE_TOKEN: ${{ secrets.ALLURE_TOKEN }}
name: Test Code
runs-on: ubuntu-20.04
steps:
- id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.PUBLIC_RELEASE_MANAGER_ID }}
private-key: ${{ secrets.PUBLIC_RELEASE_MANAGER_SECRET }}
- name: Checkout PR branch
uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
ref: ${{ github.event.repository.default_branch }}
fetch-depth: 50
fetch-tags: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.9.21
architecture: x64
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.10.16
architecture: x64
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.11.11
architecture: x64
- name: Install allurectl
uses: allure-framework/setup-allurectl@v1
with:
allure-endpoint: ${{ secrets.ALLURE_ENDPOINT }}
allure-token: ${{ secrets.ALLURE_TOKEN }}
allure-project-id: 34
- name: Install nox
run: |
pipx install poetry
pipx install nox
pipx inject nox nox-poetry
- name: Run tests
id: test
run: allurectl watch -- nox --session=tests
- name: Build package wheel
run: poetry build
- name: Check commit eligibility
uses: commitizen-tools/commitizen-action@master
with:
github_token: ${{ github.token }}
push: false
- name: get app revision
id: app
run: |
echo "previous_revision=$PREVIOUS_REVISION" >> $GITHUB_OUTPUT
echo "revision=$REVISION" >> $GITHUB_OUTPUT
- name: Publish pact
if: steps.test.outputs.previous_revision != steps.test.outputs.revision
run: make -f pact.mk publish_pacts
- name: get allure_run_id
if: always()
run: |
export ALLURE_LAUNCH_ID=$(allurectl job-run env | grep 'ALLURE_LAUNCH_ID' | cut -d '=' -f 2)
echo ALLURE_LAUNCH_ID=$ALLURE_LAUNCH_ID >> $GITHUB_ENV
can-i-deploy:
name: Check compatibility with SatVu APIs
runs-on: ubuntu-latest
needs: test
if: ${{ needs.test.outputs.previous_revision != needs.test.outputs.revision }}
steps:
- uses: actions/checkout@v4
- run: docker pull pactfoundation/pact-cli:latest
- name: Check compatibility with SatVu APIs on QA env
env:
ENVIRONMENT: qa
run: make -f pact.mk can_i_deploy
- name: Check compatibility with SatVu APIs on production env
if: always()
env:
ENVIRONMENT: production
run: make -f pact.mk can_i_deploy