Skip to content

Commit

Permalink
[CI] refined ci runner (#328)
Browse files Browse the repository at this point in the history
* [CI] fix ci timeout

* trigger full test

* [CI] use subprocess to fix memory leak

* [ci] bug fix

* [CI] use test_run script to do fulltest

* [CI] trigger full test

* [CI] del unused code

* [CI] del unused code

* [CI] fix typo

* [CI] reset fulltest wrokflow
  • Loading branch information
zk1998 authored Jun 18, 2024
1 parent c95b8f7 commit 7ea8e96
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/full-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
vers: [ {pt_ver: "1.6.0", tv_ver: "0.7.0"}, {pt_ver: "1.7.0", tv_ver: "0.8.1"}, {pt_ver: "1.8.0", tv_ver: "0.9.0"}, {pt_ver: "1.9.0", tv_ver: "0.10.0"}, {pt_ver: "1.10.0", tv_ver: "0.11.1"}, {pt_ver: "1.11.0", tv_ver: "0.12.0"}, {pt_ver: "1.12.0", tv_ver: "0.13.0"} ]
include:
- os: macos-latest
vers:
vers:
pt_ver: latest
tv_ver: latest
defaults:
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
if [[ "$TORCHVISION_VER" == "latest" && "$PYTORCH_VER" == "latest" ]]; then
conda install pytorch torchvision cpuonly pillow=6 -c pytorch
elif [[ "$TORCHVISION_VER" == "0.9."* || "$TORCHVISION_VER" == "0.10."* ]]; then
conda install pillow=6 -c conda-forge
conda install pillow=6 -c conda-forge
conda install pytorch=$PYTORCH_VER torchvision=$TORCHVISION_VER cpuonly -c pytorch
else
conda install pytorch=$PYTORCH_VER torchvision=$TORCHVISION_VER cpuonly pillow=6 -c pytorch
Expand Down Expand Up @@ -83,4 +83,4 @@ jobs:
- name: Run tests
run: |
source activate.sh
pytest tests -v
python tests/test_run.py
4 changes: 2 additions & 2 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
vers: [ {pt_ver: "1.6.0", tv_ver: "0.7.0"}, {pt_ver: "latest", tv_ver: "latest"} ]
include:
- os: macos-latest
vers:
vers:
pt_ver: latest
tv_ver: latest
defaults:
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:
if [[ "$TORCHVISION_VER" == "latest" && "$PYTORCH_VER" == "latest" ]]; then
conda install pytorch torchvision cpuonly pillow=6 -c pytorch
elif [[ "$TORCHVISION_VER" == "0.9."* || "$TORCHVISION_VER" == "0.10."* ]]; then
conda install pillow=6 -c conda-forge
conda install pillow=6 -c conda-forge
conda install pytorch=$PYTORCH_VER torchvision=$TORCHVISION_VER cpuonly -c pytorch
else
conda install pytorch=$PYTORCH_VER torchvision=$TORCHVISION_VER cpuonly pillow=6 -c pytorch
Expand Down
29 changes: 29 additions & 0 deletions tests/test_run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import subprocess
import sys

import glob

# Function to run a test file
def run_test(file):
try:
subprocess.run(["pytest", "-v", file], check=True)
return True
except subprocess.CalledProcessError:
return False


if __name__ == "__main__":
# List of test files to run
test_files = glob.glob('tests/*_test.py', recursive=True)

print("Test files:")
for file in test_files:
print(f" - {file}")

pass_flag = True
for test_file in test_files:
passed = run_test(test_file)
pass_flag = pass_flag and passed

if not pass_flag:
sys.exit(1)

0 comments on commit 7ea8e96

Please sign in to comment.