updates CHANGES #77
Workflow file for this run
This file contains 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: | |
- '**' # matches every branch | |
concurrency: | |
group: "${{ github.workflow }}-${{ github.ref }}" | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
id-token: write | |
attestations: write | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
concurrency: | |
group: changes-group | |
cancel-in-progress: true | |
timeout-minutes: 1 | |
defaults: | |
run: | |
shell: bash | |
outputs: | |
run_tests: ${{steps.changes.outputs.run_tests }} | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- id: changes | |
name: Check for file changes | |
uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0 | |
with: | |
base: ${{ github.ref }} | |
token: ${{ github.token }} | |
filters: .github/file-filters.yml | |
ci: | |
runs-on: ubuntu-latest | |
name: Test py${{ matrix.python-version }}/dj${{matrix.django-version}} | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
max-parallel: 1 | |
matrix: | |
python-version: [ "3.11", "3.12" ] | |
django-version: [ "4.2", "5.1" ] | |
fail-fast: true | |
needs: [ changes ] | |
if: needs.changes.outputs.run_tests | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: 'x64' | |
- name: Restore cached venv | |
id: cache-venv-restore | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
.venv/ | |
key: ${{ matrix.python-version }}-${{matrix.django-version}}-${{ hashFiles('pyproject.toml') }}-venv | |
- uses: yezz123/setup-uv@v4 | |
with: | |
uv-version: "0.4.15" | |
- name: Test | |
continue-on-error: false | |
run: | | |
python3 -m venv .venv | |
uv export -q --no-hashes -o requirements.txt | |
.venv/bin/pip install -r requirements.txt | |
.venv/bin/pip install "django>=${{matrix.django-version}}" | |
.venv/bin/pytest tests --create-db --cov --junit-xml junit-${{ matrix.python-version }}-${{matrix.django-version}}.xml | |
- name: Cache venv | |
if: steps.cache-venv-restore.outputs.cache-hit != 'true' | |
id: cache-venv-save | |
uses: actions/cache/save@v4 | |
with: | |
path: | | |
.venv/ | |
key: ${{ matrix.python-version }}-${{matrix.django-version}}-${{ hashFiles('pyproject.toml') }}-venv | |
- name: Upload pytest test results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pytest-results-${{ matrix.python-version }}-${{matrix.django-version}} | |
path: junit-${{ matrix.python-version }}-${{matrix.django-version}}.xml | |
if: matrix.python-version == 3.12 | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
if: matrix.python-version == 3.12 | |
continue-on-error: true | |
with: | |
env_vars: OS,PYTHON | |
fail_ci_if_error: true | |
files: coverage.xml | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: false | |
name: codecov-${{env.GITHUB_REF_NAME}} |