Skip to content

Commit

Permalink
Fix: GitHub workflow script injection (#1936)
Browse files Browse the repository at this point in the history
Signed-off-by: Joyce Brum <joycebrum@google.com>
Co-authored-by: Mitchelle Rasquinha <80070689+mrasquinha-g@users.noreply.github.com>
  • Loading branch information
joycebrum and mrasquinha-g authored Nov 19, 2024
1 parent c570ff4 commit b2b346c
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 9 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:

env:
python_version: "3.9"
HEAD_REF: ${{ github.head_ref }}

jobs:
format-code:
Expand Down Expand Up @@ -41,9 +42,9 @@ jobs:
run: |
HAS_CHANGES=$(git diff --staged --name-only)
if [ ${#HAS_CHANGES} -gt 0 ]; then
git checkout -B "${{ github.head_ref }}"
git checkout -B "$HEAD_REF"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global user.name "${{ github.actor }}"
git commit -m '[Automated Commit] Format Codebase'
git push origin "${{ github.head_ref }}"
git push origin "$HEAD_REF"
fi
5 changes: 4 additions & 1 deletion .github/workflows/test-bert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
- .github/workflows/test-bert.yml
- '!**.md'

env:
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}

jobs:
build:

Expand All @@ -33,4 +36,4 @@ jobs:
python3 -m pip install cm4mlops
- name: Test BERT and end to end submission generation
run: |
cm run script --tags=run,mlperf,inference,generate-run-cmds,_submission,_short --quiet --submitter="MLCommons" --hw_name=default --model=bert-99 --implementation=reference --backend=${{ matrix.backend }} --device=cpu --scenario=Offline --adr.compiler.tags=gcc --adr.inference-src.version=custom --adr.inference-src.tags=_repo.${{ github.event.pull_request.head.repo.html_url }},_branch.${{ github.event.pull_request.head.ref }} --adr.loadgen.version=custom
cm run script --tags=run,mlperf,inference,generate-run-cmds,_submission,_short --quiet --submitter="MLCommons" --hw_name=default --model=bert-99 --implementation=reference --backend=${{ matrix.backend }} --device=cpu --scenario=Offline --adr.compiler.tags=gcc --adr.inference-src.version=custom --adr.inference-src.tags=_repo.${{ github.event.pull_request.head.repo.html_url }},_branch.$PR_HEAD_REF --adr.loadgen.version=custom
5 changes: 4 additions & 1 deletion .github/workflows/test-loadgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
- .github/workflows/test-loadgen.yml
- '!**.md'

env:
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}

jobs:
build:

Expand All @@ -31,4 +34,4 @@ jobs:
python3 -m pip install cm4mlops
- name: Test Loadgen
run: |
cm run script --tags=get,mlperf,inference,loadgen --quiet --version=custom --adr.inference-src.tags=_repo.${{ github.event.pull_request.head.repo.html_url }},_branch.${{ github.event.pull_request.head.ref }} --adr.loadgen.tags=_no-compilation-warnings
cm run script --tags=get,mlperf,inference,loadgen --quiet --version=custom --adr.inference-src.tags=_repo.${{ github.event.pull_request.head.repo.html_url }},_branch.$PR_HEAD_REF --adr.loadgen.tags=_no-compilation-warnings
5 changes: 4 additions & 1 deletion .github/workflows/test-resnet50.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ on:
- .github/workflows/test-resnet50.yml
- '!**.md'

env:
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}

jobs:
build:

Expand All @@ -35,4 +38,4 @@ jobs:
python3 -m pip install cm4mlops
- name: Test Resnet50 and end to end submission generation
run: |
cm run script --tags=run,mlperf,inference,generate-run-cmds,_submission,_short --quiet --submitter="MLCommons" --hw_name=default --model=resnet50 --implementation=reference --backend=${{ matrix.backend }} --device=cpu --scenario=Offline --test_query_count=500 --adr.compiler.tags=gcc --adr.inference-src.tags=_branch.${{ github.event.pull_request.head.ref }},_repo.${{ github.event.pull_request.head.repo.html_url }} --adr.inference-src.version=custom --adr.loadgen.version=custom ${{ matrix.loadgen-flag }}
cm run script --tags=run,mlperf,inference,generate-run-cmds,_submission,_short --quiet --submitter="MLCommons" --hw_name=default --model=resnet50 --implementation=reference --backend=${{ matrix.backend }} --device=cpu --scenario=Offline --test_query_count=500 --adr.compiler.tags=gcc --adr.inference-src.tags=_branch.$PR_HEAD_REF,_repo.${{ github.event.pull_request.head.repo.html_url }} --adr.inference-src.version=custom --adr.loadgen.version=custom ${{ matrix.loadgen-flag }}
5 changes: 4 additions & 1 deletion .github/workflows/test-retinanet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
- .github/workflows/test-retinanet.yml
- '!**.md'

env:
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}

jobs:
build:

