Skip to content

make-sandwich

make-sandwich #78

Workflow file for this run

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
echo "DEBUG $( pwd ) - before for"
for branch in $( cat config/rc-branches ); do
git worktree add ../${branch} ${branch}
pushd ../${branch}
pwd
if git log --oneline | head -n1 | grep "Linux\ .*\-rc.*" &>/dev/null; then
KERNEL_VERSION=$( git log --oneline | head -n1 | grep -o "Linux\ .*\-rc.*" )
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
cat ${JSON_DATA_FILE} || echo "DEBUG #1"
popd
pwd
done
echo -n "]" >> ${JSON_DATA_FILE}
pwd
echo "DEBUG $( pwd ) - after for"
ls -1
ls -1 ../
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)}}
steps:
- uses: actions/checkout@v3
with:
ref: __mirror
path: __mirror
- uses: actions/checkout@v3
with:
ref: ${{ matrix.branch }}
path: ${{ matrix.branch }}
- name: prepare_and_build_step
run: |
pwd
BUILD_DIR="$( pwd )/${{ matrix.branch }}"
TOOLS_DIR="$( pwd )/__mirror"
BRANCH=${{ matrix.branch }}
echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
# prepare tools ######################################################
cd ${TOOLS_DIR}
COMPILER_URL=$( cat ./config/compiler-url )
wget "${COMPILER_URL}" -O - | unxz | tar -xf -
COMPILER_PATH=$( echo gcc-*/*-linux )
PATH=$PATH:$PWD/${COMPILER_PATH}/bin
COMPILER=$( basename ${COMPILER_PATH}/bin/*-linux-gcc )
COMPILER_AND_VERSION=$( ${COMPILER} --version | head -n1 )
# apply any standard patches #########################################
cd ${BUILD_DIR}
KERNEL_VERSION=$( git log --oneline | head -n1 | grep -o "Linux\ .*\-rc.*" )
if [[ -e ${TOOLS_DIR}/patches/${{ matrix.branch }}/ ]]; then
for patch in ${TOOLS_DIR}/patches/${{ matrix.branch }}/*patch; do
patch -p1 < ${patch} || true
done
fi
# build ##############################################################
cd "${TOOLS_DIR}"
echo "| STATUS | BRANCH | VERSION | COMPILER |" >> $GITHUB_STEP_SUMMARY
echo "| ------ | ------ | ------- | -------- |" >> $GITHUB_STEP_SUMMARY
if time ./tools/make-kernel.bash ./config/rx2620-rx2660-rx2800-i2-combined-localmodconfig ia64 ${BUILD_DIR}; then
echo "| :white_check_mark: | $BRANCH | $KERNEL_VERSION | $COMPILER_AND_VERSION |" >> $GITHUB_STEP_SUMMARY
true
else
echo "| :x: | $BRANCH | $KERNEL_VERSION | $COMPILER_AND_VERSION |" >> $GITHUB_STEP_SUMMARY
true
fi
- name: future_build_step
run: |
echo "future build ##################################################"
echo "Where am I? $( pwd )"
echo "BRANCH=${BRANCH}"