Skip to content

Commit

Permalink
[wip] download GHA logs
Browse files Browse the repository at this point in the history
  • Loading branch information
makslevental committed Aug 23, 2024
1 parent 95b6988 commit e7f0554
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 }}
22 changes: 22 additions & 0 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
Expand Down Expand Up @@ -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 }}
65 changes: 65 additions & 0 deletions .github/workflows/download-check-logs.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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

0 comments on commit e7f0554

Please sign in to comment.