Refactor main function signature and update pytest fixture decorators #263
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test | |
| on: | |
| push: | |
| branches: | |
| - "master" | |
| pull_request: | |
| branches: | |
| - "master" | |
| workflow_dispatch: | |
| permissions: read-all | |
| concurrency: | |
| group: "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}" | |
| cancel-in-progress: true | |
| jobs: | |
| check_changelog: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | |
| with: | |
| persist-credentials: false | |
| - name: Set Up Git Identity | |
| run: | | |
| git fetch --tags origin 'refs/tags/*:refs/tags/*' | |
| git fetch origin "${{ github.REF_NAME }}" || git fetch origin "${{ github.HEAD_REF }}" | |
| git switch "${{ github.REF_NAME }}" || git switch "${{ github.HEAD_REF }}" | |
| git config --global user.email "$(git log -1 --pretty=format:'%ae' | xargs)" | |
| git config --global user.name "${{ github.actor }}" | |
| git remote set-url origin "https://${{ github.actor }}:${{ secrets.PUSH_TOKEN }}@github.com/${{ github.repository }}" | |
| git config --list | |
| - name: Set up Python | |
| uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| pip install uv==0.7.8 | |
| - name: Update Pre-Commits | |
| run: | | |
| uv tool install pre-commit==4.2.0 | |
| pre-commit autoupdate | |
| differences=$(git diff | xargs) | |
| if [ -z "$differences" ]; then | |
| echo "No changes needed" | |
| exit 0 | |
| fi | |
| echo "::error::The pre-commit hooks are outdated" | |
| echo "$differences" | |
| git add --all | |
| git commit -m "chore(test): update versions of pre-commit hooks" | |
| git push | |
| sleep 30 | |
| exit 1 | |
| - name: Update Version and Changelog | |
| run: | | |
| uv tool install python-semantic-release==10.0.2 | |
| rm -f CHANGELOG.md | |
| semantic-release version --no-tag --no-commit --skip-build --changelog | |
| differences=$(git diff | xargs) | |
| if [ -z "$differences" ]; then | |
| echo "No changes needed" | |
| exit 0 | |
| fi | |
| echo "::error::The version and/or Changelog is outdated" | |
| echo "$differences" | |
| git add --all | |
| git commit -m "chore(release): bump version and update changelog" | |
| git push | |
| sleep 30 | |
| exit 1 | |
| test: | |
| runs-on: ubuntu-latest | |
| needs: check_changelog | |
| strategy: | |
| matrix: | |
| version: | |
| - "3.9" | |
| - "3.10" | |
| - "3.11" | |
| - "3.12" | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | |
| - name: Set up Python | |
| uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 | |
| with: | |
| python-version: "${{ matrix.version }}" | |
| - name: Install Global Dependencies | |
| run: | | |
| pip install pipx==1.2.1 | |
| - name: Check Linting and Format | |
| run: | | |
| pip install "pre-commit==4.2.0" "pre-commit-uv==4.1.4" | |
| pre-commit run --all-files | |
| - name: Install Project Dependencies | |
| run: | | |
| pipx install pipenv==2025.0.3 | |
| pipenv install --dev --deploy | |
| - name: Run Tests | |
| run: | | |
| pipenv run test | |
| - name: Check Breaking changes | |
| run: | | |
| git fetch -v -v -v --all --unshallow | |
| git switch "${{ github.REF_NAME }}" || git switch "${{ github.HEAD_REF }}" | |
| pipx install . | |
| pipx install python-semantic-release==10.0.2 | |
| pycracks -vv -t "$(semantic-release -v version --print)" | |
| - name: Upload coverage to Coveralls | |
| uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949 # v2.2.3 | |
| if: always() | |
| with: | |
| flag-name: "${{ matrix.version }}" | |
| parallel: true | |
| file: "coverage-report.xml" | |
| format: "cobertura" | |
| measure: true | |
| - name: Check Build and Wheel | |
| run: | | |
| pipx run build==1.2.2 | |
| pipx run twine==6.1.0 check --strict dist/* | |
| test-finish: | |
| needs: test | |
| if: always() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 | |
| with: | |
| egress-policy: audit | |
| - name: Coveralls Finished | |
| uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949 # v2.2.3 | |
| with: | |
| parallel-finished: true |