Skip to content

Develop

Develop #196

Workflow file for this run

name: Test
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
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@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set Up Git Identity
run: |
git fetch -v -v -v --all --unshallow
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 }}"
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.10"
- name: Install dependencies
run: |
pip install pipx==1.2.1
- name: Update Pre-Commits
run: |
pipx install pre-commit==3.5.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: |
pipx install python-semantic-release==8.3.0
semantic-release -v version --no-vcs-release --no-commit
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
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.10"
- name: Install Global Dependencies
run: |
pip install pipx
- name: Check Linting and Format
run: |
pip install -e .
pip install pre-commit==3.5.0
pre-commit run --all-files
- name: Run Tests
run: |
pip install pytest pytest-cov
pytest --cov --cov-report=xml:coverage-report.xml
# - 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==8.3.0
# git-stats-report -vv -t "$(semantic-release -v version --print)"
- name: Check Build and Wheel
run: |
pipx run build
pipx run twine check --strict dist/*