Expand All @@ -33,4 +36,4 @@ jobs:
python3 -m pip install cm4mlops
- name: Test Retinanet and end to end submission generation
run: |
cm run script --tags=run,mlperf,inference,generate-run-cmds,_submission,_short --quiet --submitter="MLCommons" --hw_name=default --model=retinanet --implementation=reference --backend=${{ matrix.backend }} --device=cpu --scenario=Offline --test_query_count=10 --adr.compiler.tags=gcc --adr.inference-src.version=custom --adr.inference-src.tags=_repo.${{ github.event.pull_request.head.repo.html_url }},_branch.${{ github.event.pull_request.head.ref }} --adr.loadgen.version=custom
cm run script --tags=run,mlperf,inference,generate-run-cmds,_submission,_short --quiet --submitter="MLCommons" --hw_name=default --model=retinanet --implementation=reference --backend=${{ matrix.backend }} --device=cpu --scenario=Offline --test_query_count=10 --adr.compiler.tags=gcc --adr.inference-src.version=custom --adr.inference-src.tags=_repo.${{ github.event.pull_request.head.repo.html_url }},_branch.$PR_HEAD_REF --adr.loadgen.version=custom
5 changes: 4 additions & 1 deletion .github/workflows/test-rnnt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
- .github/workflows/test-rnnt.yml
- '!**.md'

env:
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}

jobs:
build:

Expand All @@ -36,4 +39,4 @@ jobs:
cm run script --quiet --tags=get,sys-utils-cm
- name: Test RNNT and end to end submission generation
run: |
cm run script --tags=run,mlperf,inference,generate-run-cmds,_performance-only --quiet --submitter="MLCommons" --hw_name=default --model=rnnt --implementation=reference --backend=${{ matrix.backend }} --device=cpu --scenario=Offline --precision=${{ matrix.precision }} --adr.compiler.tags=gcc --adr.inference-src.version=custom --adr.inference-src.env.CM_GIT_CHECKOUT=${{ github.event.pull_request.head.ref }} --adr.inference-src.env.CM_GIT_URL=${{ github.event.pull_request.head.repo.html_url }} --adr.ml-engine-pytorch.version=1.13.0 --adr.ml-engine-torchvision.version=0.14.1 --adr.librosa.version_max=0.9.1
cm run script --tags=run,mlperf,inference,generate-run-cmds,_performance-only --quiet --submitter="MLCommons" --hw_name=default --model=rnnt --implementation=reference --backend=${{ matrix.backend }} --device=cpu --scenario=Offline --precision=${{ matrix.precision }} --adr.compiler.tags=gcc --adr.inference-src.version=custom --adr.inference-src.env.CM_GIT_CHECKOUT=$PR_HEAD_REF --adr.inference-src.env.CM_GIT_URL=${{ github.event.pull_request.head.repo.html_url }} --adr.ml-engine-pytorch.version=1.13.0 --adr.ml-engine-torchvision.version=0.14.1 --adr.librosa.version_max=0.9.1
5 changes: 4 additions & 1 deletion .github/workflows/test-submission-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
- .github/workflows/test-submission-checker.yml
- '!**.md'

env:
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}

jobs:
build:

Expand All @@ -32,4 +35,4 @@ jobs:
git clone https://github.com/mlcommons/inference_results_v4.1 --depth 1
- name: Test MLPerf inference submission checker
run: |
cm run script --tags=run,mlperf,inference,submission,checker --adr.inference-src.tags=_branch.${{ github.event.pull_request.head.ref }},_repo.${{ github.event.pull_request.head.repo.html_url }} --adr.inference-src.version=custom --input=`pwd`/inference_results_v4.1 --src_version=v4.1 --extra_args=" --skip-extra-accuracy-files-check" --quiet
cm run script --tags=run,mlperf,inference,submission,checker --adr.inference-src.tags=_branch.$PR_HEAD_REF,_repo.${{ github.event.pull_request.head.repo.html_url }} --adr.inference-src.version=custom --input=`pwd`/inference_results_v4.1 --src_version=v4.1 --extra_args=" --skip-extra-accuracy-files-check" --quiet
5 changes: 4 additions & 1 deletion .github/workflows/test-tvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
- .github/workflows/test-tvm.yml
- '!**.md'

env:
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}

jobs:
build:

Expand All @@ -33,4 +36,4 @@ jobs:
python3 -m pip install cm4mlops
- name: Test Resnet50 TVM backend
run: |
cm run script --tags=run,mlperf,inference,generate-run-cmds --quiet --submitter="MLCommons" --hw_name=default --model=resnet50 --implementation=reference --backend=${{ matrix.backend }} --device=cpu --scenario=Offline --test_query_count=5 --adr.compiler.tags=gcc --adr.inference-src.version=custom --adr.inference-src.tags=_repo.${{ github.event.pull_request.head.repo.html_url }},_branch.${{ github.event.pull_request.head.ref }}
cm run script --tags=run,mlperf,inference,generate-run-cmds --quiet --submitter="MLCommons" --hw_name=default --model=resnet50 --implementation=reference --backend=${{ matrix.backend }} --device=cpu --scenario=Offline --test_query_count=5 --adr.compiler.tags=gcc --adr.inference-src.version=custom --adr.inference-src.tags=_repo.${{ github.event.pull_request.head.repo.html_url }},_branch.$PR_HEAD_REF

0 comments on commit b2b346c

Please sign in to comment.