Kernel LTS CI #87
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: Kernel LTS CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
# manual trigger | |
schedule: | |
- cron: '0 0 1 * *' | |
env: | |
MIMALLOC_ALLOW_LARGE_OS_PAGES: 1 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: cachyos/cachyos-v3:latest | |
outputs: | |
current_version: ${{ steps.out.outputs.current_version }} | |
release_version: ${{ steps.out.outputs.release_version }} | |
clang_version: ${{ steps.out.outputs.clang_version }} | |
rebuild_flag: ${{ steps.out.outputs.rebuild_flag }} | |
strategy: | |
matrix: | |
include: | |
- arch: GENERIC_MZEN | |
image-name: bzImage-zen | |
- arch: GENERIC_MZEN2 | |
image-name: bzImage-zen2 | |
- arch: GENERIC_MZEN3 | |
image-name: bzImage-zen3 | |
- arch: GENERIC_MZEN4 | |
image-name: bzImage-zen4 | |
steps: | |
- uses: actions/checkout@main | |
- name: Install dependencies | |
id: dep | |
run: | | |
pacman -Syu --noconfirm pahole xmlto inetutils bc cpio jq ccache git python go mimalloc | |
GOBIN=/usr/bin go install go.chromium.org/luci/cipd/client/cmd/...@latest | |
cipd install fuchsia/third_party/clang/linux-amd64 latest -root /usr/local/fuchsia-clang | |
echo "PATH=/usr/local/fuchsia-clang/bin:$PATH" >> $GITHUB_ENV | |
echo "/usr/lib/libmimalloc.so" > /etc/ld.so.preload | |
- name: Trust this directory | |
run: git config --global --add safe.directory '*' # v2.35.3 or later | |
- name: Setup kernel source | |
shell: bash | |
run: | | |
./setup.sh --arch ${{ matrix.arch }} --branch LTS | |
cd linux | |
# Load version info into env | |
echo "CLANG_VERSION=$(clang --version | head -n1)" | tee -a $GITHUB_ENV | |
export CURRENT_VERSION=$(make kernelrelease) | |
# must query with a token, or will fail with api rate limit on public runners | |
export RELEASED_TAG=$(curl -sL -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}'\ | |
https://api.github.com/repos/Locietta/xanmod-kernel-WSL2/tags\?per_page\=60 | jq -r '.[].name' | grep 'lts' | head -n 1) | |
export RELEASED_VERSION=$(echo $RELEASED_TAG | sed "s#\(.*-locietta-WSL2-xanmod[0-9][0-9]*\).*#\1#" ) | |
export RELEASED_MINOR=$(echo $RELEASED_TAG | sed "s#\(.*-locietta-WSL2-xanmod[0-9][0-9]*\).*\([0-9][0-9]*\).*#\2#" ) | |
echo "CURRENT_VERSION=$CURRENT_VERSION" | tee -a $GITHUB_ENV | |
echo "RELEASED_VERSION=$RELEASED_VERSION" | tee -a $GITHUB_ENV | |
if [[ $CURRENT_VERSION != $RELEASED_VERSION || \ | |
($CURRENT_VERSION = $RELEASED_VERSION && 1 -gt "$RELEASED_MINOR") || \ | |
"${{ github.event_name }}" = 'pull_request' || \ | |
"${{ github.event_name }}" = 'workflow_dispatch' ]]; then | |
echo "REBUILD_FLAG=1" | tee -a $GITHUB_ENV | |
else | |
echo "REBUILD_FLAG=" | tee -a $GITHUB_ENV | |
fi | |
- name: Build kernel | |
if: ${{ env.REBUILD_FLAG }} | |
run: | | |
cd linux && ../build.sh --branch LTS | |
mv arch/x86/boot/bzImage ../${{ matrix.image-name }} | |
cp .config ../.config-${{ matrix.image-name }} | |
cd .. && sha256sum ${{ matrix.image-name }} > ${{ matrix.image-name }}.sha256 | |
- name: Upload bzImage | |
uses: actions/upload-artifact@main | |
if: ${{ env.REBUILD_FLAG }} | |
with: | |
name: ${{ matrix.image-name }} | |
path: | | |
${{ matrix.image-name }} | |
${{ matrix.image-name }}.sha256 | |
.config-${{ matrix.image-name }} | |
- id: out | |
run: | | |
echo "current_version=${{ env.CURRENT_VERSION }}" >> $GITHUB_OUTPUT | |
echo "release_version=${{ env.RELEASED_VERSION }}" >> $GITHUB_OUTPUT | |
echo "clang_version=${{ env.CLANG_VERSION }}" >> $GITHUB_OUTPUT | |
echo "rebuild_flag=${{ env.REBUILD_FLAG }}" >> $GITHUB_OUTPUT | |
release-lts: | |
runs-on: ubuntu-latest | |
needs: build | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@main | |
- uses: actions/download-artifact@main | |
with: | |
path: release_images/ | |
merge-multiple: true | |
- id: fetch_commit_sha | |
run: | | |
if [ ${{ github.event_name }} = 'pull_request' ]; then | |
echo "sha=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT | |
echo "RELEASE_TAG=${{ needs.build.outputs.current_version }}.1-PR" | tee -a $GITHUB_ENV | |
else | |
echo "sha=${{ github.sha }}" >> $GITHUB_OUTPUT | |
echo "RELEASE_TAG=${{ needs.build.outputs.current_version }}.1" | tee -a $GITHUB_ENV | |
fi | |
- name: Remove misc files | |
run: | | |
rm -rf release_images/.config* | |
# We don't release .config files, they are in the artifact only for debugging | |
- name: Release | |
uses: softprops/action-gh-release@v2.2.1 | |
if: ${{ needs.build.outputs.rebuild_flag }} | |
with: | |
name: ${{ env.RELEASE_TAG }}-lts | |
tag_name: lts | |
draft: ${{ github.event_name == 'pull_request' }} | |
target_commitish: ${{ steps.fetch_commit_sha.outputs.sha }} | |
body: | | |
Latest Stratosphere (Locietta-XanMod-LTS) kernel for WSL2 optimized for Ryzen, built with ${{ needs.build.outputs.clang_version }}. | |
* `bzImage-zen` for Ryzen 1xxx/2xxx series CPUs | |
* `bzImage-zen2` for Ryzen 3xxx/4xxx series CPUs | |
* `bzImage-zen3` for Ryzen 5xxx/6xxx series CPUs | |
* `bzImage-zen4` for Ryzen 7xxx/8xxx series CPUs | |
files: | | |
release_images/* | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# generate_release_notes: true | |
fail_on_unmatched_files: true |