Skip to content

gh update(deps): bump codacy/codacy-analysis-cli-action (#6) #13

gh update(deps): bump codacy/codacy-analysis-cli-action (#6)

gh update(deps): bump codacy/codacy-analysis-cli-action (#6) #13

name: Tests & Coverage
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
tests:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
poetry-version: ["2.0.1"]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for better coverage reporting
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# cache: "poetry" # Enable poetry caching
- name: Set Up Poetry
uses: abatilo/actions-poetry@v4
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install dependencies
run: |
poetry config virtualenvs.create true
poetry install --all-extras --no-interaction
- name: Run tests with coverage
env:
PYTHONPATH: ${{ github.workspace }}
run: |
poetry run coverage erase
poetry run coverage run -m pytest
poetry run coverage xml
- name: Coveralls GitHub Action
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run codacy-coverage-reporter
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: "coverage.xml"
language: "python"
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.python-version }}
path: coverage.xml
retention-days: 14