.github/workflows/ci.yml
name: CI
on:
push:
branches:
- master
pull_request:
jobs:
test:
name: Test
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
uses: Gr1N/setup-poetry@v8
- name: Run tests
run: |
pip install --upgrade pip
poetry install -q
poetry run nox -s tests
mv .coverage .coverage.${{ matrix.os }}.${{ matrix.python-version }}
- name: Upload coverage to action
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.os }}.${{ matrix.python-version }}
path: .coverage.${{ matrix.os }}.${{ matrix.python-version }}
retention-days: 1
if-no-files-found: error
include-hidden-files: true
lint-and-format:
name: Lint
strategy:
fail-fast: false
matrix:
session: [types, formatting, imports, licensing, alls]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install python 3.8
uses: actions/setup-python@v3
with:
python-version: "3.8"
- name: Install poetry
uses: Gr1N/setup-poetry@v8
- name: Lint and format
run: |
pip install --upgrade pip
poetry install -q
poetry run nox -s ${{ matrix.session }}
upload-coverage:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
name: Upload coverage
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: python -m pip install coverage
- name: Download coverage
uses: actions/download-artifact@v4
with:
pattern: coverage-*
merge-multiple: true
- name: Combine coverage
run: |
coverage combine
coverage xml -i
- name: Upload coverage to Code Climate
uses: paambaati/codeclimate-action@v3.0.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.COV_TOKEN }}
with:
coverageLocations: .coverage.xml:coverage.py