From 5be9c96a83f57f56468418a0892c610fbacabc1e Mon Sep 17 00:00:00 2001 From: anandhu-eng Date: Mon, 7 Jul 2025 09:22:56 +0530 Subject: [PATCH 1/7] Fix for non interactive rclone-GDrive downloads --- .../workflows/run-tests-on-modified-meta.yml | 24 ++++++++++++++++++- script/get-ml-model-bevformer/meta.yaml | 1 + 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-tests-on-modified-meta.yml b/.github/workflows/run-tests-on-modified-meta.yml index b4d86b435..82ecc529c 100644 --- a/.github/workflows/run-tests-on-modified-meta.yml +++ b/.github/workflows/run-tests-on-modified-meta.yml @@ -12,6 +12,20 @@ concurrency: cancel-in-progress: true jobs: + fetch-secret: + runs-on: ubuntu-latest + outputs: + gdrive_secret: ${{ steps.op-load-secret.outputs.GDRIVE_SERVICE_ACCOUNT_KEY }} + steps: + - name: Load secret from 1Password + id: op-load-secret + uses: 1password/load-secrets-action@v2 + with: + export-env: false + env: + OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} + GDRIVE_SERVICE_ACCOUNT_KEY: op://7basd2jirojjckncf6qnq3azai/bzbaco3uxoqs2rcyu42rvuccga/credential + get_modified_files: runs-on: ubuntu-latest outputs: @@ -42,7 +56,9 @@ jobs: process_modified_files: runs-on: ubuntu-latest - needs: get_modified_files + needs: + - get_modified_files + - fetch-secret if: needs.get_modified_files.outputs.processed_files != '[]' && needs.get_modified_files.outputs.processed_files != '' strategy: fail-fast: false @@ -50,6 +66,12 @@ jobs: file_info: ${{ fromJSON(needs.get_modified_files.outputs.processed_files).file_info }} steps: + - name: Set RCLONE Service account env var from secret + shell: bash + run: | + echo "::add-mask::${{ needs.fetch-secret.outputs.gdrive_secret }}" + echo "RCLONE_CONFIG_MLC_COGNATA_SERVICE_ACCOUNT_CREDENTIALS=${{ needs.fetch-secret.outputs.gdrive_secret }}" >> $GITHUB_ENV + echo "RCLONE_CONFIG_MLC_NUSCENES_SERVICE_ACCOUNT_CREDENTIALS=${{ needs.fetch-secret.outputs.gdrive_secret }}" >> $GITHUB_ENV - name: Process meta.yaml file run: | echo "Processing ${{ matrix.file_info.file }} with run number ${{ matrix.file_info.num_run }}" diff --git a/script/get-ml-model-bevformer/meta.yaml b/script/get-ml-model-bevformer/meta.yaml index 4c877ed68..6246acc4b 100644 --- a/script/get-ml-model-bevformer/meta.yaml +++ b/script/get-ml-model-bevformer/meta.yaml @@ -6,6 +6,7 @@ tags: - get - ml-model - bevformer +- get-ml-model-bevformer uid: 438a053f666443bd new_env_keys: - MLC_ML_MODEL_BEVFORMER_PATH From 079ab1f3f26e7bfe2680496993b079d3f09247bb Mon Sep 17 00:00:00 2001 From: anandhu-eng Date: Tue, 8 Jul 2025 18:08:46 +0530 Subject: [PATCH 2/7] add seperate github action for testing sripts with modified meta --- .../list_modified_scripts_with_secrets.py | 38 ++++++++ .../workflows/run-tests-on-modified-meta.yml | 21 ---- ...un_tests_on_modified_meta_with_secrets.yml | 96 +++++++++++++++++++ 3 files changed, 134 insertions(+), 21 deletions(-) create mode 100644 .github/scripts/list_modified_scripts_with_secrets.py create mode 100644 .github/workflows/run_tests_on_modified_meta_with_secrets.yml diff --git a/.github/scripts/list_modified_scripts_with_secrets.py b/.github/scripts/list_modified_scripts_with_secrets.py new file mode 100644 index 000000000..c98e8f52b --- /dev/null +++ b/.github/scripts/list_modified_scripts_with_secrets.py @@ -0,0 +1,38 @@ +import yaml +import sys +import json +import os + + +def get_file_info(filepath): + with open(filepath, 'r') as file: + content = yaml.safe_load(file) + tests = content.get('tests', []) + needs_pat = content.get('needs_pat', False) + if tests and needs_pat: + num_tests = len(tests.get('run_inputs', [])) + else: + num_tests = 0 + uid = content['uid'] + return uid, num_tests + + +def process_files(files): + filenames = files.split(",") + return [ + { + "file": file, + "uid": uid, + "num_run": i + } + for file in filenames if os.path.basename(file) == 'meta.yaml' + for uid, num_tests in [get_file_info(file)] + for i in range(1, num_tests + 1) + ] + + +if __name__ == "__main__": + changed_files = sys.stdin.read().strip() + processed_files = process_files(changed_files) + json_processed_files = json.dumps(processed_files) + print(json_processed_files) \ No newline at end of file diff --git a/.github/workflows/run-tests-on-modified-meta.yml b/.github/workflows/run-tests-on-modified-meta.yml index 82ecc529c..e2dd3b8f2 100644 --- a/.github/workflows/run-tests-on-modified-meta.yml +++ b/.github/workflows/run-tests-on-modified-meta.yml @@ -12,20 +12,6 @@ concurrency: cancel-in-progress: true jobs: - fetch-secret: - runs-on: ubuntu-latest - outputs: - gdrive_secret: ${{ steps.op-load-secret.outputs.GDRIVE_SERVICE_ACCOUNT_KEY }} - steps: - - name: Load secret from 1Password - id: op-load-secret - uses: 1password/load-secrets-action@v2 - with: - export-env: false - env: - OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} - GDRIVE_SERVICE_ACCOUNT_KEY: op://7basd2jirojjckncf6qnq3azai/bzbaco3uxoqs2rcyu42rvuccga/credential - get_modified_files: runs-on: ubuntu-latest outputs: @@ -58,7 +44,6 @@ jobs: runs-on: ubuntu-latest needs: - get_modified_files - - fetch-secret if: needs.get_modified_files.outputs.processed_files != '[]' && needs.get_modified_files.outputs.processed_files != '' strategy: fail-fast: false @@ -66,12 +51,6 @@ jobs: file_info: ${{ fromJSON(needs.get_modified_files.outputs.processed_files).file_info }} steps: - - name: Set RCLONE Service account env var from secret - shell: bash - run: | - echo "::add-mask::${{ needs.fetch-secret.outputs.gdrive_secret }}" - echo "RCLONE_CONFIG_MLC_COGNATA_SERVICE_ACCOUNT_CREDENTIALS=${{ needs.fetch-secret.outputs.gdrive_secret }}" >> $GITHUB_ENV - echo "RCLONE_CONFIG_MLC_NUSCENES_SERVICE_ACCOUNT_CREDENTIALS=${{ needs.fetch-secret.outputs.gdrive_secret }}" >> $GITHUB_ENV - name: Process meta.yaml file run: | echo "Processing ${{ matrix.file_info.file }} with run number ${{ matrix.file_info.num_run }}" diff --git a/.github/workflows/run_tests_on_modified_meta_with_secrets.yml b/.github/workflows/run_tests_on_modified_meta_with_secrets.yml new file mode 100644 index 000000000..4c8a9deac --- /dev/null +++ b/.github/workflows/run_tests_on_modified_meta_with_secrets.yml @@ -0,0 +1,96 @@ +name: Test script on modified meta (with secret) + +on: + pull_request_target: + branches: [ "main", "dev" ] + paths: + - 'script/**meta.yaml' + +jobs: + fetch-secret: + runs-on: ubuntu-latest + outputs: + gdrive_secret: ${{ steps.op-load-secret.outputs.GDRIVE_SERVICE_ACCOUNT_KEY }} + steps: + - name: Load secret from 1Password + id: op-load-secret + uses: 1password/load-secrets-action@v2 + with: + export-env: false + env: + OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} + GDRIVE_SERVICE_ACCOUNT_KEY: op://7basd2jirojjckncf6qnq3azai/bzbaco3uxoqs2rcyu42rvuccga/credential + + get_modified_files: + runs-on: ubuntu-latest + outputs: + processed_files: ${{ steps.filter-modified-files.outputs.processed_files }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install dependencies + run: pip install pyyaml + + - name: Fetch base branch + run: | + git fetch origin +refs/heads/${{ github.event.pull_request.base.ref }}:refs/remotes/origin/${{ github.event.pull_request.base.ref }} + + - name: Get list of changed files + id: modified-files + run: | + git diff --name-only origin/${{ github.event.pull_request.base.ref }}...HEAD > changed_files.txt + files=$(paste -sd, changed_files.txt) + echo "files=$files" >> $GITHUB_OUTPUT + + - name: Filter changed files + id: filter-modified-files + env: + FILES: ${{ steps.modified-files.outputs.files }} + run: | + processed=$(echo "$FILES" | python3 .github/scripts/list_modified_scripts_with_secrets.py) + echo "processed_files<> $GITHUB_OUTPUT + echo "$processed" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: Debug processed_files output + run: | + echo "Processed files output:" + echo "${{ steps.filter-modified-files.outputs.processed_files }}" + + process_modified_files: + needs: + - get_modified_files + - fetch-secret + runs-on: ubuntu-latest + if: needs.get_modified_files.outputs.processed_files != '[]' + strategy: + fail-fast: false + matrix: + file_info: ${{ fromJSON(needs.get_modified_files.outputs.processed_files) }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: Set RCLONE Service account env var from secret + shell: bash + run: | + echo "::add-mask::${{ needs.fetch-secret.outputs.gdrive_secret }}" + echo "RCLONE_CONFIG_MLC_COGNATA_SERVICE_ACCOUNT_CREDENTIALS=${{ needs.fetch-secret.outputs.gdrive_secret }}" >> $GITHUB_ENV + echo "RCLONE_CONFIG_MLC_NUSCENES_SERVICE_ACCOUNT_CREDENTIALS=${{ needs.fetch-secret.outputs.gdrive_secret }}" >> $GITHUB_ENV + + - name: Process meta.yaml file + run: | + echo "Processing ${{ matrix.file_info.file }} (run #${{ matrix.file_info.num_run }})" + pip install mlcflow + mlc pull repo ${{ github.event.pull_request.head.repo.html_url }} --branch=${{ github.event.pull_request.head.ref }} + mlc test script ${{ matrix.file_info.uid }} --test_input_index=${{ matrix.file_info.num_run }} --docker_mlc_repo=${{ github.event.pull_request.head.repo.html_url }} --docker_mlc_repo_branch=${{ github.event.pull_request.head.ref }} --quiet From 47f3f2e518809ef9e99f420c6b299c9dc2c945b7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 8 Jul 2025 12:39:08 +0000 Subject: [PATCH 3/7] [Automated Commit] Format Codebase [skip ci] --- .github/scripts/list_modified_scripts_with_secrets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/list_modified_scripts_with_secrets.py b/.github/scripts/list_modified_scripts_with_secrets.py index c98e8f52b..f3a8df980 100644 --- a/.github/scripts/list_modified_scripts_with_secrets.py +++ b/.github/scripts/list_modified_scripts_with_secrets.py @@ -35,4 +35,4 @@ def process_files(files): changed_files = sys.stdin.read().strip() processed_files = process_files(changed_files) json_processed_files = json.dumps(processed_files) - print(json_processed_files) \ No newline at end of file + print(json_processed_files) From d18b7689f93155de0ae24af158b095b038ddd0d0 Mon Sep 17 00:00:00 2001 From: anandhu-eng Date: Tue, 8 Jul 2025 18:23:21 +0530 Subject: [PATCH 4/7] fix version of opencv-python --- script/app-mlperf-inference-mlcommons-python/meta.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/script/app-mlperf-inference-mlcommons-python/meta.yaml b/script/app-mlperf-inference-mlcommons-python/meta.yaml index d01b04c37..d9ea82cf5 100644 --- a/script/app-mlperf-inference-mlcommons-python/meta.yaml +++ b/script/app-mlperf-inference-mlcommons-python/meta.yaml @@ -1307,6 +1307,7 @@ variations: MLC_MLPERF_USE_MLCOMMONS_RUN_SCRIPT: "yes" deps: - tags: get,generic-python-lib,_opencv-python + version_max: "4.10.0.82" - tags: get,generic-sys-util,_libgl - tags: get,generic-python-lib,_numpy names: From 37f7958c5005bcffc53bcd3b51e1a7048788682e Mon Sep 17 00:00:00 2001 From: anandhu-eng Date: Tue, 8 Jul 2025 18:32:22 +0530 Subject: [PATCH 5/7] add needs pat key --- .github/scripts/list_modified_files.py | 2 +- .github/scripts/list_modified_scripts_with_secrets.py | 2 +- script/get-ml-model-abtf-ssd-pytorch/meta.yaml | 1 + script/get-ml-model-bevformer/meta.yaml | 1 + script/get-ml-model-deeplabv3_plus/meta.yaml | 1 + 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/scripts/list_modified_files.py b/.github/scripts/list_modified_files.py index c7acd1410..3c7781070 100644 --- a/.github/scripts/list_modified_files.py +++ b/.github/scripts/list_modified_files.py @@ -8,7 +8,7 @@ def get_file_info(filepath): with open(filepath, 'r') as file: content = yaml.safe_load(file) tests = content.get('tests', []) - needs_pat = content.get('needs_pat', False) + needs_pat = tests.get('needs_pat', False) if tests and not needs_pat: num_tests = len(tests.get('run_inputs', [])) else: diff --git a/.github/scripts/list_modified_scripts_with_secrets.py b/.github/scripts/list_modified_scripts_with_secrets.py index f3a8df980..976167a01 100644 --- a/.github/scripts/list_modified_scripts_with_secrets.py +++ b/.github/scripts/list_modified_scripts_with_secrets.py @@ -8,7 +8,7 @@ def get_file_info(filepath): with open(filepath, 'r') as file: content = yaml.safe_load(file) tests = content.get('tests', []) - needs_pat = content.get('needs_pat', False) + needs_pat = tests.get('needs_pat', False) if tests and needs_pat: num_tests = len(tests.get('run_inputs', [])) else: diff --git a/script/get-ml-model-abtf-ssd-pytorch/meta.yaml b/script/get-ml-model-abtf-ssd-pytorch/meta.yaml index 017acec37..54ea9e096 100644 --- a/script/get-ml-model-abtf-ssd-pytorch/meta.yaml +++ b/script/get-ml-model-abtf-ssd-pytorch/meta.yaml @@ -253,6 +253,7 @@ variations: env: MLC_DOWNLOAD_SRC: mlcommons tests: + needs_pat: true run_inputs: - variations_list: - onnx,rclone,mlc,dry-run diff --git a/script/get-ml-model-bevformer/meta.yaml b/script/get-ml-model-bevformer/meta.yaml index 6246acc4b..509190518 100644 --- a/script/get-ml-model-bevformer/meta.yaml +++ b/script/get-ml-model-bevformer/meta.yaml @@ -76,6 +76,7 @@ variations: env: MLC_DOWNLOAD_EXTRA_OPTIONS: --dry-run tests: + needs_pat: true run_inputs: - variations_list: - onnx,rclone,mlc,dry-run diff --git a/script/get-ml-model-deeplabv3_plus/meta.yaml b/script/get-ml-model-deeplabv3_plus/meta.yaml index 66215eb09..455b24566 100644 --- a/script/get-ml-model-deeplabv3_plus/meta.yaml +++ b/script/get-ml-model-deeplabv3_plus/meta.yaml @@ -84,6 +84,7 @@ variations: env: MLC_DOWNLOAD_EXTRA_OPTIONS: --dry-run tests: + needs_pat: true run_inputs: - variations_list: - onnx,rclone,mlc,dry-run From 1a555b7c73b041f83d66530c5da9a3bacc78f4a3 Mon Sep 17 00:00:00 2001 From: anandhu-eng Date: Tue, 8 Jul 2025 18:37:35 +0530 Subject: [PATCH 6/7] fix version for numpy --- script/app-mlperf-inference-mlcommons-python/meta.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/script/app-mlperf-inference-mlcommons-python/meta.yaml b/script/app-mlperf-inference-mlcommons-python/meta.yaml index d9ea82cf5..a7d5d776b 100644 --- a/script/app-mlperf-inference-mlcommons-python/meta.yaml +++ b/script/app-mlperf-inference-mlcommons-python/meta.yaml @@ -1312,6 +1312,7 @@ variations: - tags: get,generic-python-lib,_numpy names: - numpy + version_max: "1.26.4" - tags: get,generic-python-lib,_pycocotools prehook_deps: - tags: get,generic-python-lib,_protobuf From d60d9e1cfb4388d58a444471973690c0f031a006 Mon Sep 17 00:00:00 2001 From: anandhu-eng Date: Tue, 8 Jul 2025 18:44:39 +0530 Subject: [PATCH 7/7] fix datatype of tests --- .github/scripts/list_modified_files.py | 2 +- .github/scripts/list_modified_scripts_with_secrets.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/scripts/list_modified_files.py b/.github/scripts/list_modified_files.py index 3c7781070..282cc0484 100644 --- a/.github/scripts/list_modified_files.py +++ b/.github/scripts/list_modified_files.py @@ -7,7 +7,7 @@ def get_file_info(filepath): with open(filepath, 'r') as file: content = yaml.safe_load(file) - tests = content.get('tests', []) + tests = content.get('tests', {}) needs_pat = tests.get('needs_pat', False) if tests and not needs_pat: num_tests = len(tests.get('run_inputs', [])) diff --git a/.github/scripts/list_modified_scripts_with_secrets.py b/.github/scripts/list_modified_scripts_with_secrets.py index 976167a01..108a2d402 100644 --- a/.github/scripts/list_modified_scripts_with_secrets.py +++ b/.github/scripts/list_modified_scripts_with_secrets.py @@ -7,7 +7,7 @@ def get_file_info(filepath): with open(filepath, 'r') as file: content = yaml.safe_load(file) - tests = content.get('tests', []) + tests = content.get('tests', {}) needs_pat = tests.get('needs_pat', False) if tests and needs_pat: num_tests = len(tests.get('run_inputs', []))