Poetry update #263
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: Tests | |
on: | |
push: | |
branches: | |
- main | |
- "releases/**" | |
pull_request: | |
branches: | |
- main | |
- "releases/**" | |
workflow_dispatch: | |
# TODO: Add cron job to run tests on a regular basis | |
# schedule: | |
# - cron: "0 0 * * *" | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
env: | |
CACHE_DIR: /opt/.cache | |
PRE_COMMIT_HOME: /opt/.cache/pre-commit | |
BLACK_CACHE_DIR: /opt/.cache/black | |
RUFF_CACHE_DIR: /opt/.cache/ruff | |
MYPY_CACHE_DIR: /opt/.cache/mypy | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Poetry | |
run: pipx install --pip-args="-c .github/workflows/poetry-constraint.txt" poetry | |
- uses: actions/setup-python@v4 | |
with: | |
python-version-file: .python-version | |
cache: poetry | |
cache-dependency-path: | | |
poetry.lock | |
.github/workflows/env-markers/poetry-install.txt | |
- name: Install dependencies | |
run: poetry install | |
- name: Set PY | |
id: set-py | |
run: echo "PY=$(python -VV | sha256sum | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ env.CACHE_DIR }} | |
key: pre-commit-${{ runner.os }}-python-${{ steps.set-py.outputs.PY }}-config-and-deps-${{ hashFiles('.pre-commit-config.yaml', 'poetry.lock') }} | |
- name: Run pre-commit | |
env: | |
PRE_COMMIT_COLOR: always | |
run: poetry run pre-commit run --all-files | |
tests: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["3.11"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Poetry | |
run: pipx install --pip-args="-c .github/workflows/poetry-constraint.txt" poetry | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: poetry | |
cache-dependency-path: | | |
poetry.lock | |
.github/workflows/env-markers/poetry-install-only-main-test.txt | |
- name: Install dependencies | |
run: poetry install --only main,test | |
- name: Run tests | |
env: | |
PY_COLORS: 1 | |
run: poetry run coverage run -m pytest | |
- name: Report coverage | |
run: poetry run coverage report | |
# The following step will be removed when all the project will be covered by tests | |
- name: Maintain 100% coverage on tested modules | |
run: | | |
poetry run coverage report --fail-under 100 \ | |
xil/_currencies.py \ | |
xil/_headers.py \ | |
xil/_df_normalizer.py \ |