diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index 93774a9dcd..7c11be5b5b 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -24,6 +24,8 @@ jobs: fail-fast: true env: CACHE_DIR: ${{ github.workspace }}/.container-cache + outputs: + job-id: ${{ steps.get-job-id.outputs.job_id }} steps: - name: Set unified TZ uses: szenius/set-timezone@v2.0 @@ -89,6 +91,17 @@ jobs: path: ${{ env.CACHE_DIR }} key: linux-build-test-cpp-asserts-manylinux-v2-${{ github.sha }} + - name: Get Job ID from GH API + id: get-job-id + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + curl -sS https://webi.sh/gh | sh + source ~/.config/envman/PATH.env + jobs=$(gh api "repos/${{ github.repository }}/actions/runs/${{ github.run_id}}/attempts/${{ github.run_attempt }}/jobs") + job_id=$(echo $jobs | jq -r '.jobs[] | select(.runner_name=="${{ runner.name }}") | .id') + echo "job_id=$job_id" >> $GITHUB_OUTPUT + test_linux: name: E2E Test linux runs-on: amd7940hs @@ -97,6 +110,8 @@ jobs: fail-fast: true env: XILINXD_LICENSE_FILE: /home/svcnod/Xilinx.lic + outputs: + job-id: ${{ steps.get-job-id.outputs.job_id }} steps: - name: "Checking out repository" # for test scripts uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 @@ -208,3 +223,34 @@ jobs: $PWD/llvm-aie \ /opt/xilinx/xrt \ /opt/Xilinx/Vitis/2024.2 + + - name: Get Job ID from GH API + id: get-job-id + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + curl -sS https://webi.sh/gh | sh + source ~/.config/envman/PATH.env + jobs=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id}}/attempts/${{ github.run_attempt }}/jobs) + job_id=$(echo $jobs | jq -r '.jobs[] | select(.runner_name=="${{ runner.name }}") | .id') + echo "job_id=$job_id" >> $GITHUB_OUTPUT + + call-download-check-logs-build-and-test: + needs: [build_and_ctest] + # don't forget to change the branch you're updating the action + uses: nod-ai/iree-amd-aie/.github/workflows/download-check-logs.yml@makslevental/download-show-logs + secrets: inherit # pass all secrets + with: + workflow: ${{ github.workflow }} + run-id: ${{ github.run_id }} + job-id: ${{ needs.build_and_ctest.outputs.job-id }} + + call-download-check-logs-test-linux: + needs: [test_linux] + # don't forget to change the branch you're updating the action + uses: nod-ai/iree-amd-aie/.github/workflows/download-check-logs.yml@makslevental/download-show-logs + secrets: inherit # pass all secrets + with: + workflow: ${{ github.workflow }} + run-id: ${{ github.run_id }} + job-id: ${{ needs.test_linux.outputs.job-id }} diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml index bf2ff55dab..01f4898a61 100644 --- a/.github/workflows/ci-windows.yml +++ b/.github/workflows/ci-windows.yml @@ -34,6 +34,8 @@ jobs: fail-fast: true env: CACHE_DIR: ${{ github.workspace }}/.container-cache + outputs: + job-id: ${{ steps.get-job-id.outputs.job_id }} steps: - name: Set unified TZ uses: szenius/set-timezone@v2.0 @@ -104,3 +106,23 @@ jobs: with: path: ${{ env.CACHE_DIR }} key: windows-build-test-cpp-asserts-v1-${{ github.sha }}-${{ github.event.repository.updated_at }} + + - name: Get Job ID from GH API + id: get-job-id + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + choco install gh + jobs=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id}}/attempts/${{ github.run_attempt }}/jobs) + job_id=$(echo $jobs | jq -r '.jobs[] | select(.runner_name=="${{ runner.name }}") | .id') + echo "job_id=$job_id" >> $GITHUB_OUTPUT + + call-download-check-logs-build-and-test: + needs: [build_and_ctest] + # don't forget to change the branch you're updating the action + uses: nod-ai/iree-amd-aie/.github/workflows/download-check-logs.yml@makslevental/download-show-logs + secrets: inherit # pass all secrets + with: + workflow: ${{ github.workflow }} + run-id: ${{ github.run_id }} + job-id: ${{ needs.build_and_ctest.outputs.job-id }} diff --git a/.github/workflows/download-check-logs.yml b/.github/workflows/download-check-logs.yml new file mode 100644 index 0000000000..cc481e4ae5 --- /dev/null +++ b/.github/workflows/download-check-logs.yml @@ -0,0 +1,65 @@ +name: Download/check GHA logs + +on: + workflow_dispatch: + inputs: + workflow: + description: 'workflow (name)' + type: string + required: false + default: 'workflow' + run-id: + description: 'run-id of GHA job' + type: string + required: true + job-id: + description: 'run-id of GHA job' + type: string + required: false + default: '' + workflow_call: + inputs: + workflow: + description: 'workflow (name)' + type: string + required: false + default: 'workflow' + run-id: + description: 'run-id of GHA job' + type: string + required: true + job-id: + description: 'run-id of GHA job' + type: string + required: false + default: '' + +jobs: + do: + name: "${{ inputs.workflow }}/${{ inputs.run-id}} log" + runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ github.token }} + steps: + - name: Checking out repository + uses: actions/checkout@v4.1.7 + with: + submodules: false + sparse-checkout: build_tools/ci/download_github_logs.sh + sparse-checkout-cone-mode: false + + - name: Download logs + run: | + if [ x"${{ inputs.run-id }}" == x"" ]; then + gh run view ${{ inputs.run-id }} --log > log.txt + else + gh run view ${{ inputs.run-id }} -j ${{ inputs.job-id }} --log > log.txt + fi + + - name: Check logs for 'fail' + run: | + grep —ignore-case fail log.txt + + - name: Check logs for 'error' + run: | + grep —ignore-case error log.txt