Skip to content

Commit 7eb26fe

Browse files
anshulg-qtiquic-viskuma
authored andcommitted
Merge pull request #48 from quic-viskuma/main
ci: Add check run event to trigger Axiom job
2 parents 5a18fd0 + faab14a commit 7eb26fe

5 files changed

Lines changed: 115 additions & 6 deletions

File tree

.github/actions/aws_s3_helper/action.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,15 @@ inputs:
2424
upload_location:
2525
description: Upload location
2626
required: false
27-
default: ${{ github.repository_owner }}/${{ github.event.repository.name }}/${{ github.run_id }}-${{ github.run_attempt }}/
27+
default: ${{ github.repository_owner }}/${{ github.event.repository.name }}/${{ github.run_id }}-${{ github.run_attempt }}
2828

2929
outputs:
3030
presigned_url:
3131
description: Pre-signed URL for the uploaded file
3232
value: ${{ steps.sync-data.outputs.presigned_url }}
33+
s3_location:
34+
description: Upload location
35+
value: ${{ inputs.upload_location }}
3336

3437
runs:
3538
using: "composite"
@@ -50,11 +53,11 @@ runs:
5053
while IFS= read -r file; do
5154
if [ -f "$file" ]; then
5255
echo "Uploading $file..."
53-
aws s3 cp "$file" s3://${{ inputs.s3_bucket }}/${{ env.UPLOAD_LOCATION }}
56+
aws s3 cp "$file" s3://${{ inputs.s3_bucket }}/${{ env.UPLOAD_LOCATION }}/
5457
echo "Uploaded $file to s3://${{ inputs.s3_bucket }}/${{ env.UPLOAD_LOCATION }}"
5558
echo "Creating Pre-signed URL for $file..."
5659
filename=$(basename "$file")
57-
presigned_url=$(aws s3 presign s3://${{ inputs.s3_bucket }}/${{ env.UPLOAD_LOCATION }}$filename --expires-in 259200)
60+
presigned_url=$(aws s3 presign s3://${{ inputs.s3_bucket }}/${{ env.UPLOAD_LOCATION }}/$filename --expires-in 259200)
5861
if [ "$first_line" = true ]; then
5962
first_line=false
6063
else
@@ -72,10 +75,10 @@ runs:
7275
;;
7376
single-upload)
7477
echo "Uploading single file to S3 bucket..."
75-
aws s3 cp "${{ inputs.local_file }}" s3://${{ inputs.s3_bucket }}/${{ env.UPLOAD_LOCATION }}
78+
aws s3 cp "${{ inputs.local_file }}" s3://${{ inputs.s3_bucket }}/${{ env.UPLOAD_LOCATION }}/
7679
echo "Uploaded ${{ inputs.local_file }} to s3://${{ inputs.s3_bucket }}/${{ env.UPLOAD_LOCATION }}"
7780
echo "Creating Pre-signed URL for ${{ inputs.local_file }}..."
78-
presigned_url=$(aws s3 presign s3://${{ inputs.s3_bucket }}/${{ env.UPLOAD_LOCATION }}${{ inputs.local_file }} --expires-in 259200)
81+
presigned_url=$(aws s3 presign s3://${{ inputs.s3_bucket }}/${{ env.UPLOAD_LOCATION }}/${{ inputs.local_file }} --expires-in 259200)
7982
echo "presigned_url=${presigned_url}" >> "$GITHUB_OUTPUT"
8083
;;
8184
download)
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Post Check Run
2+
3+
description: Posts a GitHub Check Run after uploading artifacts to S3
4+
5+
inputs:
6+
sha:
7+
description: SHA of the commit to check
8+
required: true
9+
repo:
10+
description: GitHub repository (owner/repo)
11+
required: true
12+
s3_location:
13+
description: S3 location for the artifacts
14+
required: true
15+
APPID:
16+
description: GitHub App ID
17+
required: true
18+
PVK:
19+
description: GitHub App private key
20+
required: true
21+
22+
runs:
23+
using: "composite"
24+
steps:
25+
- name: Generate access token
26+
uses: actions/create-github-app-token@v2
27+
id: app-token
28+
with:
29+
app-id: ${{ inputs.APPID }}
30+
private-key: ${{ inputs.PVK }}
31+
owner: ${{ github.repository_owner }}
32+
33+
- name: Post check run
34+
shell: bash
35+
run: |
36+
set -e
37+
38+
HEAD_SHA="${{ inputs.sha }}"
39+
ACCESS_TOKEN="${{ steps.app-token.outputs.token }}"
40+
s3_location="${{ inputs.s3_location }}"
41+
REPO="${{ inputs.repo }}"
42+
43+
echo "Creating check run for commit: $HEAD_SHA"
44+
CHECK_RUN_ID=$(curl -s -L -X POST \
45+
-H "Accept: application/vnd.github+json" \
46+
-H "Authorization: Bearer $ACCESS_TOKEN" \
47+
-H "X-GitHub-Api-Version: 2022-11-28" \
48+
https://api.github.com/repos/$REPO/check-runs \
49+
-d '{
50+
"name": "Artifacts uploaded to S3",
51+
"head_sha": "'"$HEAD_SHA"'",
52+
"status": "in_progress",
53+
"output": {
54+
"title": "Check S3 Location",
55+
"summary": "",
56+
"text": "'"$s3_location"'"
57+
}
58+
}' | jq -r '.id')
59+
60+
if [ -z "$CHECK_RUN_ID" ]; then
61+
echo "Failed to create check run. Exiting."
62+
exit 1
63+
fi
64+
65+
echo "Check run created with ID: $CHECK_RUN_ID"
66+
67+
echo "Updating check run to completed status..."
68+
curl -s -L -X PATCH \
69+
-H "Accept: application/vnd.github+json" \
70+
-H "Authorization: Bearer $ACCESS_TOKEN" \
71+
-H "X-GitHub-Api-Version: 2022-11-28" \
72+
https://api.github.com/repos/$REPO/check-runs/$CHECK_RUN_ID \
73+
-d '{
74+
"name": "Artifacts uploaded to S3",
75+
"head_sha": "'"$HEAD_SHA"'",
76+
"status": "completed",
77+
"conclusion": "success",
78+
"output": {
79+
"title": "Check S3 Location",
80+
"summary": "",
81+
"text": "'"$s3_location"'"
82+
}
83+
}'
84+
85+
echo "Check run updated successfully."

.github/actions/sync/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ runs:
3030
with:
3131
fetch-depth: 0
3232
repository: qualcomm-linux/kernel
33+
ref: ${{ inputs.base_branch }}
3334

3435
- name: Configure git
3536
shell: bash

.github/workflows/build.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,18 @@ on:
2222
description: Boot bins for Flat META
2323
type: string
2424
required: true
25+
outputs:
26+
s3_location:
27+
description: "S3 location of uploaded artifacts"
28+
value: ${{ jobs.build.outputs.s3_location }}
2529

2630
jobs:
2731
build:
2832
runs-on:
2933
group: GHA-Kernel-SelfHosted-RG
3034
labels: [ self-hosted, kernel-prd-u2404-x64-large-od-ephem ]
35+
outputs:
36+
s3_location: ${{ steps.upload-artifacts.outputs.s3_location }}
3137
steps:
3238
- name: Checkout code
3339
uses: actions/checkout@v4
@@ -89,6 +95,7 @@ jobs:
8995
done
9096
9197
- name: Upload artifacts
98+
id: upload-artifacts
9299
uses: qualcomm-linux/kernel-config/.github/actions/aws_s3_helper@main
93100
with:
94101
s3_bucket: qli-prd-kernel-gh-artifacts

.github/workflows/pre_merge.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,20 @@ jobs:
4747
pr_number: ${{ inputs.pr }}
4848
branch: ${{ inputs.ref }}
4949
bootbins: ${{ needs.loading.outputs.bootbins }}
50-
50+
51+
check_run:
52+
runs-on: ubuntu-latest
53+
needs: [init-status, loading, build]
54+
steps:
55+
- name: Post check run
56+
uses: qualcomm-linux/kernel-config/.github/actions/check_run@main
57+
with:
58+
sha: ${{ inputs.sha }}
59+
repo: ${{ inputs.repo }}
60+
s3_location: ${{ needs.build.outputs.s3_location }}
61+
APPID: ${{ secrets.APPID }}
62+
PVK: ${{ secrets.PVK }}
63+
5164
test:
5265
needs: [init-status, loading, build]
5366
uses: qualcomm-linux/kernel-config/.github/workflows/test.yml@main

0 commit comments

Comments
 (0)