build(deps): update codecov/codecov-action action to v5 (#1859) #3616
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: CI | |
on: | |
pull_request: | |
push: | |
branches: [master] | |
tags: ["*"] | |
workflow_dispatch: | |
inputs: | |
pytest_addopts: | |
description: | |
Extra options for pytest; use -vv for full details; see | |
https://docs.pytest.org/en/latest/example/simple.html#how-to-change-command-line-options-defaults | |
required: false | |
env: | |
LANG: "en_US.utf-8" | |
LC_ALL: "en_US.utf-8" | |
PIP_CACHE_DIR: ${{ github.workspace }}/.cache/pip | |
POETRY_CACHE_DIR: ${{ github.workspace }}/.cache/pypoetry | |
POETRY_VIRTUALENVS_IN_PROJECT: "true" | |
PRE_COMMIT_HOME: ${{ github.workspace }}/.cache/pre-commit | |
PYTEST_ADDOPTS: ${{ github.event.inputs.pytest_addopts }} | |
PYTHONIOENCODING: "UTF-8" | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- macos-latest | |
- ubuntu-latest | |
- windows-latest | |
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
# HACK https://github.com/actions/cache/issues/315 | |
- name: Enable msys binaries | |
if: ${{ runner.os == 'Windows' }} | |
run: | | |
echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
rm C:\msys64\usr\bin\bash.exe | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Needs all tags to compute dynamic version | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
allow-prereleases: true | |
- name: Get full Python version | |
id: full-python-version | |
shell: bash # Required for use of $GITHUB_OUTPUT in windows | |
run: | |
echo version=$(python -c "import sys; print('-'.join(str(v) for v in | |
sys.version_info))") >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
.cache | |
.venv | |
# prettier-ignore | |
key: | |
cache- | |
${{ runner.os }}- | |
${{ runner.arch }}- | |
${{ steps.full-python-version.outputs.version }}- | |
${{ hashFiles('pyproject.toml') }}- | |
${{ hashFiles('poetry.lock') }}- | |
${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: Install dependencies | |
run: | | |
python -m pip install poetry poetry-dynamic-versioning | |
poetry install --with dev,docs -v | |
- name: Run pytest | |
run: poetry run poe test --cov=./ --cov-report=xml -ra . | |
- name: Upload coverage to Codecov | |
continue-on-error: true | |
uses: codecov/codecov-action@v5 | |
env: | |
OS: ${{ matrix.os }} | |
PYTHON: ${{ matrix.python-version }} | |
with: | |
env_vars: OS,PYTHON | |
fail_ci_if_error: true | |
file: ./coverage.xml | |
flags: unittests | |
name: copier | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flake-check: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- macos-latest | |
- ubuntu-latest | |
runs-on: ${{ matrix.os }} | |
permissions: | |
contents: write # Allow pushing back pre-commit changes | |
steps: | |
- uses: actions/checkout@v4 | |
# Install Nix and set up Cachix | |
- uses: cachix/install-nix-action@v30 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- uses: cachix/cachix-action@v15 | |
with: | |
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} | |
extraPullNames: devenv | |
name: copier | |
pushFilter: (-source$|nixpkgs\.tar\.gz$) | |
# Cache for poetry venv when using direnv | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
.cache | |
.devenv | |
.direnv | |
.venv | |
# prettier-ignore | |
key: | |
direnv- | |
${{ runner.os }}- | |
${{ runner.arch }}- | |
${{ hashFiles('pyproject.toml', '*.lock', '*.nix') }} | |
# Check direnv works as expected | |
- uses: JRMurr/direnv-nix-action@v3 | |
with: | |
install-nix: "false" | |
cache-store: "false" | |
- run: copier --version | |
# Run nix checks | |
- run: nix flake check -L --accept-flake-config --impure | |
publish: | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
needs: | |
- build | |
- flake-check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Needs all tags to compute dynamic version | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Get full Python version | |
id: full-python-version | |
run: | |
echo version=$(python -c "import sys; print('-'.join(str(v) for v in | |
sys.version_info))") >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
.cache | |
.venv | |
# prettier-ignore | |
key: | |
cache- | |
${{ runner.os }}- | |
${{ runner.arch }}- | |
${{ steps.full-python-version.outputs.version }}- | |
${{ hashFiles('pyproject.toml') }}- | |
${{ hashFiles('poetry.lock') }}- | |
${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: Install dependencies | |
shell: bash | |
run: | | |
python -m pip install poetry poetry-dynamic-versioning | |
- name: Build dist | |
run: | | |
poetry build | |
- name: Publish distribution 📦 to Test PyPI | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
user: __token__ | |
password: ${{ secrets.test_pypi_token_copier }} | |
repository_url: https://test.pypi.org/legacy/ | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_token_copier }} |