Skip to content

Commit e2d7b13

Browse files
authored
Merge branch 'main' into ali/sftp-key-file
2 parents 0fbf5db + afac9cf commit e2d7b13

File tree

230 files changed

+19733
-20038
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

230 files changed

+19733
-20038
lines changed

.github/workflows/run-tests.yaml

Lines changed: 49 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ jobs:
145145
needs: [model-tests]
146146
if: ${{ github.event_name == 'workflow_dispatch' && inputs.commit_report != 'None'}}
147147
runs-on: ["in-service"]
148+
outputs:
149+
pull-request-branch: ${{ steps.push-op-tests.outputs.pull-request-branch }}
148150
container:
149151
image: ${{ inputs.docker_tag }}
150152
credentials:
@@ -154,6 +156,7 @@ jobs:
154156
--rm -v /dev/hugepages-1G:/dev/hugepages-1G --device /dev/tenstorrent
155157
-v ${{ github.workspace }}:${{ github.workspace }} -w ${{ github.workspace }}
156158
env:
159+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
157160
PYTHONPATH: ${{ github.workspace }}
158161
steps:
159162
- uses: actions/checkout@v4
@@ -166,31 +169,37 @@ jobs:
166169
merge-multiple: true
167170
path: metrics/
168171

169-
- name: Push Autogen Op Tests
172+
- name: Generate Op Tests
173+
id: generate-op-tests
170174
run: |
171-
git config user.name "GitHub Actions"
172-
git config user.email "[email protected]"
173-
git pull
174-
175175
rm -rf tests/autogen_op/ # Remove old tests
176176
python3 tools/generate_input_variation_test_from_models.py
177177
python3 tools/generate_input_variation_test_from_models.py --merge=True
178178
if [ "${{ inputs.commit_report }}" == "All" ]; then
179-
git add --all
179+
echo "commit-glob=." >> $GITHUB_OUTPUT
180180
elif [ "${{ inputs.commit_report }}" == "Tests" ]; then
181-
git add tests/
181+
echo "commit-glob=tests/*" >> $GITHUB_OUTPUT
182182
else
183+
echo "commit-glob=nothing" >> $GITHUB_OUTPUT
183184
echo "No files will be committed"
184-
exit 0
185-
fi
186-
if git diff --cached --quiet; then
187-
echo "No changes to commit"
188-
exit 0
189-
else
190-
git commit -m '[auto][on-merge-queue] Update input variations tests'
191-
git push
192185
fi
193186
187+
- name: Push Autogen Op Tests
188+
uses: peter-evans/create-pull-request@v7
189+
id: push-op-tests
190+
if: ${{ steps.generate-op-tests.outputs.commit-glob != 'nothing' }}
191+
with:
192+
branch: ${{ env.BRANCH_NAME }}
193+
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
194+
author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
195+
base: main
196+
commit-message: "[auto][on-merge-queue] Update input variations tests"
197+
title: "Update PT2.0 Documentation"
198+
body: "This PR updates Documentation by rerunning autogenerated tests"
199+
delete-branch: true
200+
token: ${{ secrets.GH_TOKEN }}
201+
add-paths: ${{ steps.generate-op-tests.outputs.commit-glob }}
202+
194203
model-autogen-op-tests:
195204
needs: [push-autogen-op-tests, count-test-files]
196205
if: ${{ github.event_name == 'workflow_dispatch' && inputs.commit_report != 'None'}}
@@ -216,7 +225,6 @@ jobs:
216225
- name: Run Model Input Variations Tests
217226
run: |
218227
set +e
219-
git pull
220228
rm -rf tests/autogen_op/ALL
221229
python3 -m pytest --github-report tests/autogen_op --splits ${{ needs.count-test-files.outputs.num_files }} --group ${{ matrix.group }} -s
222230
exit_code=$? # Capture the exit code, but ignore any errors for now.
@@ -277,7 +285,7 @@ jobs:
277285
path: metrics-autogen-op/
278286

279287
collect-metrics:
280-
needs: [model-autogen-op-tests]
288+
needs: [model-autogen-op-tests, push-autogen-op-tests]
281289
if: ${{ github.event_name == 'workflow_dispatch' && inputs.commit_report != 'None'}}
282290
runs-on: ["in-service"]
283291
container:
@@ -289,6 +297,7 @@ jobs:
289297
--rm -v /dev/hugepages-1G:/dev/hugepages-1G --device /dev/tenstorrent
290298
-v ${{ github.workspace }}:${{ github.workspace }} -w ${{ github.workspace }}
291299
env:
300+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
292301
PYTHONPATH: ${{ github.workspace }}
293302
steps:
294303
- uses: actions/checkout@v4
@@ -321,36 +330,38 @@ jobs:
321330
# done
322331

323332
- name: Collect Metrics Report
333+
id: collect-metrics
324334
run: |
325335
python3 tools/collect_metrics.py
326-
git config user.name "GitHub Actions"
327-
git config user.email "[email protected]"
328-
git pull
329336
330-
if [ "${{ inputs.commit_report }}" == "All" ]; then
331-
git add --all
332-
elif [ "${{ inputs.commit_report }}" == "Docs" ]; then
333-
git add README.md
334-
git add docs/
337+
if [ "${{ inputs.commit_report }}" = "All" ]; then
338+
echo "commit-glob=." >> $GITHUB_OUTPUT
339+
elif [ "${{ inputs.commit_report }}" = "Docs" ]; then
340+
echo "commit-glob=README.md,docs/*" >> $GITHUB_OUTPUT
335341
else
342+
echo "commit-glob=nothing" >> $GITHUB_OUTPUT
336343
echo "No files will be committed"
337344
exit 0
338345
fi
339346
340-
if git diff --cached --quiet; then
341-
echo "No changes to commit"
342-
exit 0
343-
else
344-
git commit -m '[auto][on-merge-queue] Update metrics report in README.md'
345-
git push
346-
fi
347-
348-
# Add to known hosts and create id_rsa file
349-
mkdir -p ~/.ssh && touch ~/.ssh/known_hosts
350-
ssh-keyscan ${{ secrets.SFTP_OPTEST_HOST }} >> ~/.ssh/known_hosts
351-
echo ${{ secrets.SFTP_OPTEST_PRIVATE_KEY }} > ~/.ssh/id_rsa
352-
chmod 400 ~/.ssh/id_rsa
347+
- name: Push Metrics Report
348+
uses: peter-evans/create-pull-request@v7
349+
id: push-metrics-report
350+
if: ${{ steps.collect-metrics.outputs.commit-glob != 'nothing' }}
351+
with:
352+
branch: ${{ env.BRANCH_NAME }}
353+
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
354+
author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
355+
base: main
356+
commit-message: "[auto][on-merge-queue] Update metrics report in README.md"
357+
title: "Update PT2.0 Documentation"
358+
body: "This PR updates Documentation by rerunning autogenerated tests"
359+
delete-branch: true
360+
token: ${{ secrets.GH_TOKEN }}
361+
add-paths: ${{ steps.collect-metrics.outputs.commit-glob }}
353362

363+
- name: Send To Data Team
364+
run: |
354365
python3 tools/send_to_data_team.py \
355366
--github_workflow_id ${{ github.run_id }} \
356367
--sftp_host ${{ secrets.SFTP_OPTEST_HOST }} \

0 commit comments

Comments
 (0)