mirror of
https://github.com/koxudaxi/datamodel-code-generator.git
synced 2024-03-18 14:54:37 +03:00
106 lines
3.4 KiB
YAML
106 lines
3.4 KiB
YAML
name: Test
|
|
|
|
on:
|
|
pull_request: {}
|
|
|
|
jobs:
|
|
test:
|
|
name: Test on Python ${{ matrix.python-version }} and ${{ matrix.os }} and isort ${{ matrix.isort-version }} and pydantic ${{ matrix.pydantic-version }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
isort-version: [4.3.21, 5.6.4]
|
|
black-version: [22.1.0, default]
|
|
pydantic-version: [1.5.1, 1.10.9, 2.4.2]
|
|
include:
|
|
- os: ubuntu-latest
|
|
isort-version: 5.6.4
|
|
black-version: default
|
|
python-version: 3.8
|
|
pydantic-version: 1.8.2
|
|
exclude:
|
|
- os: windows-latest
|
|
black-version: 22.1.0
|
|
- os: macos-latest
|
|
black-version: 22.1.0
|
|
- os: windows-latest
|
|
isort-version: 4.3.21
|
|
- os: macos-latest
|
|
isort-version: 4.3.21
|
|
- os: windows-latest
|
|
pydantic-version: 1.5.1
|
|
- os: macos-latest
|
|
pydantic-version: 1.5.1
|
|
- python-version: 3.9
|
|
pydantic-version: 1.5.1
|
|
- python-version: 3.10
|
|
pydantic-version: 1.5.1
|
|
- python-version: 3.11
|
|
pydantic-version: 1.5.1
|
|
- python-version: 3.12
|
|
pydantic-version: 1.5.1
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
env:
|
|
OS: ${{ matrix.os }}
|
|
PYTHON: ${{ matrix.python-version }}
|
|
ISORT: ${{ matrix.isort-version }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Install Poetry
|
|
uses: snok/install-poetry@v1
|
|
with:
|
|
version: 1.4.2
|
|
virtualenvs-path: .venv
|
|
virtualenvs-create: true
|
|
virtualenvs-in-project: true
|
|
installer-parallel: true
|
|
- name: Load cached venv
|
|
id: cached-poetry-dependencies
|
|
uses: actions/cache@v2
|
|
if: matrix.os != 'windows-latest'
|
|
with:
|
|
path: .venv
|
|
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.pydantic-version }}-v1-${{ hashFiles('**/poetry.lock') }}
|
|
- name: Install dependencies
|
|
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
|
|
run: poetry install --no-interaction -E http
|
|
- name: Install isort ${{ matrix.isort-version }} for Linux/macOS
|
|
if: runner.os != 'Windows'
|
|
run: |
|
|
poetry run pip install isort=="$ISORT"
|
|
- name: Install Pydantic ${{ matrix.pydantic-version }}
|
|
if: matrix.pydantic-version != 'default'
|
|
run: |
|
|
poetry run pip install pydantic=="${{ matrix.pydantic-version }}"
|
|
- name: Install Black 22.1.0
|
|
if: matrix.black-version == '22.1.0'
|
|
run: |
|
|
poetry run pip install black=="22.1.0"
|
|
- name: Lint
|
|
if: matrix.pydantic-version == 'default'
|
|
run: |
|
|
source $VENV
|
|
./scripts/lint.sh
|
|
- name: Unit Test
|
|
run: |
|
|
source $VENV
|
|
./scripts/test.sh
|
|
- name: Upload coverage to Codecov
|
|
if: matrix.os == 'ubuntu-latest' && matrix.pydantic-version != '1.5.1'
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
flags: unittests
|
|
file: ./coverage.xml
|
|
fail_ci_if_error: true
|
|
env_vars: OS,PYTHON,ISORT
|