fix: older Python versions don't know about new function args syntax #34
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: Run tests | |
on: | |
push: | |
branches-ignore: | |
# Once thing had been pushed to master branch, tests have already had to run and | |
# pass so no need to run them again | |
- "master" | |
jobs: | |
run_tests: | |
strategy: | |
matrix: | |
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] | |
os: [ubuntu-latest] | |
data-layer: ["SQLAlchemy 1.x", "SQLAlchemy 2.x"] | |
db-api: ["sqlite", "psycopg 2", "psycopg 3"] | |
runs-on: ${{ matrix.os }} | |
name: "🐍 ${{ matrix.python-version }} 🔹 ${{ matrix.data-layer }} 🔹 ${{ matrix.db-api }}" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: "📦 set up 🐍 ${{ matrix.python-version }}" | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
cache-dependency-path: pyproject.toml | |
- name: "📦 ensure latest 🐍 pip" | |
run: python -m pip install --upgrade pip | |
- name: "📦 ensure latest 🐍 wheel" | |
run: python -m pip install --upgrade wheel | |
- name: "📦 install SQLAlchemy 1.x" | |
if: ${{ matrix.data-layer == 'SQLAlchemy 1.x' }} | |
run: pip install "sqlalchemy<2.0.0" | |
- name: "📦 install SQLAlchemy 2.x" | |
if: ${{ matrix.data-layer == 'SQLAlchemy 2.x' }} | |
run: pip install "sqlalchemy>=2.0.0" | |
- name: "📦 install psycopg 2" | |
if: ${{ matrix.db-api == 'psycopg 2' }} | |
run: pip install "psycopg2-binary" | |
- name: "📦 install psycopg 3" | |
if: ${{ matrix.db-api == 'psycopg 3' }} | |
run: pip install "psycopg[binary]" | |
- name: "📦 install flask-rest-jsonoapi-next" | |
run: pip install .[tests] | |
- name: "run tests 🔹 🐍 ${{ matrix.python-version }} 🔹 ${{ matrix.data-layer }} 🔹 ${{ matrix.db-api }}" | |
run: pytest | |
#--------------------------------------------------------------------------------- | |
# Tests coverage | |
#--------------------------------------------------------------------------------- | |
# We need coverage data only from single tests run. | |
- name: "run tests with coverage" | |
if: ${{ matrix.python-version == '3.11' && matrix.data-layer == 'SQLAlchemy 2.x' && matrix.db-api == 'psycopg 3'}} | |
run: coverage run -m pytest | |
- name: "coverage report" | |
if: ${{ matrix.python-version == '3.11' && matrix.data-layer == 'SQLAlchemy 2.x' && matrix.db-api == 'psycopg 3'}} | |
run: coverage report | |
- name: "generate coverage xml" | |
if: ${{ matrix.python-version == '3.11' && matrix.data-layer == 'SQLAlchemy 2.x' && matrix.db-api == 'psycopg 3'}} | |
run: coverage xml -i | |
- name: "generate coverage report" | |
if: ${{ matrix.python-version == '3.11' && matrix.data-layer == 'SQLAlchemy 2.x' && matrix.db-api == 'psycopg 3'}} | |
run: coverage report | |
- name: "upload coverage to codecov.io" | |
if: ${{ matrix.python-version == '3.11' && matrix.data-layer == 'SQLAlchemy 2.x' && matrix.db-api == 'psycopg 3'}} | |
uses: codecov/[email protected] | |
with: | |
file: ./coverage.xml |