-
Notifications
You must be signed in to change notification settings - Fork 24
169 lines (148 loc) · 5.3 KB
/
build-yocto.yml
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: Build Yocto
on:
workflow_call:
pull_request:
push:
branches:
- main
env:
CACHE_DIR: /srv/gh-runners/quic-yocto
KAS_REPO_REF_DIR: /srv/gh-runners/quic-yocto/kas-mirrors
jobs:
kas-lock:
if: github.repository == 'qualcomm-linux/meta-qcom-hwe'
runs-on: [self-hosted, x86]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run kas lock
run: |
kas dump --update --lock --inplace ci/base.yml
- uses: actions/upload-artifact@v4
with:
name: kas-lock
path: ci/*.lock.yml
yocto-check-layer:
needs: kas-lock
if: github.repository == 'qualcomm-linux/meta-qcom-hwe'
runs-on: [self-hosted, x86]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: kas-lock
path: ci/
- name: Run yocto-check-layer
run: |
ci/yocto-check-layer.sh
yocto-patchreview:
needs: kas-lock
if: github.repository == 'qualcomm-linux/meta-qcom-hwe'
runs-on: [self-hosted, x86]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: kas-lock
path: ci/
- name: Run Yocto patchreview
run: |
ci/yocto-patchreview.sh
compile:
needs: kas-lock
if: github.repository == 'qualcomm-linux/meta-qcom-hwe'
strategy:
fail-fast: true
matrix:
machine:
- qcm6490-idp
- qcs6490-rb3gen2-core-kit
- sa8775p-ride-sx
runs-on: [self-hosted, x86]
name: ${{ matrix.machine }}/poky/systemd
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: kas-lock
path: ci/
- name: Kas build
run: |
export DL_DIR=${CACHE_DIR}/downloads
export SSTATE_DIR=${CACHE_DIR}/sstate-cache
export KAS_WORK_DIR=$PWD/../kas
mkdir $KAS_WORK_DIR
kas build ci/mirror.yml:ci/${{ matrix.machine }}.yml
- name: Publish image
run: |
build_dir=${CACHE_DIR}/builds/${GITHUB_RUN_ID}
mkdir -p $build_dir
img_dir=$build_dir/${{ matrix.machine }}
[ -d $img_dir ] && rm -rf $img_dir
mv ../kas/build/tmp/deploy/images/${{matrix.machine}} $img_dir
# Instruct our file server to make these files available for download
url="https://quic-yocto-fileserver-1029608027416.us-central1.run.app/${GITHUB_RUN_ID}/${{ matrix.machine }}/"
retries=4
okay=0
shopt -s lastpipe # allows us to capture the value of `okay` in the while loop below
for ((i=0; i<retries; i++)); do
curl -X POST -H "Accept: text/event-stream" -i --fail-with-body -s -N ${url} | \
while read line; do
echo $line
if [[ $line == STATUS=* ]]; then
if [[ $line == "STATUS=OK" ]]; then
okay=1
break
fi
fi
done
[ $okay -eq 1 ] && break
echo # new line break in case response doesn't have one
echo "Error: unable to publish artifacts, sleep and retry"
sleep 2
done
(( retries == i )) && { echo 'Failed to publish artifacts'; exit 1; }
echo # new line break in case response doesn't have one
echo Image available at: ${url}
boot-test:
needs: compile
if: github.repository == 'qualcomm-linux/meta-qcom-hwe' && contains(fromJSON('["push", "schedule"]'), github.event_name)
strategy:
fail-fast: true
matrix:
machine:
- qcs6490-rb3gen2-core-kit
runs-on: [self-hosted, x86]
name: ${{ matrix.machine }}/lava
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create test job definition
id: create_definition
run: |
export DEVICE_TYPE=${{ matrix.machine }}
export BUILD_FILE_NAME="core-image-base-${DEVICE_TYPE}.rootfs.qcomflash.tar.gz"
export BUILD_DOWNLOAD_URL="https://quic-yocto-fileserver-1029608027416.us-central1.run.app/${GITHUB_RUN_ID}/${{ matrix.machine }}/${BUILD_FILE_NAME}"
export JOB_FILE_NAME="${{ matrix.machine }}-${GITHUB_RUN_ID}.yml"
sed "s|{{GITHUB_RUN_ID}}|${GITHUB_RUN_ID}|g" ci/lava/${{ matrix.machine }}.yml > "${JOB_FILE_NAME}"
sed -i "s|{{GITHUB_SHA}}|${GITHUB_SHA}|g" "${JOB_FILE_NAME}"
sed -i "s|{{DEVICE_TYPE}}|${DEVICE_TYPE}|g" "${JOB_FILE_NAME}"
sed -i "s|{{BUILD_DOWNLOAD_URL}}|${BUILD_DOWNLOAD_URL}|g" "${JOB_FILE_NAME}"
sed -i "s|{{BUILD_FILE_NAME}}|${BUILD_FILE_NAME}|g" "${JOB_FILE_NAME}"
cat "${JOB_FILE_NAME}"
echo "job_file_name=${JOB_FILE_NAME}" >> "${GITHUB_OUTPUT}"
- uses: foundriesio/lava-action@v2
with:
lava_token: ${{ secrets.LAVATOKEN }}
lava_url: 'lava.infra.foundries.io'
job_definition: ${{ steps.create_definition.outputs.job_file_name }}
wait_for_job: 'true'
fail_action_on_failure: 'true'