lightning/.github/workflows/ci_test-conda.yml

98 lines
3.3 KiB
YAML

name: Test with Conda
# 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 master branch
push:
branches: [master, "release/*"]
pull_request:
branches: [master, "release/*"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
cancel-in-progress: ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }}
defaults:
run:
shell: bash -l {0}
jobs:
conda:
runs-on: ubuntu-20.04
container: pytorchlightning/pytorch_lightning:base-conda-py${{ matrix.python-version }}-torch${{ matrix.pytorch-version }}
strategy:
fail-fast: false
matrix:
python-version: ["3.8"] # previous to last Python version as that one is already used in test-full
pytorch-version: ["1.8", "1.9", "1.10"]
# nightly: add when there's a release candidate
include:
- {python-version: "3.9", pytorch-version: "1.11"}
timeout-minutes: 30
steps:
- name: Workaround for https://github.com/actions/checkout/issues/760
run: git config --global --add safe.directory /__w/lightning/lightning
- uses: actions/checkout@v2
- name: Update base dependencies
run: |
conda info
conda list
pip install -r requirements/test.txt
- name: DocTests
run: |
coverage run --source pytorch_lightning -m pytest pytorch_lightning
- name: Update all dependencies
env:
HOROVOD_BUILD_ARCH_FLAGS: "-mfma"
HOROVOD_WITHOUT_MXNET: 1
HOROVOD_WITHOUT_TENSORFLOW: 1
run: |
set -e
# adjust versions according installed Torch version
python ./requirements/adjust-versions.py requirements/extra.txt
python ./requirements/adjust-versions.py requirements/examples.txt
pip install -r requirements/devel.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html
pip install -r requirements/strategies.txt
# set a per-test timeout of 2.5 minutes to fail sooner; this aids with hanging tests
pip install pytest-timeout
pip list
# sanity check
python requirements/check-avail-extras.py
- name: Pull legacy checkpoints
run: bash .actions/pull_legacy_checkpoints.sh
- name: UnitTests
run: |
coverage run --source pytorch_lightning -m pytest --timeout 150 tests -v --durations=50 --junitxml=junit/test-results-${{ runner.os }}-torch${{ matrix.pytorch-version }}.xml
- name: Upload pytest results
uses: actions/upload-artifact@v2
with:
name: pytest-results-${{ runner.os }}-torch${{ matrix.pytorch-version }}
path: junit/test-results-${{ runner.os }}-torch${{ matrix.pytorch-version }}.xml
if-no-files-found: error
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,torch${{ matrix.pytorch-version }}
name: CPU-coverage
fail_ci_if_error: false