[pre-commit.ci] pre-commit suggestions #419
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
# this file is derived from https://raw.githubusercontent.com/PyTorchLightning/lightning-flash/master/.github/workflows/ci-testing.yml | |
name: CI testing | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }} | |
cancel-in-progress: ${{ ! (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) }} | |
jobs: | |
pytest: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04] | |
python-version: ["3.11"] | |
# Timeout: https://stackoverflow.com/a/59076067/4521646 | |
timeout-minutes: 35 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Note: This uses an internal pip API and may not always work | |
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow | |
- name: Get pip cache | |
id: pip-cache | |
run: | | |
python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)" | |
- name: Cache pip | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ runner.os }}-${{ matrix.python-version }}-td${{ steps.times.outputs.period }}-pip-${{ hashFiles('poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.python-version }}-td${{ steps.times.outputs.period }}-pip- | |
- name: Install packages | |
run: | | |
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python - --preview | |
poetry install | |
- name: Tests | |
run: | | |
poetry run coverage run --source alfort -m pytest -v --junitxml=junit/test-results-${{ runner.os }}-${{ matrix.python-version }}.xml | |
- name: Upload pytest test results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: pytest-results-${{ runner.os }}-${{ matrix.python-version }} | |
path: junit/test-results-${{ runner.os }}-${{ matrix.python-version }}.xml | |
if: failure() | |
- name: Statistics | |
if: success() | |
run: | | |
poetry run coverage report | |
poetry run coverage xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.xml | |
flags: unittests | |
env_vars: OS,PYTHON | |
name: codecov-umbrella | |
fail_ci_if_error: false |