Also enable build for HP Sim platform and Ski build and test for: #112
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'make-sandwich' | |
on: | |
push: | |
branches: | |
- __mirror | |
schedule: | |
# Run everyday at 3 AM UTC | |
- cron: '0 3 * * *' | |
workflow_dispatch: | |
jobs: | |
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} | |
# 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 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ${{ matrix.branch }}-old-kernel-version | |
github-token: ${{ secrets.PAT }} | |
if-no-files-found: warn | |
retention-days: 5 | |
- 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} | |
OLD_KERNEL_VERSION=$( cat ${GITHUB_WORKSPACE}/${BRANCH}-old-kernel-version ) | |
KERNEL_VERSION=$( git log --oneline | head -n1 | grep -o "Linux\ .*" ) | |
if [[ ${OLD_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 |" >> ${SUMMARY_FILE} | |
echo "| ------ | ------ | ------- | ---- | ------------ | -------- |" >> ${SUMMARY_FILE} | |
if time ./tools/make-kernel.bash ./config/rx2620-rx2660-rx2800-i2-combined-localmodconfig ia64 ${BUILD_DIR}; then | |
echo "| :white_check_mark: | ${BRANCH} | ${KERNEL_VERSION} | regular | ${USED_PATCHES} | ${CROSS_COMPILER_AND_VERSION} |" >> ${SUMMARY_FILE} | |
echo "${KERNEL_VERSION}" > ${GITHUB_WORKSPACE}/${BRANCH}-old-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 | |
with: | |
name: ${{ matrix.branch }}-old-kernel-version | |
path: ${GITHUB_WORKSPACE}/${{ matrix.branch }}-old-kernel-version | |
overwrite: true | |
- 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-ski" | |
# 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 |