Skip to content

👷 Run coverage only in CI/CD #44

👷 Run coverage only in CI/CD

👷 Run coverage only in CI/CD #44

Workflow file for this run

name: tests
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
PYTHONUTF8: 1
jobs:
unittest-python:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Set up python ${{ matrix.python-version }} (${{ matrix.os }})
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install cli tools
run: |
python -m pip install --upgrade pipx
python -m pipx ensurepath
pipx install phosphorus yamk
- name: Create and activate a virtual environment (${{ matrix.os }})
shell: bash
if: ${{ runner.os != 'Windows' }}
run: |
python -m venv .venv
echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV
echo "$PWD/.venv/bin" >> $GITHUB_PATH
- name: Create and activate a virtual environment (${{ matrix.os }})
shell: pwsh
if: ${{ runner.os == 'Windows' }}
run: |
python -m venv .venv
"VIRTUAL_ENV=.venv" | Out-File -FilePath $env:GITHUB_ENV -Append
"$PWD/.venv/Scripts" | Out-File -FilePath $env:GITHUB_PATH -Append
- name: Use cache
uses: actions/cache@v4
with:
path: .venv
key: ${{ matrix.os }}-${{ matrix.python-version }}-lint-${{ hashFiles('pyproject.toml') }}
- name: Install dependencies
run: |
yam install -g main -g test
- name: Test the project
run: |
yam -e tests --cov --junitxml=junit.xml -o junit_family=legacy
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}