chore(deps): lock file maintenance (#624) #3201
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: push workflow | |
on: [push, workflow_dispatch] | |
jobs: | |
run: | |
name: Python 3 | |
runs-on: ubuntu-latest | |
env: | |
OS: ubuntu-latest | |
PYTHON_VERSION: null | |
POETRY_VERSION: null | |
steps: | |
- uses: actions/checkout@v4.2.2 | |
- name: "get version from .tool-versions" | |
run: | | |
set -eux | |
cat .tool-versions | |
PYTHON_VERSION=$(grep -oP '(?<=python\s).+' .tool-versions) | |
if [ -z "$PYTHON_VERSION" ]; then | |
exit 1 | |
fi | |
echo "PYTHON_VERSION=${PYTHON_VERSION}" >> $GITHUB_ENV | |
POETRY_VERSION=$(grep -oP '(?<=poetry\s).+' .tool-versions) | |
if [ -z "$POETRY_VERSION" ]; then | |
exit 1 | |
fi | |
echo "POETRY_VERSION=${POETRY_VERSION}" >> $GITHUB_ENV | |
- name: Set up Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v5.3.0 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: "pip" | |
cache-dependency-path: pyproject.toml | |
- name: Cache tox environments | |
id: cache-tox | |
uses: actions/cache@v4.2.0 | |
with: | |
path: | | |
~/.cache/pre-commit | |
.tox | |
.venv | |
# pyproject.toml, poetry.lock and .pre-commit-config.yaml have versioning info that would | |
# impact the tox environment. | |
key: tox-${{ env.PYTHON_VERSION }}-${{ hashFiles( | |
'pyproject.toml', | |
'poetry.lock', | |
'.pre-commit-config.yaml', | |
'tox.ini') }} | |
- name: Install dependencies | |
run: | | |
set -eux | |
python -m pip install --upgrade pip | |
pip install poetry==${{ env.POETRY_VERSION }} | |
poetry install --no-interaction | |
- name: Run versions | |
run: | | |
set -eux | |
pip --version | |
poetry --version | |
poetry env info | |
- name: Run tox | |
run: | | |
set -eux | |
poetry run tox | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
fail_ci_if_error: true # optional (default = false) | |
file: ./coverage.xml | |
flags: pytest | |
env_vars: OS,PYTHON_VERSION | |
token: ${{ secrets.CODECOV_TOKEN }} # required | |
verbose: true # optional (default = false) |