-
Notifications
You must be signed in to change notification settings - Fork 13
107 lines (96 loc) · 3.45 KB
/
build-elxr12-raw.yml
File metadata and controls
107 lines (96 loc) · 3.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Build ELXR12 Raw Image
on:
workflow_dispatch: # Manual runs
inputs:
ref:
description: "Branch or SHA to test (e.g. feature/x or a1b2c3)"
required: false
run_qemu_test:
description: "Run QEMU boot test after build"
required: false
default: "false"
type: choice
options:
- "true"
- "false"
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
jobs:
build-elxr12-raw:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
with:
persist-credentials: false
ref: ${{ github.event.inputs.ref || github.ref }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 #v3.0.0
- name: Install Earthly
uses: earthly/actions-setup@43211c7a0eae5344d6d79fb4aaf209c8f8866203 #v1.0.13
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
version: "latest"
- name: Install system deps
run: |
sudo apt-get update
sudo apt-get install -y qemu-system-x86 ovmf tree jq systemd-ukify mmdebstrap systemd-boot
- name: Set up Go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 #v6.0.0
with:
go-version: stable
- name: Prepare build script
run: |
if [ ! -f scripts/build_elxr12_raw.sh ]; then
echo "scripts/build_elxr12_raw.sh not found!"
exit 1
fi
chmod +x scripts/build_elxr12_raw.sh
- name: Run ELXR12 Raw Image Build
env:
RUN_QEMU_TEST: ${{ github.event.inputs.run_qemu_test }}
run: |
echo "Starting ELXR12 raw image build..."
# Ensure script has access to docker group for Earthly
sudo usermod -aG docker $USER
# Prepare arguments with input validation
ARGS=""
case "${RUN_QEMU_TEST}" in
"true")
ARGS="--qemu-test"
echo "QEMU boot test will be run after build"
;;
"false"|"")
echo "QEMU boot test will be skipped"
;;
*)
echo "Invalid input for run_qemu_test: ${RUN_QEMU_TEST}"
exit 1
;;
esac
# Run the ELXR12 raw image build script
./scripts/build_elxr12_raw.sh $ARGS
echo "ELXR12 raw image build completed."
- name: Notify on failure
if: ${{ failure() && github.event_name == 'pull_request' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REVIEWER_ID: srmungar
run: |
PR_AUTHOR=$(jq --raw-output 'try .pull_request.user.login // empty' "$GITHUB_EVENT_PATH")
if [ -z "$PR_AUTHOR" ]; then
echo "PR_AUTHOR not found in event payload. Skipping notification."
exit 0
fi
COMMENT_BODY="Hey @$PR_AUTHOR and @$REVIEWER_ID — the ELXR12 raw image build has failed. Please check the logs."
curl -s -X POST \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
--data "{\"body\": \"$COMMENT_BODY\"}" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments"