Skip to content

Commit b9ae60d

Browse files
committed
update CI
1 parent d5b37e9 commit b9ae60d

File tree

15 files changed

+93
-75
lines changed

15 files changed

+93
-75
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/bin/bash
22
# Run this script from the project root.
33
URL="https://pl-public-data.s3.amazonaws.com/legacy/checkpoints.zip"
4-
mkdir -p legacy
4+
mkdir -p test/legacy
55
# wget is simpler but does not work on Windows
6-
python -c "from urllib.request import urlretrieve; urlretrieve('$URL', 'legacy/checkpoints.zip')"
7-
ls -l legacy/
8-
unzip -o legacy/checkpoints.zip -d legacy/
9-
ls -l legacy/checkpoints/
6+
python -c "from urllib.request import urlretrieve; urlretrieve('$URL', 'test/legacy/checkpoints.zip')"
7+
ls -l test/legacy/
8+
unzip -o test/legacy/checkpoints.zip -d test/legacy/
9+
ls -l test/legacy/checkpoints/

.azure-pipelines/gpu-benchmark.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,14 @@ jobs:
3434
clean: all
3535

3636
steps:
37-
- bash: |
38-
python -m pytest tests/benchmarks -v --durations=0
39-
displayName: 'Testing: benchmarks'
40-
env:
41-
PL_RUNNING_BENCHMARKS: 1
37+
38+
- bash: |
39+
pip install -e . -r requirements/strategies.txt
40+
pip list
41+
displayName: 'Install package'
42+
43+
- bash: python -m pytest unittests_pl/benchmarks -v --durations=0
44+
env:
45+
PL_RUNNING_BENCHMARKS: 1
46+
workingDirectory: test
47+
displayName: 'Testing: benchmarks'

.azure-pipelines/gpu-tests.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pr:
1717
- "release/*"
1818

1919
jobs:
20-
- job: pytest
20+
- job: testing
2121
strategy:
2222
matrix:
2323
'PyTorch - LTS':
@@ -28,15 +28,12 @@ jobs:
2828
timeoutInMinutes: "100"
2929
# how much time to give 'run always even if cancelled tasks' before stopping them
3030
cancelTimeoutInMinutes: "2"
31-
3231
pool: azure-jirka-spot
33-
3432
container:
3533
image: $(image)
3634
# default shm size is 64m. Increase it to avoid:
3735
# 'Error while creating shared memory: unhandled system error, NCCL version 2.7.8'
3836
options: "--runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=all --shm-size=512m"
39-
4037
workspace:
4138
clean: all
4239

@@ -56,8 +53,9 @@ jobs:
5653
python -c "fname = 'requirements/strategies.txt' ; lines = [line for line in open(fname).readlines() if 'horovod' not in line] ; open(fname, 'w').writelines(lines)"
5754
CUDA_VERSION_MM=$(python -c "import torch ; print(''.join(map(str, torch.version.cuda.split('.')[:2])))")
5855
pip install "bagua-cuda$CUDA_VERSION_MM>=0.9.0"
59-
pip install . --requirement requirements/devel.txt
60-
pip install . --requirement requirements/strategies.txt
56+
pip install -e .
57+
pip install --requirement requirements/devel.txt
58+
pip install --requirement requirements/strategies.txt
6159
pip list
6260
displayName: 'Install dependencies'
6361
@@ -76,8 +74,12 @@ jobs:
7674
python -m coverage run --source pytorch_lightning -m pytest pytorch_lightning tests --ignore tests/benchmarks -v --junitxml=$(Build.StagingDirectory)/test-results.xml --durations=50
7775
displayName: 'Testing: standard'
7876
79-
- bash: |
80-
bash tests/standalone_tests.sh
77+
- bash: python -m coverage run --source pytorch_lightning -m pytest unittests_pl --ignore unittests_pl/benchmarks -v --junitxml=$(Build.StagingDirectory)/test-results.xml --durations=50
78+
displayName: 'Testing: unittests'
79+
workingDirectory: test
80+
81+
- bash: bash run_standalone_tests.sh
82+
workingDirectory: test
8183
env:
8284
PL_USE_MOCKED_MNIST: "1"
8385
displayName: 'Testing: standalone'
@@ -88,6 +90,7 @@ jobs:
8890
python -m coverage html
8991
python -m codecov --token=$(CODECOV_TOKEN) --commit=$(Build.SourceVersion) --flags=gpu,pytest --name="GPU-coverage" --env=linux,azure
9092
ls -l
93+
workingDirectory: test
9194
displayName: 'Statistics'
9295
9396
- task: PublishTestResults@2
@@ -117,6 +120,6 @@ jobs:
117120
PL_USE_MOCKED_MNIST: "1"
118121
displayName: 'Testing: examples'
119122
120-
- bash: |
121-
python -m pytest tests/benchmarks -v --maxfail=2 --durations=0
123+
- bash: python -m pytest unittests_pl/benchmarks -v --maxfail=2 --durations=0
124+
workingDirectory: test
122125
displayName: 'Testing: benchmarks'

.azure-pipelines/hpu-tests.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,12 @@ pr:
1414
- "release/*"
1515

1616
jobs:
17-
- job: tests
18-
17+
- job: testing
1918
# how long to run the job before automatically cancelling
2019
timeoutInMinutes: "10"
2120
# how much time to give 'run always even if cancelled tasks' before stopping them
2221
cancelTimeoutInMinutes: "2"
23-
2422
pool: intel-hpus
25-
2623
workspace:
2724
clean: all
2825

@@ -38,15 +35,21 @@ jobs:
3835
displayName: 'Install dependencies'
3936
4037
- bash: |
41-
python -m pytest -sv tests/accelerators/test_hpu.py --forked --junitxml=hpu1_test-results.xml
38+
python -m pytest -sv unittests_pl/accelerators/test_hpu.py --forked --junitxml=hpu1_test-results.xml
39+
workingDirectory: test
4240
displayName: 'Single card HPU test'
4341
4442
- bash: |
45-
python -m pytest -sv tests/accelerators/test_hpu.py --forked --hpus 8 --junitxml=hpu8_test-results.xml
43+
python -m pytest -sv unittests_pl/accelerators/test_hpu.py --forked --hpus 8 --junitxml=hpu8_test-results.xml
44+
workingDirectory: test
4645
displayName: 'Multi card(8) HPU test'
4746
4847
- bash: |
49-
python -m pytest -sv tests/plugins/precision/hpu/test_hpu.py --hmp-bf16 'tests/plugins/precision/hpu/ops_bf16.txt' --hmp-fp32 'tests/plugins/precision/hpu/ops_fp32.txt' --forked --junitxml=hpu1_precision_test-results.xml
48+
python -m pytest -sv unittests_pl/plugins/precision/hpu/test_hpu.py --hmp-bf16 \
49+
'unittests_pl/plugins/precision/hpu/ops_bf16.txt' --hmp-fp32 \
50+
'unittests_pl/plugins/precision/hpu/ops_fp32.txt' --forked \
51+
--junitxml=hpu1_precision_test-results.xml
52+
workingDirectory: test
5053
displayName: 'HPU precision test'
5154
5255
- bash: |

.azure-pipelines/ipu-tests.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ variables:
1616
value: "poplar_sdk-ubuntu_20_04-2.3.1+793-89796d462d"
1717

1818
jobs:
19-
- job: tests
20-
19+
- job: testing
2120
# how long to run the job before automatically cancelling
2221
timeoutInMinutes: "15"
2322
pool: graphcore-ipus
24-
2523
workspace:
2624
clean: all
2725

