Skip to content

Commit fcf9b42

Browse files
authored
Revert "Remove skipping logic in favor of path filtering (#14170)" (#14244)
1 parent acd4805 commit fcf9b42

File tree

8 files changed

+164
-75
lines changed

8 files changed

+164
-75
lines changed

.azure/gpu-tests.yml

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,15 @@ trigger:
1212
- "master"
1313
- "release/*"
1414
- "refs/tags/*"
15-
paths:
16-
include:
17-
- ".azure/**"
18-
- "examples/run_ddp_examples.sh"
19-
- "examples/convert_from_pt_to_pl/**"
20-
- "examples/run_pl_examples.sh"
21-
- "examples/pl_basics/backbone_image_classifier.py"
22-
- "examples/pl_basics/autoencoder.py"
23-
- "examples/pl_loops/mnist_lite.py"
24-
- "examples/pl_fault_tolerant/automatic.py"
25-
- "examples/test_pl_examples.py"
26-
- "examples/pl_integrations/dali_image_classifier.py"
27-
- "requirements/pytorch/**"
28-
- "src/pytorch_lightning/**"
29-
- "tests/tests_pytorch/**"
30-
- "setup.cfg"
31-
- "pyproject.toml"
32-
- ".github/workflows/ci-pytorch*.yml"
33-
- ".github/workflows/docs-*.yml"
34-
3515

3616
pr:
3717
- "master"
3818
- "release/*"
3919

20+
variables:
21+
- name: continue
22+
value: '1'
23+
4024
jobs:
4125
- job: testing
4226
strategy:
@@ -57,6 +41,22 @@ jobs:
5741
clean: all
5842

5943
steps:
44+
45+
- bash: |
46+
CHANGED_FILES=$(git diff --name-status origin/master -- . | awk '{print $2}')
47+
FILTER='src/pytorch_lightning|requirements/pytorch|tests/tests_pytorch|examples/pl_*'
48+
echo $CHANGED_FILES > changed_files.txt
49+
MATCHES=$(cat changed_files.txt | grep -E $FILTER)
50+
echo $MATCHES
51+
if [ -z "$MATCHES" ]; then
52+
echo "Skip"
53+
echo "##vso[task.setvariable variable=continue]0"
54+
else
55+
echo "Continue"
56+
echo "##vso[task.setvariable variable=continue]1"
57+
fi
58+
displayName: Skipper
59+
6060
- bash: |
6161
lspci | egrep 'VGA|3D'
6262
whereis nvidia
@@ -66,6 +66,7 @@ jobs:
6666
pip --version
6767
pip list
6868
displayName: 'Image info & NVIDIA'
69+
condition: eq(variables['continue'], '1')
6970
7071
- bash: |
7172
set -e
@@ -81,6 +82,7 @@ jobs:
8182
PACKAGE_NAME: pytorch
8283
FREEZE_REQUIREMENTS: 1
8384
displayName: 'Install dependencies'
85+
condition: eq(variables['continue'], '1')
8486
8587
- bash: |
8688
set -e
@@ -89,20 +91,24 @@ jobs:
8991
python requirements/pytorch/check-avail-strategies.py
9092
python requirements/pytorch/check-avail-extras.py
9193
displayName: 'Env details'
94+
condition: eq(variables['continue'], '1')
9295
9396
- bash: bash .actions/pull_legacy_checkpoints.sh
9497
displayName: 'Get legacy checkpoints'
98+
condition: eq(variables['continue'], '1')
9599

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

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

107113
- bash: bash run_standalone_tests.sh
108114
workingDirectory: tests/tests_pytorch
@@ -111,14 +117,7 @@ jobs:
111117
PL_RUN_CUDA_TESTS: "1"
112118
displayName: 'Testing: PyTorch standalone tests'
113119
timeoutInMinutes: "35"
114-
115-
- bash: bash run_standalone_tasks.sh
116-
workingDirectory: tests/tests_pytorch
117-
env:
118-
PL_USE_MOCKED_MNIST: "1"
119-
PL_RUN_CUDA_TESTS: "1"
120-
displayName: 'Testing: PyTorch standalone tasks'
121-
timeoutInMinutes: "10"
120+
condition: eq(variables['continue'], '1')
122121

123122
- bash: |
124123
python -m coverage report
@@ -128,13 +127,14 @@ jobs:
128127
ls -l
129128
workingDirectory: tests/tests_pytorch
130129
displayName: 'Statistics'
130+
condition: eq(variables['continue'], '1')
131131
132132
- task: PublishTestResults@2
133133
displayName: 'Publish test results'
134134
inputs:
135135
testResultsFiles: '$(Build.StagingDirectory)/test-results.xml'
136136
testRunTitle: '$(Agent.OS) - $(Build.DefinitionName) - Python $(python.version)'
137-
condition: succeededOrFailed()
137+
condition: and(succeededOrFailed(), eq(variables['continue'], '1'))
138138

139139
- script: |
140140
set -e
@@ -146,9 +146,11 @@ jobs:
146146
env:
147147
PL_USE_MOCKED_MNIST: "1"
148148
displayName: 'Testing: PyTorch examples'
149+
condition: eq(variables['continue'], '1')
149150
150151
- bash: python -m pytest benchmarks -v --maxfail=2 --durations=0
151152
workingDirectory: tests/tests_pytorch
152153
env:
153154
PL_RUN_CUDA_TESTS: "1"
154155
displayName: 'Testing: PyTorch benchmarks'
156+
condition: eq(variables['continue'], '1')

.github/file-filters.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This file contains filters to be used in the CI to detect file changes and run the required CI jobs.
2+
3+
app_examples:
4+
- "src/lightning_app/**"
5+
- "tests/tests_app_examples/**"
6+
- "requirements/app/**"
7+
- "examples/app_*"
8+
- "setup.py"
9+
- "src/pytorch_lightning/__version__.py"

.github/workflows/ci-app-cloud-e2e-test.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,37 @@ on: # Trigger the workflow on push or pull request, but only for the master bran
77
branches: [master, "release/*"]
88
pull_request:
99
branches: [master, "release/*"]
10-
paths:
11-
- ".github/workflows/ci-app-cloud-e2e-test.yml"
12-
- "requirements/app/**"
13-
- "src/lightning_app/**"
14-
- "examples/app_*"
1510

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

2015
jobs:
16+
# This is job should once only once per PR to detect file changes so run required jobs.
17+
# see .github/file-filters.yml to define file filters and run the jobs based on the output of each filter.
18+
# More info: https://github.com/marketplace/actions/paths-changes-filter
19+
20+
changes:
21+
runs-on: ubuntu-latest
22+
# Set job outputs to the values from filter step
23+
outputs:
24+
app_examples: ${{ steps.filter.outputs.app_examples }}
25+
steps:
26+
- uses: actions/checkout@v2
27+
- name: Set up Python 3.8
28+
uses: actions/setup-python@v2
29+
with:
30+
python-version: "3.8"
31+
32+
- uses: dorny/paths-filter@v2
33+
id: filter
34+
with:
35+
filters: .github/file-filters.yml
36+
2137
cloud-test:
2238
name: Cloud Test
39+
needs: changes
40+
if: ${{ needs.changes.outputs.app_examples == 'true' }}
2341
runs-on: ubuntu-20.04
2442
strategy:
2543
fail-fast: false

.github/workflows/ci-app-examples.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@ on: # Trigger the workflow on push or pull request, but only for the master bran
66
branches: [master, "release/*"]
77
pull_request:
88
branches: [master, "release/*"]
9-
paths:
10-
- ".github/workflows/ci-app-examples.yml"
11-
- "requirements/app/**"
12-
- "src/lightning_app/**"
13-
- "tests/tests_app_examples/**"
14-
# the examples are used in the app CI
15-
- "examples/app_*"
169

1710
concurrency:
1811
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}

