-
Notifications
You must be signed in to change notification settings - Fork 0
328 lines (311 loc) · 13.5 KB
/
mirror.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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
name: 'make-sandwich'
on:
push:
branches:
- __mirror
schedule:
# Run everyday at 3 AM UTC
- cron: '0 3 * * *'
workflow_dispatch:
jobs:
mirror_and_check:
runs-on: ubuntu-latest
outputs:
branch_matrix: ${{ steps.check.outputs.branch_matrix }}
steps:
- name: mirror
id: mirror
uses: bridgelightcloud/github-mirror-action@v3
with:
origin: 'https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git'
GITHUB_TOKEN: ${{ secrets.PAT }}
- name: check
id: check
run: |
REPO=$( basename $PWD )
cd ..
mv $REPO ${REPO}.git
git clone --shared ${REPO}.git $REPO
JSON_DATA_FILE="$PWD/workflows.json"
touch ${JSON_DATA_FILE}
cd $REPO
# go through all configured branches and check for RCs ###############
for branch in $( cat config/rc-branches ); do
git worktree add ../${branch} ${branch}
pushd ../${branch}
pwd
if git log --oneline | head -n1 | grep "Linux\ .*" &>/dev/null; then
KERNEL_VERSION=$( git log --oneline | head -n1 | grep -o "Linux\ .*" )
echo "DEBUG build ${KERNEL_VERSION}"
if [[ -s ${JSON_DATA_FILE} ]]; then
echo "DEBUG , \"${branch}\""
echo -n ", \"${branch}\"" >> ${JSON_DATA_FILE}
else
echo "DEBUG [\"${branch}\""
echo -n "[\"${branch}\"" >> ${JSON_DATA_FILE}
fi
fi
popd
pwd
done
if [[ ! -s ${JSON_DATA_FILE} ]]; then
# insert dummy element #############################################
echo -n "[\"NO_BUILD\"" >> ${JSON_DATA_FILE}
fi
echo -n "]" >> ${JSON_DATA_FILE}
pwd
cat -v ${JSON_DATA_FILE} || echo "DEBUG #2"
echo "branch_matrix=$( jq -cn --argjson environments "$( cat ${JSON_DATA_FILE} )" '{branch: $environments}' )" >> $GITHUB_OUTPUT
matrix_build:
needs: mirror_and_check
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{fromJson(needs.mirror_and_check.outputs.branch_matrix)}}
# matrix:
# branch: [linux-4.19.y, linux-5.4.y, linux-5.10.y, linux-5.15.y, linux-6.1.y, linux-6.6.y, linux-6.7.y]
steps:
- name: no_build_step
run: |
if [[ ${{ matrix.branch }} == "NO_BUILD" ]]; then
echo "INFO: No build needed."
exit 1
fi
- uses: actions/checkout@v4
with:
ref: __mirror
path: __mirror
- uses: actions/checkout@v4
with:
ref: ${{ matrix.branch }}
path: ${{ matrix.branch }}
- uses: actions/checkout@v4
with:
repository: johnny-mnemonic/ski
ref: hp-sim-for-linux
path: hp-sim-for-linux
- uses: actions/checkout@v4
with:
repository: johnny-mnemonic/ski
ref: master
path: ski
- name: prepare_step
run: |
BASE_DIR=$( pwd )
BUILD_DIR="$( pwd )/${{ matrix.branch }}"
TOOLS_DIR="$( pwd )/__mirror"
HP_SIM_DIR="$( pwd )/hp-sim-for-linux"
SKI_DIR="$( pwd )/ski"
BRANCH=${{ matrix.branch }}
SUMMARY_FILE=${BASE_DIR}/summary.md
touch ${SUMMARY_FILE}
# get system info ####################################################
echo "****"
uname -a
echo "****"
lscpu
echo "****"
cat /proc/cpuinfo
echo "****"
free -m
echo "****"
lspci
echo "****"
# prepare tools ######################################################
cd ${TOOLS_DIR}
CROSS_COMPILER_URL=$( cat ./config/compiler-url )
wget "${CROSS_COMPILER_URL}" -O - | unxz | tar -xf -
CROSS_COMPILER_PATH=$( echo gcc-*/*-linux )
PATH=$PATH:$PWD/${CROSS_COMPILER_PATH}/bin
CROSS_COMPILER=$( basename ${CROSS_COMPILER_PATH}/bin/*-linux-gcc )
CROSS_COMPILER_AND_VERSION=$( ${CROSS_COMPILER} --version | head -n1 )
# exports ############################################################
echo "BASE_DIR=${BASE_DIR}" >> $GITHUB_ENV
echo "BUILD_DIR=${BUILD_DIR}" >> $GITHUB_ENV
echo "TOOLS_DIR=${TOOLS_DIR}" >> $GITHUB_ENV
echo "HP_SIM_DIR=${HP_SIM_DIR}" >> $GITHUB_ENV
echo "SKI_DIR=${SKI_DIR}" >> $GITHUB_ENV
echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
echo "MODPATH=${PATH}" >> $GITHUB_ENV
echo "CROSS_COMPILER_AND_VERSION=${CROSS_COMPILER_AND_VERSION}" >> $GITHUB_ENV
echo "SUMMARY_FILE=${SUMMARY_FILE}" >> $GITHUB_ENV
echo "EXIT_EARLY=0" >> $GITHUB_ENV
# - name: download_artifact
# continue-on-error: true
# uses: actions/download-artifact@v4
# with:
# name: ${{ matrix.branch }}-last-kernel-version
# github-token: ${{ secrets.PAT }}
- name: regular_build_step
run: |
USED_PATCHES="see [__mirror/patches/${BRANCH}/](https://github.com/johnny-mnemonic/linux-stable-rc/tree/__mirror/patches/${BRANCH}/)"
# apply any standard patches #########################################
PATH=${MODPATH}
cd ${BUILD_DIR}
LAST_KERNEL_VERSION=$( cat ${GITHUB_WORKSPACE}/${BRANCH}-last-kernel-version || true )
KERNEL_VERSION=$( git log --oneline | head -n1 | grep -o "Linux\ .*" )
if [[ ${LAST_KERNEL_VERSION} == "${KERNEL_VERSION}" ]]; then
echo "EXIT_EARLY=1" >> $GITHUB_ENV
exit 0
fi
if [[ -e ${TOOLS_DIR}/patches/${BRANCH}/ ]]; then
for patch in ${TOOLS_DIR}/patches/${BRANCH}/*patch; do
patch -p1 < ${patch} || true
done
else
USED_PATCHES="no extra patches needed"
fi
# build ##############################################################
cd "${TOOLS_DIR}"
echo "| STATUS | BRANCH | VERSION | TYPE | USED PATCHES | COMPILER | DOWNLOAD |" >> ${SUMMARY_FILE}
echo "| ------ | ------ | ------- | ---- | ------------ | -------- | -------- |" >> ${SUMMARY_FILE}
if [[ ${{ matrix.branch }} == "linux-4.19.y" || ${{ matrix.branch }} == "linux-5.4.y" ]]; then
# 4.19 and 5.4 don't support dir-pkg!
BUILD_COMMAND="time ./tools/make-kernel.bash ./config/linux-for-hp-integrities-v3 ia64 ${BUILD_DIR} gha"
else
BUILD_COMMAND="time ./tools/make-kernel.bash ./config/linux-for-hp-integrities-v3 ia64 ${BUILD_DIR} gha tarball"
fi
if ${BUILD_COMMAND}; then
if [[ ${{ matrix.branch }} != "linux-4.19.y" && ${{ matrix.branch }} != "linux-5.4.y" ]]; then
mkdir build-artifacts && mv $( cat ${BUILD_DIR}/LINUX_BUILD_LOG ) $( cat ${BUILD_DIR}/LINUX_TARBALL ) build-artifacts/
pushd build-artifacts/
sha256sum * > SHA256
popd
fi
# Still make the exports, so the the upload-artifact action succeeds
# exports ##########################################################
echo "BUILD_ARTIFACTS=${PWD}/build-artifacts" >> $GITHUB_ENV
echo "KERNEL_VERSION=${KERNEL_VERSION}" >> $GITHUB_ENV
####################################################################
echo "| :white_check_mark: | ${BRANCH} | ${KERNEL_VERSION} | regular | ${USED_PATCHES} | ${CROSS_COMPILER_AND_VERSION} |" >> ${SUMMARY_FILE}
echo "${KERNEL_VERSION}" > ${GITHUB_WORKSPACE}/${BRANCH}-last-kernel-version
true
else
echo "| :x: | ${BRANCH} | ${KERNEL_VERSION} | regular | ${USED_PATCHES} |${CROSS_COMPILER_AND_VERSION} |" >> ${SUMMARY_FILE}
true
fi
- uses: actions/upload-artifact@v4
id: artifact-upload-step
with:
name: ${{ env.KERNEL_VERSION }}
path: ${{ env.BUILD_ARTIFACTS }}/
compression-level: 0
retention-days: 2
- name: Output artifact ID
run: |
if [[ ${{ matrix.branch }} != "linux-4.19.y" && ${{ matrix.branch }} != "linux-5.4.y" ]]; then
echo '|||||| [build artifacts](${{ steps.artifact-upload-step.outputs.artifact-url }}) |' >> ${SUMMARY_FILE}
else
true
fi
# - uses: actions/upload-artifact@v4
# with:
# name: ${{ matrix.branch }}-last-kernel-version
# path: ${{ github.workspace }}/${{ matrix.branch }}-last-kernel-version
# overwrite: true
# retention-days: 10
- name: hp_sim_build_step
run: |
if [[ ${EXIT_EARLY} -eq 1 ]]; then
exit 0
fi
USED_PATCHES="see [hp-sim-for-linux/${BRANCH}/](https://github.com/johnny-mnemonic/ski/tree/hp-sim-for-linux/${BRANCH}/)"
# apply ski patches ##################################################
PATH=${MODPATH}
cd ${BUILD_DIR}
KERNEL_VERSION=$( git log --oneline | head -n1 | grep -o "Linux\ .*" )
make mrproper
if [[ -e ${HP_SIM_DIR}/${BRANCH}/ ]]; then
for patch in ${HP_SIM_DIR}/${BRANCH}/*patch; do
patch -p1 < ${patch} || true
done
else
USED_PATCHES="no extra patches needed"
fi
# build hp sim kernel ################################################
cd "${TOOLS_DIR}"
if time ./tools/make-kernel.bash ${BUILD_DIR}/arch/ia64/configs/sim_defconfig ia64 ${BUILD_DIR} ski; then
echo "| :white_check_mark: | ${BRANCH} | ${KERNEL_VERSION} | hp_sim | ${USED_PATCHES} | ${CROSS_COMPILER_AND_VERSION} |" >> ${SUMMARY_FILE}
true
else
echo "| :x: | ${BRANCH} | ${KERNEL_VERSION} | hp_sim | ${USED_PATCHES} | ${CROSS_COMPILER_AND_VERSION} |" >> ${SUMMARY_FILE}
echo "EXIT_EARLY=1" >> $GITHUB_ENV
true
fi
HP_SIM_KERNEL="${BUILD_DIR}/vmlinux"
# exports ############################################################
echo "HP_SIM_KERNEL=${HP_SIM_KERNEL}" >> $GITHUB_ENV
- name: ski_build_step
run: |
if [[ ${EXIT_EARLY} -eq 1 ]]; then
exit 0
fi
# install build dependencies #########################################
sudo apt update
sudo apt -y install binutils-dev libelf-dev libiberty-dev libncurses-dev autoconf autoconf-archive automake flex bison gperf pkg-config
# build Ski ##########################################################
COMPILER_AND_VERSION=$( gcc --version | head -n1 )
cd ${SKI_DIR}
echo "" >> ${SUMMARY_FILE}
echo "| STATUS | TOOL | COMPILER |" >> ${SUMMARY_FILE}
echo "| ------ | ---- | -------- |" >> ${SUMMARY_FILE}
if \
./autogen.sh && \
./configure --prefix=${SKI_DIR}/install && \
make -j$( nproc ) && \
make -j$( nproc ) install; then
echo "| :white_check_mark: | ski | ${COMPILER_AND_VERSION} |" >> ${SUMMARY_FILE}
true
else
echo "| :x: | ski | ${COMPILER_AND_VERSION} |" >> ${SUMMARY_FILE}
echo "EXIT_EARLY=1" >> $GITHUB_ENV
true
fi
SKI_PATH="${SKI_DIR}/install/bin"
# cross-build ski-bootloader #########################################
PATH=${MODPATH}
cd ${SKI_DIR}/ski-bootloader
if make CROSS_COMPILE=ia64-linux-; then
echo "| :white_check_mark: | ski-bootloader | ${CROSS_COMPILER_AND_VERSION} |" >> ${SUMMARY_FILE}
true
else
echo "| :x: | ski-bootloader | ${CROSS_COMPILER_AND_VERSION} |" >> ${SUMMARY_FILE}
echo "EXIT_EARLY=1" >> $GITHUB_ENV
true
fi
SKI_BOOTLOADER="${SKI_DIR}/ski-bootloader/ski-bootloader"
# exports ############################################################
echo "SKI_PATH=${SKI_PATH}" >> $GITHUB_ENV
echo "SKI_BOOTLOADER=${SKI_BOOTLOADER}" >> $GITHUB_ENV
- name: ski_test_step
run: |
if [[ ${EXIT_EARLY} -eq 1 ]]; then
exit 0
fi
# get ia64 root FS ###################################################
PATH=$PATH:${SKI_PATH}
SKI_TEST_DIR="${BASE_DIR}/ski-test"
mkdir ${SKI_TEST_DIR} && cd ${SKI_TEST_DIR}
cp ${TOOLS_DIR}/tools/run-ski-test.bash ${TOOLS_DIR}/config/sdc-debian.xz.SHA256 .
chmod +x run-ski-test.bash
IA64_ROOTFS_URL=$( cat ${TOOLS_DIR}/config/ia64-rootfs-url )
wget "${IA64_ROOTFS_URL}"
if sha256sum -c sdc-debian.xz.SHA256; then
rm sdc-debian.xz.SHA256
xz --decompress --verbose sdc-debian.xz && mv sdc-debian sdc
echo "" >> ${SUMMARY_FILE}
echo "| STATUS | TOOL |" >> ${SUMMARY_FILE}
echo "| ------ | ---- |" >> ${SUMMARY_FILE}
if ./run-ski-test.bash ${SKI_BOOTLOADER} ${HP_SIM_KERNEL}; then
echo "| :white_check_mark: | run-ski-test.bash |" >> ${SUMMARY_FILE}
true
else
echo "| :x: | run-ski-test.bash |" >> ${SUMMARY_FILE}
true
fi
else
echo "ERROR: Wrong SHA256 hash for ia64 root FS. Refuse to continue." >> ${SUMMARY_FILE}
fi
- name: steps_summary
run: |
cat ${SUMMARY_FILE} >> $GITHUB_STEP_SUMMARY