@@ -55,7 +53,7 @@ jobs:
5553
export GIT_TERMINAL_PROMPT=1
5654
python ./requirements/adjust-versions.py requirements/extra.txt
5755
python ./requirements/adjust-versions.py requirements/examples.txt
58-
pip install . --requirement ./requirements/devel.txt
56+
pip install -e . --requirement ./requirements/devel.txt
5957
pip list
6058
displayName: 'Install dependencies'
6159
@@ -68,16 +66,22 @@ jobs:
6866
set -eux
6967
source ${{ variables.poplar_sdk }}/poplar-ubuntu*/enable.sh
7068
source ${{ variables.poplar_sdk }}/popart-ubuntu*/enable.sh
71-
7269
python -c "import poptorch; print(poptorch.__version__)"
7370
displayName: "Check poptorch installation"
7471
7572
- bash: |
7673
source ${{ variables.poplar_sdk }}/poplar-ubuntu*/enable.sh
7774
source ${{ variables.poplar_sdk }}/popart-ubuntu*/enable.sh
78-
export POPTORCH_WAIT_FOR_IPU=1
79-
export PL_RUN_IPU_TESTS=1
80-
python -m coverage run --source pytorch_lightning -m pytest tests -vv --junitxml=$(Build.StagingDirectory)/test-results.xml --durations=50
75+
python -m pytest pytorch_lightning
76+
displayName: 'DocTests'
77+
78+
- bash: |
79+
source ${{ variables.poplar_sdk }}/poplar-ubuntu*/enable.sh
80+
source ${{ variables.poplar_sdk }}/popart-ubuntu*/enable.sh
81+
cd test
82+
python -m coverage run --source pytorch_lightning -m pytest unittests_pl -vv --durations=50
8183
env:
8284
MKL_THREADING_LAYER: "GNU"
85+
POPTORCH_WAIT_FOR_IPU: 1
86+
PL_RUN_IPU_TESTS: 1
8387
displayName: 'Testing: standard'

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ references:
4040
# the image uses python 2.7 by default, force a different version
4141
pyenv global 3.7.3
4242
python --version
43-
pip install -r requirements/docs.txt
43+
pip install -e . -r requirements/docs.txt
4444
pip list
4545
cd docs
4646
make clean

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ To learn about development of docs, check out the docs [README.md](https://githu
134134

135135
### Testing
136136

137-
To learn about tests, check out the tests [README.md](https://github.com/PyTorchLightning/pytorch-lightning/blob/master/tests/README.md).
137+
To learn about tests, check out the tests [README.md](https://github.com/PyTorchLightning/pytorch-lightning/blob/master/test/README.md).
138138

139139
### Pull Request
140140

.github/workflows/ci_test-conda.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
run: |
4040
conda info
4141
conda list
42-
pip install -r requirements/test.txt
42+
pip install -e . -r requirements/test.txt
4343
4444
- name: DocTests
4545
run: |
@@ -67,19 +67,19 @@ jobs:
6767
run: bash .actions/pull_legacy_checkpoints.sh
6868

6969
- name: UnitTests
70-
run: |
71-
coverage run --source pytorch_lightning -m pytest --timeout 150 tests -v --durations=50 --junitxml=junit/test-results-${{ runner.os }}-torch${{ matrix.pytorch-version }}.xml
70+
working-directory: ./test
71+
run: coverage run --source pytorch_lightning -m pytest unittests_pl -v --timeout 150 --durations=50 --junitxml=results-${{ runner.os }}-torch${{ matrix.pytorch-version }}.xml
7272

7373
- name: Upload pytest results
7474
uses: actions/upload-artifact@v2
7575
with:
76-
name: pytest-results-${{ runner.os }}-torch${{ matrix.pytorch-version }}
77-
path: junit/test-results-${{ runner.os }}-torch${{ matrix.pytorch-version }}.xml
78-
if-no-files-found: error
76+
name: unittest-results-${{ runner.os }}-torch${{ matrix.pytorch-version }}
77+
path: test/results-${{ runner.os }}-torch${{ matrix.pytorch-version }}.xml
7978
if: failure()
8079

8180
- name: Statistics
8281
if: success()
82+
working-directory: ./test
8383
run: |
8484
coverage report
8585
coverage xml
@@ -91,7 +91,7 @@ jobs:
9191
continue-on-error: true
9292
with:
9393
token: ${{ secrets.CODECOV_TOKEN }}
94-
file: coverage.xml
94+
file: test/coverage.xml
9595
flags: cpu,pytest,torch${{ matrix.pytorch-version }}
9696
name: CPU-coverage
9797
fail_ci_if_error: false

.github/workflows/ci_test-full.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
run: |
8484
flag=$(python -c "print('--pre' if '${{matrix.release}}' == 'pre' else '')" 2>&1)
8585
url=$(python -c "print('test/cpu/torch_test.html' if '${{matrix.release}}' == 'pre' else 'cpu/torch_stable.html')" 2>&1)
86-
pip install -r requirements.txt --upgrade $flag --find-links "https://download.pytorch.org/whl/${url}"
86+
pip install -e . --upgrade $flag --find-links "https://download.pytorch.org/whl/${url}"
8787
pip install -r requirements/test.txt --upgrade
8888
pip list
8989
shell: bash
@@ -123,13 +123,12 @@ jobs:
123123
key: pl-dataset
124124

125125
- name: Sanity check
126-
run: |
127-
python requirements/check-avail-extras.py
126+
run: python requirements/check-avail-extras.py
128127

129128
- name: UnitTests
130-
run: |
131-
# NOTE: do not include coverage report here, see: https://github.com/nedbat/coveragepy/issues/1003
132-
coverage run --source pytorch_lightning -m pytest pytorch_lightning tests -v --durations=50 --junitxml=junit/test-results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}.xml
129+
working-directory: ./test
130+
# NOTE: do not include coverage report here, see: https://github.com/nedbat/coveragepy/issues/1003
131+
run: coverage run --source pytorch_lightning -m pytest unittests_pl -v --durations=50 --junitxml=results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}.xml
133132

134133
- name: Examples
135134
run: |
@@ -141,13 +140,13 @@ jobs:
141140
- name: Upload pytest results
142141
uses: actions/upload-artifact@v2
143142
with:
144-
name: pytest-results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}
145-
path: junit/test-results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}.xml
146-
if-no-files-found: error
143+
name: unittest-results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}
144+
path: test/results-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.requires }}-${{ matrix.release }}.xml
147145
if: failure()
148146

