Skip to content

Commit c20da21

Browse files
awaelchlilexierule
authored andcommitted
Revert "Remove skipping logic in favor of path filtering (#14170)" (#14244)
(cherry picked from commit fcf9b42)
1 parent d16c9eb commit c20da21

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
python -c "fname = 'requirements/pytorch/strategies.txt' ; lines = [line for line in open(fname).readlines() if 'horovod' not in line] ; open(fname, 'w').writelines(lines)"
@@ -78,6 +79,7 @@ jobs:
7879
PACKAGE_NAME: pytorch
7980
FREEZE_REQUIREMENTS: 1
8081
displayName: 'Install dependencies'
82+
condition: eq(variables['continue'], '1')
8183
8284
- bash: |
8385
set -e
@@ -86,20 +88,24 @@ jobs:
8688
python requirements/pytorch/check-avail-strategies.py
8789
python requirements/pytorch/check-avail-extras.py
8890
displayName: 'Env details'
91+
condition: eq(variables['continue'], '1')
8992
9093
- bash: bash .actions/pull_legacy_checkpoints.sh
9194
displayName: 'Get legacy checkpoints'
95+
condition: eq(variables['continue'], '1')
9296

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

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

104110
- bash: bash run_standalone_tests.sh
105111
workingDirectory: tests/tests_pytorch
@@ -108,14 +114,7 @@ jobs:
108114
PL_RUN_CUDA_TESTS: "1"
109115
displayName: 'Testing: PyTorch standalone tests'
110116
timeoutInMinutes: "35"
111-
112-
- bash: bash run_standalone_tasks.sh
113-
workingDirectory: tests/tests_pytorch
114-
env:
115-
PL_USE_MOCKED_MNIST: "1"
116-
PL_RUN_CUDA_TESTS: "1"
117-
displayName: 'Testing: PyTorch standalone tasks'
118-
timeoutInMinutes: "10"
117+
condition: eq(variables['continue'], '1')
119118

120119
- bash: |
121120
python -m coverage report
@@ -125,13 +124,14 @@ jobs:
125124
ls -l
126125
workingDirectory: tests/tests_pytorch
127126
displayName: 'Statistics'
127+
condition: eq(variables['continue'], '1')
128128
129129
- task: PublishTestResults@2
130130
displayName: 'Publish test results'
131131
inputs:
132132
testResultsFiles: '$(Build.StagingDirectory)/test-results.xml'
133133
testRunTitle: '$(Agent.OS) - $(Build.DefinitionName) - Python $(python.version)'
134-
condition: succeededOrFailed()
134+
condition: and(succeededOrFailed(), eq(variables['continue'], '1'))
135135

136136
- script: |
137137
set -e
@@ -143,9 +143,11 @@ jobs:
143143
env:
144144
PL_USE_MOCKED_MNIST: "1"
145145
displayName: 'Testing: PyTorch examples'
146+
condition: eq(variables['continue'], '1')
146147
147148
- bash: python -m pytest benchmarks -v --maxfail=2 --durations=0
148149
workingDirectory: tests/tests_pytorch
149150
env:
150151
PL_RUN_CUDA_TESTS: "1"
151152
displayName: 'Testing: PyTorch benchmarks'
153+
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 }}
@@ -43,7 +37,28 @@ jobs:
4337

4438
- uses: actions/checkout@v2
4539

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

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

6379
- name: Update all dependencies
80+
if: ${{ (steps.skip.outputs.continue == '1') }}
6481
env:
6582
HOROVOD_BUILD_ARCH_FLAGS: "-mfma"
6683
HOROVOD_WITHOUT_MXNET: 1
@@ -80,9 +97,11 @@ jobs:
8097
python requirements/pytorch/check-avail-extras.py
8198
8299
- name: Pull legacy checkpoints
100+
if: ${{ (steps.skip.outputs.continue == '1') }}
83101
run: bash .actions/pull_legacy_checkpoints.sh
84102

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

@@ -94,15 +113,15 @@ jobs:
94113
if: failure()
95114

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

0 commit comments

Comments
 (0)