[pre-commit.ci] pre-commit suggestions #369
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 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: {} | |
pull_request: | |
branches: [main] | |
jobs: | |
pytest: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04] # macOS-11, windows-2019 | |
python-version: [3.7] | |
package: ["plant_pathology", "imet_collect", "cassava", "birdclef"] | |
# 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 }}-${{ matrix.package }}-pip-${{ hashFiles('setup.cfg') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.package }}-pip- | |
- name: Install dependencies | |
run: | | |
sudo apt install -y libsndfile1 | |
pip install ".[test,${{ matrix.package }}]" --find-links https://download.pytorch.org/whl/cpu/torch_stable.html | |
pip list | |
shell: bash | |
- name: Tests | |
env: | |
TEST_RESULTS: test-results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.package }}.xml | |
run: | | |
python -m pytest kaggle_imgclassif tests/${{ matrix.package }} -v --cov=kaggle_imgclassif --junitxml=junit/$TEST_RESULTS | |
- name: Upload pytest test results | |
uses: actions/upload-artifact@v2 | |
with: | |
name: pytest-results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.package }} | |
path: junit/test-results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.package }}.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: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: coverage.xml | |
flags: cpu,pytest,python${{ matrix.python-version }},${{ matrix.package }} | |
fail_ci_if_error: false |