[pre-commit.ci] pre-commit suggestions #90
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 complete testing | |
# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows | |
on: # Trigger the workflow on push or pull request, but only for the main branch | |
push: | |
branches: [main] | |
pull_request: {} | |
jobs: | |
pytest: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04, macOS-10.15, windows-2019] | |
python-version: [3.7] | |
# Timeout: https://stackoverflow.com/a/59076067/4521646 | |
timeout-minutes: 25 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
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: | | |
pip --version | |
python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)" | |
- name: Cache pip | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.python-version }}-pip- | |
- name: Install dependencies | |
run: | | |
pip install --requirement requirements.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html | |
pip install --requirement tests/requirements.txt | |
pip list | |
shell: bash | |
- name: Tests | |
run: | | |
python -m pytest . -v --cov=kaggle_imsegm --junitxml=junit/test-results-${{ runner.os }}-${{ matrix.python-version }}.xml | |
- name: Upload pytest test results | |
uses: actions/upload-artifact@v2 | |
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: | | |
coverage report | |
coverage xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
if: always() | |
# see: https://github.com/actions/toolkit/issues/399 | |
continue-on-error: true | |
with: | |
file: coverage.xml | |
flags: cpu,pytest,python${{ matrix.python-version }} | |
fail_ci_if_error: false |