149147
- name: Statistics
150148
if: success()
149+
working-directory: ./test
151150
run: |
152151
coverage report
153152
coverage xml
@@ -159,7 +158,7 @@ jobs:
159158
continue-on-error: true
160159
with:
161160
token: ${{ secrets.CODECOV_TOKEN }}
162-
file: coverage.xml
161+
file: test/coverage.xml
163162
flags: cpu,pytest,python${{ matrix.python-version }}
164163
name: CPU-coverage
165164
fail_ci_if_error: false

.github/workflows/ci_test-slow.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,27 +49,27 @@ jobs:
4949
run: |
5050
# adjust versions according installed Torch version
5151
python ./requirements/adjust-versions.py requirements.txt ${{ matrix.pytorch-version }}
52-
pip install -r requirements.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --upgrade
52+
pip install -e . --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --upgrade
5353
pip install -r requirements/test.txt
5454
pip list
5555
shell: bash
5656

57-
- name: Tests
58-
run: |
59-
coverage run --source pytorch_lightning -m pytest tests -v --junitxml=junit/test-results-${{ runner.os }}-py${{ matrix.python-version }}.xml
57+
- name: UnitTests
58+
working-directory: ./test
59+
run: coverage run --source pytorch_lightning -m pytest unittests_pl -v --junitxml=results-${{ runner.os }}-py${{ matrix.python-version }}.xml
6060
env:
6161
PL_RUN_SLOW_TESTS: 1
6262

6363
- name: Upload pytest test results
6464
uses: actions/upload-artifact@v2
6565
with:
66-
name: pytest-results-${{ runner.os }}-py${{ matrix.python-version }}
67-
path: junit/test-results-${{ runner.os }}-py${{ matrix.python-version }}.xml
68-
if-no-files-found: error
66+
name: unittest-results-${{ runner.os }}-py${{ matrix.python-version }}
67+
path: test/results-${{ runner.os }}-py${{ matrix.python-version }}.xml
6968
if: failure()
7069

7170
- name: Statistics
7271
if: success()
72+
working-directory: ./test
7373
run: |
7474
coverage report
7575
coverage xml
@@ -81,7 +81,7 @@ jobs:
8181
continue-on-error: true
8282
with:
8383
token: ${{ secrets.CODECOV_TOKEN }}
84-
file: coverage.xml
84+
file: test/coverage.xml
8585
flags: cpu,pytest,torch${{ matrix.pytorch-version }}
8686
name: CPU-coverage
8787
fail_ci_if_error: false

0 commit comments

Comments
 (0)