Latest Kernel for archlinux #631
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: Latest Kernel for archlinux | |
on: | |
schedule: | |
- cron: '17 */12 * * *' # “At minute 17 past every 12th hour.” | |
workflow_dispatch: | |
env: | |
_anbox: "true" | |
_processor_opt: "generic" | |
PKGDEST: "/tmp/linux-tkg" | |
_debugdisable: "true" | |
_kernel_work_folder: "/tmp" | |
_kernel_source_folder: "/tmp" | |
# _modprobeddb: "true" | |
# _modprobeddb_db_path: ${{ github.workspace }}/modprobed.db | |
jobs: | |
check-for-newer-kernel: | |
runs-on: ubuntu-latest | |
outputs: | |
new_kernel: ${{ steps.check_for_new_kernel.outputs.new_kernel }} | |
latest_kernel: ${{ steps.check_for_new_kernel.outputs.latest_kernel }} | |
steps: | |
- name: Checkount linux-tkg | |
uses: actions/checkout@v3.0.2 | |
# Get latest release in repo, so we compare its version | |
# with the latest kernel available so far | |
- name: Get latest release | |
id: latest_release | |
uses: pozetroninc/github-action-get-latest-release@master | |
with: | |
repository: ${{ github.repository }} | |
# it fails when there's no release | |
continue-on-error: true | |
- name: Get latest kernel version | |
id: check_for_new_kernel | |
run: | | |
./.github/get_latest_kver.sh | |
latest_kernel="$(cat .github/latest-kernel)" | |
echo "::set-output name=latest_kernel::$latest_kernel" | |
new_kernel=0 | |
[[ "$latest_kernel" != "$latest_release" ]] || new_kernel=$? | |
echo "::set-output name=new_kernel::$new_kernel" | |
env: | |
latest_release: ${{ steps.latest_release.outputs.release }} | |
build-pds: | |
env: | |
_cpusched: "pds" | |
# The following code is repeated in each build job | |
# Can be factorized once YAML anchors get implemented in Github | |
# See https://github.com/actions/runner/issues/1182 for status | |
runs-on: ubuntu-latest | |
container: archlinux:latest | |
needs: ["check-for-newer-kernel"] | |
# the == 0 test is for "true" because it tests the exit code of a bash test | |
if: | | |
github.ref == 'refs/heads/master' && | |
needs.check-for-newer-kernel.outputs.new_kernel == '0' | |
steps: | |
# We need to install git so the checkout is done with it | |
- name: Install git | |
run: pacman -Syu --noconfirm git | |
- name: Checkount linux-tkg | |
uses: actions/checkout@v3.0.2 | |
# 1. Install deps needed for building and sudo | |
# 2. create a user "user" and give it passwordless sudo | |
# and necessary permissions | |
# because makepkg absolutely refuses to run as root | |
- name: Prepare for makepkg | |
run: | | |
pacman -Syu --noconfirm base-devel sudo | |
useradd user -G wheel && echo "user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers | |
chown user -R .. | |
chown user -R /tmp | |
# - name: "[debug] make dummy modprobed-db file for faster ci" | |
# run: | | |
# touch "${_modprobeddb_db_path}" | |
# echo "${_modprobeddb_db_path}" | |
- name: Compile Kernel | |
run: su user -c "yes '' | makepkg --noconfirm -s" | |
# run: | | |
# mkdir -p "$PKGDEST" | |
# echo "test" > "$PKGDEST"/linux-$_cpusched.pkg.tar.zst | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: kernel-packages-${{ env._cpusched }} | |
path: ${{ env.PKGDEST }}/linux*.pkg.tar.zst | |
build-cfs: | |
env: | |
_cpusched: "cfs" | |
runs-on: ubuntu-latest | |
container: archlinux:latest | |
needs: ["check-for-newer-kernel"] | |
if: | | |
github.ref == 'refs/heads/master' && | |
needs.check-for-newer-kernel.outputs.new_kernel == '0' | |
steps: | |
# We need to install git so the checkout is done with it | |
- name: Install git | |
run: pacman -Syu --noconfirm git | |
- name: Checkount linux-tkg | |
uses: actions/checkout@v3.0.2 | |
# 1. Install deps needed for building and sudo | |
# 2. create a user "user" and give it passwordless sudo | |
# and necessary permissions | |
# because makepkg absolutely refuses to run as root | |
- name: Prepare for makepkg | |
run: | | |
pacman -Syu --noconfirm base-devel sudo | |
useradd user -G wheel && echo "user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers | |
chown user -R .. | |
chown user -R /tmp | |
# - name: "[debug] make dummy modprobed-db file for faster ci" | |
# run: | | |
# touch "${_modprobeddb_db_path}" | |
# echo "${_modprobeddb_db_path}" | |
- name: Compile Kernel | |
run: su user -c "yes '' | makepkg --noconfirm -s" | |
# run: | | |
# mkdir -p "$PKGDEST" | |
# echo "test" > "$PKGDEST"/linux-$_cpusched.pkg.tar.zst | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: kernel-packages-${{ env._cpusched }} | |
path: ${{ env.PKGDEST }}/linux*.pkg.tar.zst | |
build-bmq: | |
env: | |
_cpusched: "bmq" | |
runs-on: ubuntu-latest | |
container: archlinux:latest | |
needs: ["check-for-newer-kernel"] | |
if: | | |
github.ref == 'refs/heads/master' && | |
needs.check-for-newer-kernel.outputs.new_kernel == '0' | |
steps: | |
# We need to install git so the checkout is done with it | |
- name: Install git | |
run: pacman -Syu --noconfirm git | |
- name: Checkount linux-tkg | |
uses: actions/checkout@v3.0.2 | |
# 1. Install deps needed for building and sudo | |
# 2. create a user "user" and give it passwordless sudo | |
# and necessary permissions | |
# because makepkg absolutely refuses to run as root | |
- name: Prepare for makepkg | |
run: | | |
pacman -Syu --noconfirm base-devel sudo | |
useradd user -G wheel && echo "user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers | |
chown user -R .. | |
chown user -R /tmp | |
# - name: "[debug] make dummy modprobed-db file for faster ci" | |
# run: | | |
# touch "${_modprobeddb_db_path}" | |
# echo "${_modprobeddb_db_path}" | |
- name: Compile Kernel | |
run: su user -c "yes '' | makepkg --noconfirm -s" | |
# run: | | |
# mkdir -p "$PKGDEST" | |
# echo "test" > "$PKGDEST"/linux-$_cpusched.pkg.tar.zst | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: kernel-packages-${{ env._cpusched }} | |
path: ${{ env.PKGDEST }}/linux*.pkg.tar.zst | |
make-release: | |
runs-on: ubuntu-latest | |
needs: [check-for-newer-kernel, "build-pds", "build-cfs", "build-bmq"] | |
steps: | |
- name: Download release artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: ${{ env.PKGDEST }} | |
- name: Make new release | |
uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: ${{ needs.check-for-newer-kernel.outputs.latest_kernel }} | |
prerelease: false | |
title: "${{ needs.check-for-newer-kernel.outputs.latest_kernel }}" | |
files: | | |
${{ env.PKGDEST }}/kernel-packages-*/* |