Provide more clarification in error message #2356
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: 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.8", "3.9", "3.10", "3.11"] | |
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 | |
- run: git config --global user.name copier-ci | |
- run: git config --global user.email copier@copier | |
- run: git config --global core.autocrlf input | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Needs all tags to compute dynamic version | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: generate cache key PY | |
shell: bash | |
run: | |
echo "PY=$((python -VV; pip freeze) | sha256sum | cut -d' ' -f1)" >> | |
$GITHUB_ENV | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
.cache | |
.venv | |
key: | |
cache|${{ runner.os }}|${{ env.PY }}|${{ 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@v3 | |
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 }} | |
steps: | |
- uses: actions/checkout@v3 | |
# Install Nix and set up Cachix | |
- uses: cachix/install-nix-action@v22 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- uses: cachix/cachix-action@v12 | |
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@v3 | |
with: | |
path: | | |
.cache | |
.devenv | |
.direnv | |
.venv | |
key: | |
direnv|${{ runner.os }}|${{ 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 | |
publish: | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
needs: | |
- build | |
- flake-check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Needs all tags to compute dynamic version | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: generate cache key PY | |
run: | |
echo "PY=$((python -VV; pip freeze) | sha256sum | cut -d' ' -f1)" >> | |
$GITHUB_ENV | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
.cache | |
.venv | |
key: | |
cache|${{ runner.os }}|${{ env.PY }}|${{ 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 }} |