name: Test PyTorch - slow # see: https://help.github.com/en/actions/reference/events-that-trigger-workflows on: push: branches: [master, "release/*"] pull_request: branches: [master, "release/*"] types: [opened, reopened, ready_for_review, synchronize] # add `ready_for_review` since draft is skipped paths: - ".github/workflows/ci-pytorch-tests-slow.yml" - "requirements/pytorch/**" - "src/pytorch_lightning/**" - "tests/tests_pytorch/**" - "setup.cfg" # includes pytest config - "requirements/lite/**" - "src/lightning_lite/**" - ".actions/**" concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }} cancel-in-progress: ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }} jobs: pl-slow: runs-on: ${{ matrix.os }} if: github.event.pull_request.draft == false strategy: fail-fast: false matrix: os: [ubuntu-20.04, windows-2022, macOS-11] # TODO: package parametrization # same config as '.azure-pipelines/gpu-tests-pytorch.yml' python-version: ["3.7"] pytorch-version: ["1.11"] timeout-minutes: 20 steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - 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 }}-pip-py${{ matrix.python-version }}-${{ hashFiles('requirements/pytorch/base.txt') }} restore-keys: | ${{ runner.os }}-pip-py${{ matrix.python-version }}- - name: Install lite for PL # Lite shall have pin version, so to keep development aligned we need to install lite from source not from pypi # also installing from source not from on-the-fly created package to prevent accidental interaction with cache env: PACKAGE_NAME: "lite" run: | pip install -e . --upgrade --find-links https://download.pytorch.org/whl/cpu/torch_stable.html git checkout -- setup.py MANIFEST.in - name: Install package & dependencies env: PACKAGE_NAME: "pytorch" FREEZE_REQUIREMENTS: 1 run: | # adjust versions according installed Torch version python ./requirements/pytorch/adjust-versions.py requirements.txt ${{ matrix.pytorch-version }} pip install -e .[test] --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --upgrade pip list shell: bash - name: Testing PyTorch working-directory: tests/tests_pytorch run: coverage run --source pytorch_lightning -m pytest -v --junitxml=results-${{ runner.os }}-py${{ matrix.python-version }}.xml env: PL_RUN_SLOW_TESTS: 1 - name: Upload pytest test results if: failure() uses: actions/upload-artifact@v3 with: name: unittest-results-${{ runner.os }}-py${{ matrix.python-version }} path: tests/tests_pytorch/results-${{ runner.os }}-py${{ matrix.python-version }}.xml - name: Statistics if: success() working-directory: tests/tests_pytorch run: | coverage report coverage xml - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 # see: https://github.com/actions/toolkit/issues/399 continue-on-error: true with: token: ${{ secrets.CODECOV_TOKEN }} file: tests/tests_pytorch/coverage.xml flags: cpu,pytest-slow,torch${{ matrix.pytorch-version }} name: CPU-coverage fail_ci_if_error: false