WIP: Pydantic v2 compat #9211
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: 🔂 Unit tests | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
paths: | |
- "strawberry/**" | |
- "tests/**" | |
- "pyproject.toml" | |
- "poetry.lock" | |
- ".github/workflows/test.yml" | |
jobs: | |
generate-jobs-tests: | |
name: 💻 Generate test matrix | |
runs-on: ubuntu-latest | |
outputs: | |
sessions: ${{ steps.set-matrix.outputs.sessions }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: wntrblm/nox@main | |
- run: pipx install poetry | |
- run: pipx inject nox nox-poetry | |
- id: set-matrix | |
shell: bash | |
run: | | |
echo sessions=$( | |
nox --json -t tests -l | | |
jq 'map( | |
{ | |
session, | |
name: "\( .name ) on \( .python )\( if .call_spec != {} then " (\(.call_spec | to_entries | map("\(.key)=\(.value)") | join(", ")))" else "" end )" | |
} | |
)' | |
) | tee --append $GITHUB_OUTPUT | |
unit-tests: | |
name: 🔬 ${{ matrix.session.name }} | |
needs: [generate-jobs-tests] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
session: ${{ fromJson(needs.generate-jobs-tests.outputs.sessions) }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: wntrblm/nox@main | |
with: | |
python-versions: "3.7, 3.8, 3.9, 3.10, 3.11" | |
- name: Pip and nox cache | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
~/.nox | |
.nox | |
key: | |
${{ runner.os }}-nox-${{ matrix.session.session }}-${{ | |
hashFiles('**/poetry.lock') }}-${{ hashFiles('**/noxfile.py') }} | |
restore-keys: | | |
${{ runner.os }}-nox-${{ matrix.session.session }}- | |
${{ runner.os }}-nox- | |
- run: pipx install coverage | |
- run: pipx install poetry | |
- run: pipx inject nox nox-poetry | |
- run: nox -r -t tests -s "${{ matrix.session.session }}" | |
- name: coverage xml | |
run: coverage xml -i | |
if: ${{ always() }} | |
- uses: codecov/codecov-action@v3 | |
if: ${{ always() }} | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
verbose: true | |
lint: | |
name: ✨ Lint | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: wntrblm/nox@main | |
with: | |
python-versions: "3.7, 3.8, 3.9, 3.10, 3.11" | |
- name: Pip and nox cache | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
~/.nox | |
.nox | |
key: | |
${{ runner.os }}-nox-lint-${{ matrix.session.session }}-${{ | |
hashFiles('**/poetry.lock') }}-${{ hashFiles('**/noxfile.py') }} | |
restore-keys: | | |
${{ runner.os }}-lint-nox-${{ matrix.session.session }}- | |
${{ runner.os }}-lint-nox- | |
- run: pipx install poetry | |
- run: pipx inject nox nox-poetry | |
- run: nox -r -t lint | |
unit-tests-on-windows: | |
name: 🪟 Tests on Windows | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: wntrblm/nox@main | |
with: | |
python-versions: "3.7, 3.8, 3.9, 3.10, 3.11" | |
- name: Pip and nox cache | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
~/.nox | |
.nox | |
key: | |
${{ runner.os }}-nox-windows-${{ | |
hashFiles('**/poetry.lock') }}-${{ hashFiles('**/noxfile.py') }} | |
restore-keys: | | |
${{ runner.os }}-nox-windows | |
${{ runner.os }}-nox- | |
- run: pipx install poetry | |
- run: pipx inject nox nox-poetry | |
- run: nox -r -s "Tests" -p 3.11 |