Skip to content

Commit

Permalink
Update workflow (#240)
Browse files Browse the repository at this point in the history
### Ticket
N/A

### Problem description
Update GH workflow and align them with other repos

### What's changed
Update run-name for collect data to show run_id for which data is
collected
Add check all job to simplify required jobs configuration
Switch to fetch-job-id action to simplify getting job_id from GH aPI
Include job-id in report name, this fixes a bug with data collection
from re-runs

### Checklist
- [ x] New/Existing tests provide coverage for changes
  • Loading branch information
vmilosevic authored Feb 6, 2025
1 parent e5f7ece commit e7facac
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
18 changes: 8 additions & 10 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,23 +179,21 @@ jobs:
# Update the CMakeLists.txt file with the new SHA
sed -i "s/set(TT_MLIR_VERSION \".*\")/set(TT_MLIR_VERSION \"${{ inputs.mlir_override }}\")/" third_party/CMakeLists.txt
- name: Fetch job id
id: fetch-job-id
uses: tenstorrent/tt-github-actions/.github/actions/job_id@main
with:
job_name: "${{ github.job }} (${{ matrix.build.runs-on }}, ${{ matrix.build.name }})"

- name: Set reusable strings
id: strings
shell: bash
env:
job-name: "${{ github.job }} (${{ matrix.build.runs-on }}, ${{ matrix.build.name }})"
JOB_ID: ${{ steps.fetch-job-id.outputs.job_id }}
run: |
echo "work-dir=$(pwd)" >> "$GITHUB_OUTPUT"
echo "build-output-dir=$(pwd)/build" >> "$GITHUB_OUTPUT"
echo "install-output-dir=$(pwd)/install" >> "$GITHUB_OUTPUT"
# Github job context unfortunately doesn't contain job_id, this is the workaround how to fetch it using GH API
echo "Expected job name: ${{ env.job-name }}"
JOB_ID=$(curl -s -H "Authorization: token ${{ secrets.GH_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/jobs" | \
jq -r '.jobs[] | select(.name | contains("${{ env.job-name }}")) | .id ')
echo "Current job id: $JOB_ID"
echo "job-id=$JOB_ID" >> "$GITHUB_OUTPUT"
echo "test_report_path=report_$JOB_ID.xml" >> "$GITHUB_OUTPUT"
- name: ccache
Expand Down Expand Up @@ -258,7 +256,7 @@ jobs:
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: test-reports-${{ matrix.build.runs-on }}-${{ matrix.test_group_id }}
name: test-reports-${{ matrix.build.runs-on }}-${{ matrix.test_group_id }}-${{ steps.fetch-job-id.outputs.job_id }}
path: ${{ steps.strings.outputs.test_report_path }}

- name: Show Test Report
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,16 @@ jobs:
with:
mlir_override: ${{ inputs.mlir_override }}
test_mark: 'push'

check-all-green:
if: always()
needs:
- pre-commit
- spdx
- build-and-test
runs-on: Ubuntu-latest
steps:
- name: Check if the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
1 change: 1 addition & 0 deletions .github/workflows/produce_data.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: "[internal] Collect workflow data"
run-name: "Collect data for run_id ${{ github.event.workflow_run.id }} attempt ${{ github.event.workflow_run.run_attempt }}"

on:
workflow_run:
Expand Down

0 comments on commit e7facac

Please sign in to comment.