.github/workflows/ci-app-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ on: # Trigger the workflow on push or pull request, but only for the master bran
66
branches: [master, "release/*"]
77
pull_request:
88
paths:
9-
- ".github/workflows/ci-app-tests.yml"
10-
- "requirements/app/**"
119
- "src/lightning_app/**"
1210
- "tests/tests_app/**"
11+
- "requirements/app/**"
12+
- "setup.py"
1313

1414
concurrency:
1515
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}

.github/workflows/ci-pytorch-test-conda.yml

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ on: # Trigger the workflow on push or pull request, but only for the master bra
66
branches: [master, "release/*"]
77
pull_request:
88
branches: [master, "release/*"]
9-
paths:
10-
- "requirements/pytorch/**"
11-
- "src/pytorch_lightning/**"
12-
- "tests/tests_pytorch/**"
13-
- "setup.cfg" # includes pytest config
14-
- ".github/workflows/ci-pytorch-test-conda.yml"
159

1610
concurrency:
1711
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
@@ -41,7 +35,28 @@ jobs:
4135

4236
- uses: actions/checkout@v2
4337

38+
- name: Get changed files
39+
id: changed-files
40+
uses: tj-actions/[email protected]
41+
42+
- name: Decide if the test should be skipped
43+
id: skip
44+
shell: bash -l {0}
45+
run: |
46+
FILTER='src/pytorch_lightning|requirements/pytorch|tests/tests_pytorch|examples/pl_*'
47+
echo "${{ steps.changed-files.outputs.all_changed_files }}" | tr " " "\n" > changed_files.txt
48+
MATCHES=$(cat changed_files.txt | grep -E $FILTER)
49+
echo $MATCHES
50+
if [ -z "$MATCHES" ]; then
51+
echo "Skip"
52+
echo "::set-output name=continue::0"
53+
else
54+
echo "Continue"
55+
echo "::set-output name=continue::1"
56+
fi
57+
4458
- name: Update base dependencies
59+
if: ${{ (steps.skip.outputs.continue == '1') }}
4560
env:
4661
PACKAGE_NAME: pytorch
4762
FREEZE_REQUIREMENTS: 1
@@ -55,10 +70,12 @@ jobs:
5570
run: pip install "Pillow<9.0" # It messes with torchvision
5671

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

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

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

@@ -92,15 +111,15 @@ jobs:
92111
if: failure()
93112

94113
- name: Statistics
95-
if: success()
114+
if: ${{ success() && (steps.skip.outputs.continue == '1') }}
96115
working-directory: tests/tests_pytorch
97116
run: |
98117
coverage report
99118
coverage xml
100119
101120
- name: Upload coverage to Codecov
102121
uses: codecov/codecov-action@v3
103-
if: success()
122+
if: ${{ success() && (steps.skip.outputs.continue == '1') }}
104123
# see: https://github.com/actions/toolkit/issues/399
105124
continue-on-error: true
106125
with:

0 commit comments

Comments
 (0)