From 38443d30172e5ccc4e13765f1bad2accb9eaf9b4 Mon Sep 17 00:00:00 2001 From: Yiheng Wang Date: Wed, 9 Apr 2025 14:13:56 +0800 Subject: [PATCH 1/8] update setuptool Signed-off-by: Yiheng Wang --- .github/workflows/code-format-check.yml | 1 + .github/workflows/premerge-cpu.yml | 1 + .github/workflows/weekly-tests-cpu.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/workflows/code-format-check.yml b/.github/workflows/code-format-check.yml index 53d3f285..b09bc5ca 100644 --- a/.github/workflows/code-format-check.yml +++ b/.github/workflows/code-format-check.yml @@ -34,6 +34,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip wheel + python -m pip install --upgrade setuptools python -m pip install -r requirements-dev.txt - name: type check run: | diff --git a/.github/workflows/premerge-cpu.yml b/.github/workflows/premerge-cpu.yml index e6a5689e..d365d9bb 100644 --- a/.github/workflows/premerge-cpu.yml +++ b/.github/workflows/premerge-cpu.yml @@ -34,6 +34,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip wheel + python -m pip install --upgrade setuptools - name: check run: | # clean up temporary files diff --git a/.github/workflows/weekly-tests-cpu.yml b/.github/workflows/weekly-tests-cpu.yml index 4f8965b4..23ca679b 100644 --- a/.github/workflows/weekly-tests-cpu.yml +++ b/.github/workflows/weekly-tests-cpu.yml @@ -64,6 +64,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip wheel + python -m pip install --upgrade setuptools - name: check run: | # clean up temporary files From 1f4a3bf202f8fa792c3e0ea6585e4619ace40e30 Mon Sep 17 00:00:00 2001 From: Yiheng Wang Date: Wed, 9 Apr 2025 15:01:20 +0800 Subject: [PATCH 2/8] update script Signed-off-by: Yiheng Wang --- .github/workflows/weekly-tests-cpu.yml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/weekly-tests-cpu.yml b/.github/workflows/weekly-tests-cpu.yml index 23ca679b..1e6066b2 100644 --- a/.github/workflows/weekly-tests-cpu.yml +++ b/.github/workflows/weekly-tests-cpu.yml @@ -1,21 +1,27 @@ name: weekly-tests-cpu +# on: + # # weekly tests for existing bundles in release + # schedule: + # - cron: "0 5 * * 0" # 5:00, every Sunday + # # Allows you to run this workflow manually from the Actions tab + # workflow_dispatch: on: - # weekly tests for existing bundles in release - schedule: - - cron: "0 5 * * 0" # 5:00, every Sunday - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: + # code format check for pull requests and the dev branch + push: + branches: + - dev + pull_request: jobs: get-list: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up Python 3.9 + - name: Set up Python 3.10 uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: 3.10.14 - name: cache weekly timestamp id: pip-cache run: | @@ -29,7 +35,8 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip wheel - python -m pip install -r requirements-dev.txt + python -m pip install --upgrade setuptools + pip install -r requirements.txt - name: get bundle list id: get-bundle-list run: | From 1e16e4d9337167a0039d9e6e51f65fa3462ea79c Mon Sep 17 00:00:00 2001 From: Yiheng Wang Date: Wed, 9 Apr 2025 15:02:01 +0800 Subject: [PATCH 3/8] use py310 Signed-off-by: Yiheng Wang --- .github/workflows/weekly-tests-cpu.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/weekly-tests-cpu.yml b/.github/workflows/weekly-tests-cpu.yml index 1e6066b2..cee475dc 100644 --- a/.github/workflows/weekly-tests-cpu.yml +++ b/.github/workflows/weekly-tests-cpu.yml @@ -54,10 +54,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up Python 3.9 + - name: Set up Python 3.10 uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: 3.10.14 - name: cache weekly timestamp id: pip-cache run: | From d0780473f73df57ec142e471aa4808e57d8ceeab Mon Sep 17 00:00:00 2001 From: Yiheng Wang Date: Wed, 9 Apr 2025 15:04:37 +0800 Subject: [PATCH 4/8] add missing cmd Signed-off-by: Yiheng Wang --- .github/workflows/weekly-tests-cpu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/weekly-tests-cpu.yml b/.github/workflows/weekly-tests-cpu.yml index cee475dc..e787eba9 100644 --- a/.github/workflows/weekly-tests-cpu.yml +++ b/.github/workflows/weekly-tests-cpu.yml @@ -36,7 +36,7 @@ jobs: run: | python -m pip install --upgrade pip wheel python -m pip install --upgrade setuptools - pip install -r requirements.txt + python -m pip install -r requirements.txt - name: get bundle list id: get-bundle-list run: | From 05e1239b2a02b916ba5c5b468ad56775c0ef39f5 Mon Sep 17 00:00:00 2001 From: Yiheng Wang Date: Wed, 9 Apr 2025 15:44:13 +0800 Subject: [PATCH 5/8] add huggingface hub Signed-off-by: Yiheng Wang --- ci/run_regular_tests_cpu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/run_regular_tests_cpu.sh b/ci/run_regular_tests_cpu.sh index 183af8d8..58f82d66 100755 --- a/ci/run_regular_tests_cpu.sh +++ b/ci/run_regular_tests_cpu.sh @@ -35,7 +35,7 @@ verify_release_bundle() { # get all bundles download_path="download" pip install git+https://github.com/Project-MONAI/MONAI.git@dev # project-monai/model-zoo issue #505 - pip install jsonschema gdown + pip install jsonschema gdown huggingface_hub==0.29.3 # download bundle from releases python $(pwd)/ci/download_latest_bundle.py --b "$bundle" --models_path $(pwd)/models --p "$download_path" # get required libraries according to the bundle's metadata file From c101f911cee571cfdc454f78d2689a640653caa2 Mon Sep 17 00:00:00 2001 From: Yiheng Wang Date: Wed, 9 Apr 2025 16:00:12 +0800 Subject: [PATCH 6/8] skip maici in weekly cpu test Signed-off-by: Yiheng Wang --- ci/run_regular_tests_cpu.sh | 54 +++++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/ci/run_regular_tests_cpu.sh b/ci/run_regular_tests_cpu.sh index 58f82d66..61a17499 100755 --- a/ci/run_regular_tests_cpu.sh +++ b/ci/run_regular_tests_cpu.sh @@ -30,30 +30,44 @@ elif [[ $# -gt 1 ]]; then exit 1 fi +# Usually, CPU test is required, but for some bundles that are too large to run in Github Actions, we can exclude them. +exclude_test_list=("maisi_ct_generative") +is_excluded() { + for item in "${exclude_list[@]}"; do + if [ "$1" == "$item" ]; then + return 0 # Return true (0) if excluded + fi + done + return 1 # Return false (1) if not excluded +} + verify_release_bundle() { echo 'Run verify bundle...' - # get all bundles - download_path="download" - pip install git+https://github.com/Project-MONAI/MONAI.git@dev # project-monai/model-zoo issue #505 - pip install jsonschema gdown huggingface_hub==0.29.3 - # download bundle from releases - python $(pwd)/ci/download_latest_bundle.py --b "$bundle" --models_path $(pwd)/models --p "$download_path" - # get required libraries according to the bundle's metadata file - requirements_file="requirements_$bundle.txt" - python $(pwd)/ci/get_bundle_requirements.py --b "$bundle" --requirements_file "$requirements_file" - # check if ALLOW_MONAI_RC is set to 1, if so, append --pre to the pip install command - if [ $ALLOW_MONAI_RC = true ]; then - include_pre_release="--pre" + if is_excluded "$bundle"; then + echo "skip '$bundle' weekly cpu tests." else - include_pre_release="" - fi - # Check if the requirements file exists and is not empty - if [ -s "$requirements_file" ]; then - echo "install required libraries for bundle: $bundle" - pip install $include_pre_release -r "$requirements_file" + download_path="download" + pip install git+https://github.com/Project-MONAI/MONAI.git@dev # project-monai/model-zoo issue #505 + pip install jsonschema gdown huggingface_hub==0.29.3 + # download bundle from releases + python $(pwd)/ci/download_latest_bundle.py --b "$bundle" --models_path $(pwd)/models --p "$download_path" + # get required libraries according to the bundle's metadata file + requirements_file="requirements_$bundle.txt" + python $(pwd)/ci/get_bundle_requirements.py --b "$bundle" --requirements_file "$requirements_file" + # check if ALLOW_MONAI_RC is set to 1, if so, append --pre to the pip install command + if [ $ALLOW_MONAI_RC = true ]; then + include_pre_release="--pre" + else + include_pre_release="" + fi + # Check if the requirements file exists and is not empty + if [ -s "$requirements_file" ]; then + echo "install required libraries for bundle: $bundle" + pip install $include_pre_release -r "$requirements_file" + fi + # verify bundle + python $(pwd)/ci/verify_bundle.py -b "$bundle" -p "$download_path" -m "regular" # regular tests on cpu fi - # verify bundle - python $(pwd)/ci/verify_bundle.py -b "$bundle" -p "$download_path" -m "regular" # regular tests on cpu } From 533533bc47113e73db5f8b8d0617f95586f40f38 Mon Sep 17 00:00:00 2001 From: Yiheng Wang Date: Wed, 9 Apr 2025 16:33:24 +0800 Subject: [PATCH 7/8] fix list naming error Signed-off-by: Yiheng Wang --- ci/run_premerge_cpu.sh | 2 +- ci/run_regular_tests_cpu.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/run_premerge_cpu.sh b/ci/run_premerge_cpu.sh index 87b72426..000424c3 100755 --- a/ci/run_premerge_cpu.sh +++ b/ci/run_premerge_cpu.sh @@ -33,7 +33,7 @@ fi # Usually, CPU test is required, but for some bundles that are too large to run in Github Actions, we can exclude them. exclude_test_list=("maisi_ct_generative") is_excluded() { - for item in "${exclude_list[@]}"; do + for item in "${exclude_test_list[@]}"; do # Use exclude_test_list here if [ "$1" == "$item" ]; then return 0 # Return true (0) if excluded fi diff --git a/ci/run_regular_tests_cpu.sh b/ci/run_regular_tests_cpu.sh index 61a17499..253cc86c 100755 --- a/ci/run_regular_tests_cpu.sh +++ b/ci/run_regular_tests_cpu.sh @@ -33,7 +33,7 @@ fi # Usually, CPU test is required, but for some bundles that are too large to run in Github Actions, we can exclude them. exclude_test_list=("maisi_ct_generative") is_excluded() { - for item in "${exclude_list[@]}"; do + for item in "${exclude_test_list[@]}"; do # Use exclude_test_list here if [ "$1" == "$item" ]; then return 0 # Return true (0) if excluded fi From 215b47ab413a08bfe0a8ea586b148e2bbb4b259c Mon Sep 17 00:00:00 2001 From: Yiheng Wang Date: Wed, 9 Apr 2025 16:47:41 +0800 Subject: [PATCH 8/8] revert tmp test Signed-off-by: Yiheng Wang --- .github/workflows/weekly-tests-cpu.yml | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/.github/workflows/weekly-tests-cpu.yml b/.github/workflows/weekly-tests-cpu.yml index e787eba9..d03b9872 100644 --- a/.github/workflows/weekly-tests-cpu.yml +++ b/.github/workflows/weekly-tests-cpu.yml @@ -1,17 +1,11 @@ name: weekly-tests-cpu -# on: - # # weekly tests for existing bundles in release - # schedule: - # - cron: "0 5 * * 0" # 5:00, every Sunday - # # Allows you to run this workflow manually from the Actions tab - # workflow_dispatch: on: - # code format check for pull requests and the dev branch - push: - branches: - - dev - pull_request: + # weekly tests for existing bundles in release + schedule: + - cron: "0 5 * * 0" # 5:00, every Sunday + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: jobs: get-list: