Merge pull request #118 from DanCardin/dc/bunmp #263
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: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
pydantic-version: ["1.0", "2.0"] | |
# No need to matrix test pydantic versions. But the matrix syntax still | |
# keeps the file DRY. | |
exclude: | |
- python-version: '3.8' | |
pydantic-version: '1.0' | |
- python-version: '3.9' | |
pydantic-version: '1.0' | |
- python-version: '3.11' | |
pydantic-version: '1.0' | |
- python-version: '3.12' | |
pydantic-version: '1.0' | |
- python-version: '3.13-dev' | |
pydantic-version: '1.0' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: x64 | |
allow-prereleases: true | |
- name: Install poetry | |
uses: abatilo/actions-poetry@v2.0.0 | |
with: | |
poetry-version: 1.2.2 | |
- name: Set up cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pypoetry/virtualenvs | |
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-poetry- | |
- name: Install dependencies | |
run: make install | |
- name: Install pydantic matrix version | |
run: poetry run pip install 'pydantic~=${{ matrix.pydantic-version }}' | |
- name: Run Linters | |
run: poetry run make lint | |
if: ${{ !endsWith(matrix.python-version, '-dev') }} | |
- name: Run tests | |
run: poetry run make test | |
- name: Store test result artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
path: coverage.xml | |
- uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
name: python=${{ matrix.python-version }}-pydantic=${{matrix.pydantic-version}} | |
files: coverage.xml | |
finish: | |
needs: | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Join | |
run: echo Done |