Skip to content

Commit

Permalink
Revert "Remove skipping logic in favor of path filtering (#14170)" (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
awaelchli committed Aug 17, 2022
1 parent b4250e5 commit 28ad5f8
Show file tree
Hide file tree
Showing 8 changed files with 164 additions and 75 deletions.
60 changes: 31 additions & 29 deletions .azure/gpu-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,15 @@ trigger:
- "master"
- "release/*"
- "refs/tags/*"
paths:
include:
- ".azure/**"
- "examples/run_ddp_examples.sh"
- "examples/convert_from_pt_to_pl/**"
- "examples/run_pl_examples.sh"
- "examples/pl_basics/backbone_image_classifier.py"
- "examples/pl_basics/autoencoder.py"
- "examples/pl_loops/mnist_lite.py"
- "examples/pl_fault_tolerant/automatic.py"
- "examples/test_pl_examples.py"
- "examples/pl_integrations/dali_image_classifier.py"
- "requirements/pytorch/**"
- "src/pytorch_lightning/**"
- "tests/tests_pytorch/**"
- "setup.cfg"
- "pyproject.toml"
- ".github/workflows/ci-pytorch*.yml"
- ".github/workflows/docs-*.yml"


pr:
- "master"
- "release/*"

variables:
- name: continue
value: '1'

jobs:
- job: testing
strategy:
Expand All @@ -57,6 +41,22 @@ jobs:
clean: all

steps:

- bash: |
CHANGED_FILES=$(git diff --name-status origin/master -- . | awk '{print $2}')
FILTER='src/pytorch_lightning|requirements/pytorch|tests/tests_pytorch|examples/pl_*'
echo $CHANGED_FILES > changed_files.txt
MATCHES=$(cat changed_files.txt | grep -E $FILTER)
echo $MATCHES
if [ -z "$MATCHES" ]; then
echo "Skip"
echo "##vso[task.setvariable variable=continue]0"
else
echo "Continue"
echo "##vso[task.setvariable variable=continue]1"
fi
displayName: Skipper
- bash: |
lspci | egrep 'VGA|3D'
whereis nvidia
Expand All @@ -66,6 +66,7 @@ jobs:
pip --version
pip list
displayName: 'Image info & NVIDIA'
condition: eq(variables['continue'], '1')
- bash: |
set -e
Expand All @@ -81,6 +82,7 @@ jobs:
PACKAGE_NAME: pytorch
FREEZE_REQUIREMENTS: 1
displayName: 'Install dependencies'
condition: eq(variables['continue'], '1')
- bash: |
set -e
Expand All @@ -89,20 +91,24 @@ jobs:
python requirements/pytorch/check-avail-strategies.py
python requirements/pytorch/check-avail-extras.py
displayName: 'Env details'
condition: eq(variables['continue'], '1')
- bash: bash .actions/pull_legacy_checkpoints.sh
displayName: 'Get legacy checkpoints'
condition: eq(variables['continue'], '1')

- bash: python -m coverage run --source pytorch_lightning -m pytest
workingDirectory: src/pytorch_lightning
displayName: 'Testing: PyTorch doctests'
condition: eq(variables['continue'], '1')

- bash: python -m coverage run --source pytorch_lightning -m pytest --ignore benchmarks -v --junitxml=$(Build.StagingDirectory)/test-results.xml --durations=50
env:
PL_RUN_CUDA_TESTS: "1"
workingDirectory: tests/tests_pytorch
displayName: 'Testing: PyTorch standard'
timeoutInMinutes: "35"
condition: eq(variables['continue'], '1')

- bash: bash run_standalone_tests.sh
workingDirectory: tests/tests_pytorch
Expand All @@ -111,14 +117,7 @@ jobs:
PL_RUN_CUDA_TESTS: "1"
displayName: 'Testing: PyTorch standalone tests'
timeoutInMinutes: "35"

- bash: bash run_standalone_tasks.sh
workingDirectory: tests/tests_pytorch
env:
PL_USE_MOCKED_MNIST: "1"
PL_RUN_CUDA_TESTS: "1"
displayName: 'Testing: PyTorch standalone tasks'
timeoutInMinutes: "10"
condition: eq(variables['continue'], '1')

- bash: |
python -m coverage report
Expand All @@ -128,13 +127,14 @@ jobs:
ls -l
workingDirectory: tests/tests_pytorch
displayName: 'Statistics'
condition: eq(variables['continue'], '1')
- task: PublishTestResults@2
displayName: 'Publish test results'
inputs:
testResultsFiles: '$(Build.StagingDirectory)/test-results.xml'
testRunTitle: '$(Agent.OS) - $(Build.DefinitionName) - Python $(python.version)'
condition: succeededOrFailed()
condition: and(succeededOrFailed(), eq(variables['continue'], '1'))

- script: |
set -e
Expand All @@ -146,9 +146,11 @@ jobs:
env:
PL_USE_MOCKED_MNIST: "1"
displayName: 'Testing: PyTorch examples'
condition: eq(variables['continue'], '1')
- bash: python -m pytest benchmarks -v --maxfail=2 --durations=0
workingDirectory: tests/tests_pytorch
env:
PL_RUN_CUDA_TESTS: "1"
displayName: 'Testing: PyTorch benchmarks'
condition: eq(variables['continue'], '1')
9 changes: 9 additions & 0 deletions .github/file-filters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file contains filters to be used in the CI to detect file changes and run the required CI jobs.

app_examples:
- "src/lightning_app/**"
- "tests/tests_app_examples/**"
- "requirements/app/**"
- "examples/app_*"
- "setup.py"
- "src/pytorch_lightning/__version__.py"
28 changes: 23 additions & 5 deletions .github/workflows/ci-app-cloud-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,37 @@ on: # Trigger the workflow on push or pull request, but only for the master bran
branches: [master, "release/*"]
pull_request:
branches: [master, "release/*"]
paths:
- ".github/workflows/ci-app-cloud-e2e-test.yml"
- "requirements/app/**"
- "src/lightning_app/**"
- "examples/app_*"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
# This is job should once only once per PR to detect file changes so run required jobs.
# see .github/file-filters.yml to define file filters and run the jobs based on the output of each filter.
# More info: https://github.com/marketplace/actions/paths-changes-filter

changes:
runs-on: ubuntu-latest
# Set job outputs to the values from filter step
outputs:
app_examples: ${{ steps.filter.outputs.app_examples }}
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: "3.8"

- uses: dorny/paths-filter@v2
id: filter
with:
filters: .github/file-filters.yml

cloud-test:
name: Cloud Test
needs: changes
if: ${{ needs.changes.outputs.app_examples == 'true' }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
Expand Down
7 changes: 0 additions & 7 deletions .github/workflows/ci-app-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ on: # Trigger the workflow on push or pull request, but only for the master bran
branches: [master, "release/*"]
pull_request:
branches: [master, "release/*"]
paths:
- ".github/workflows/ci-app-examples.yml"
- "requirements/app/**"
- "src/lightning_app/**"
- "tests/tests_app_examples/**"
# the examples are used in the app CI
- "examples/app_*"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-app-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ on: # Trigger the workflow on push or pull request, but only for the master bran
branches: [master, "release/*"]
pull_request:
paths:
- ".github/workflows/ci-app-tests.yml"
- "requirements/app/**"
- "src/lightning_app/**"
- "tests/tests_app/**"
- "requirements/app/**"
- "setup.py"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
Expand Down
35 changes: 27 additions & 8 deletions .github/workflows/ci-pytorch-test-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ on: # Trigger the workflow on push or pull request, but only for the master bra
branches: [master, "release/*"]
pull_request:
branches: [master, "release/*"]
paths:
- "requirements/pytorch/**"
- "src/pytorch_lightning/**"
- "tests/tests_pytorch/**"
- "setup.cfg" # includes pytest config
- ".github/workflows/ci-pytorch-test-conda.yml"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
Expand Down Expand Up @@ -41,7 +35,28 @@ jobs:

- uses: actions/checkout@v2

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v23.1

- name: Decide if the test should be skipped
id: skip
shell: bash -l {0}
run: |
FILTER='src/pytorch_lightning|requirements/pytorch|tests/tests_pytorch|examples/pl_*'
echo "${{ steps.changed-files.outputs.all_changed_files }}" | tr " " "\n" > changed_files.txt
MATCHES=$(cat changed_files.txt | grep -E $FILTER)
echo $MATCHES
if [ -z "$MATCHES" ]; then
echo "Skip"
echo "::set-output name=continue::0"
else
echo "Continue"
echo "::set-output name=continue::1"
fi
- name: Update base dependencies
if: ${{ (steps.skip.outputs.continue == '1') }}
env:
PACKAGE_NAME: pytorch
FREEZE_REQUIREMENTS: 1
Expand All @@ -55,10 +70,12 @@ jobs:
run: pip install "Pillow<9.0" # It messes with torchvision

- name: DocTests
if: ${{ (steps.skip.outputs.continue == '1') }}
working-directory: ./src
run: pytest pytorch_lightning --cov=pytorch_lightning

- name: Update all dependencies
if: ${{ (steps.skip.outputs.continue == '1') }}
env:
HOROVOD_BUILD_ARCH_FLAGS: "-mfma"
HOROVOD_WITHOUT_MXNET: 1
Expand All @@ -78,9 +95,11 @@ jobs:
python requirements/pytorch/check-avail-extras.py
- name: Pull legacy checkpoints
if: ${{ (steps.skip.outputs.continue == '1') }}
run: bash .actions/pull_legacy_checkpoints.sh

- name: Testing PyTorch
if: ${{ (steps.skip.outputs.continue == '1') }}
working-directory: tests/tests_pytorch
run: coverage run --source pytorch_lightning -m pytest -v --timeout 150 --durations=50 --junitxml=results-${{ runner.os }}-torch${{ matrix.pytorch-version }}.xml

Expand All @@ -92,15 +111,15 @@ jobs:
if: failure()

- name: Statistics
if: success()
if: ${{ success() && (steps.skip.outputs.continue == '1') }}
working-directory: tests/tests_pytorch
run: |
coverage report
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
if: success()
if: ${{ success() && (steps.skip.outputs.continue == '1') }}
# see: https://github.com/actions/toolkit/issues/399
continue-on-error: true
with:
Expand Down
Loading

0 comments on commit 28ad5f8

Please sign in to comment.