diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index b55fd101e7..15fa857c39 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -114,23 +114,21 @@ jobs: with: fetch-depth: 0 + - name: Fetch job id + id: fetch-job-id + uses: tenstorrent/tt-github-actions/.github/actions/job_id@main + with: + job_name: "Build and test tt-mlir (compute machine) (${{ matrix.build.runs-on }}, ${{ matrix.build.enable_perf }}, ${{ matrix.build.enable_op_model }}, ${{ matrix.build.enable_emitc }}, ${{ matrix.build.name }})" + - name: Set reusable strings id: strings shell: bash env: - job-name: "Build tt-mlir (${{ matrix.build.runs-on }}, ${{ matrix.build.enable_perf }}, ${{ matrix.build.enable_op_model }}, ${{ matrix.build.enable_emitc }}, ${{ 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: Git safe dir @@ -193,24 +191,21 @@ jobs: with: fetch-depth: 0 + - name: Fetch job id + id: fetch-job-id + uses: tenstorrent/tt-github-actions/.github/actions/job_id@main + with: + job_name: "run-tests (${{ matrix.build.runs-on }}, ${{ matrix.build.enable_perf }}, ${{ matrix.build.enable_emitc }}, ${{ matrix.build.build_name }})" + - name: Set reusable strings id: strings shell: bash env: - job-name: "run-tests (${{ matrix.build.runs-on }}, ${{ matrix.build.enable_perf }}, ${{ matrix.build.enable_emitc }}, ${{ matrix.build.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: Git safe dir @@ -347,23 +342,21 @@ jobs: with: fetch-depth: 0 + - 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.enable_perf }}, ${{ matrix.build.name }}, ${{ matrix.build.build_name }})" + - name: Set reusable strings id: strings shell: bash env: - job-name: "${{ github.job }} (${{ matrix.build.runs-on }}, ${{ matrix.build.enable_perf }}, ${{ matrix.build.enable_emitc }}, ${{ matrix.build.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: Git safe dir @@ -638,23 +631,21 @@ jobs: with: fetch-depth: 0 + - name: Fetch job id + id: fetch-job-id + uses: tenstorrent/tt-github-actions/.github/actions/job_id@main + with: + job_name: "Run build and test tt-mlir (TT machine) (${{ matrix.build.runs-on }}, ${{ matrix.build.enable_perf }}, ${{ matrix.build.enable_op_model }}, ${{ matrix.build.enable_emitc }}, ${{ matrix.build.name }}, ${{ matrix.build.build_name }})" + - name: Set reusable strings id: strings shell: bash env: - job-name: "Build tt-mlir (${{ matrix.build.runs-on }}, ${{ matrix.build.enable_perf }}, ${{ matrix.build.enable_op_model }}, ${{ matrix.build.enable_emitc }}, ${{ matrix.build.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: Git safe dir diff --git a/.github/workflows/on-pr.yml b/.github/workflows/on-pr.yml index 0d43a97db2..6df5dd4a02 100644 --- a/.github/workflows/on-pr.yml +++ b/.github/workflows/on-pr.yml @@ -42,3 +42,16 @@ jobs: gh run list --workflow=${{ env.WORKFLOW_NAME }} --repo ${{ env.TARGET_REPO }} --limit 1 echo "Triggered ${{ env.TARGET_REPO }} with tt-mlir ${{ github.event.pull_request.head.sha }}" echo "### Triggered [${{ env.TARGET_REPO }}](https://github.com/${{ env.TARGET_REPO }}/actions/workflows/${{ env.WORKFLOW_NAME }}) with tt-mlir ${{ github.event.pull_request.head.sha }} :rocket:" >> $GITHUB_STEP_SUMMARY + + 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) }}