-
Notifications
You must be signed in to change notification settings - Fork 4
144 lines (129 loc) · 4.96 KB
/
build.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
name: Build Bazzite Kernel
on:
workflow_dispatch:
inputs:
arm:
description: 'Build arm version only'
type: boolean
default: false
release:
types: [published]
permissions:
contents: write
jobs:
build_kernel:
environment: prod
strategy:
fail-fast: false
matrix:
arch: ${{ github.event.inputs.arm == 'true' && fromJSON('["aarch64"]') || fromJSON('["aarch64", "x86_64"]') }}
fedora_version: [41]
runs-on: ${{ matrix.arch == 'aarch64' && 'ARM64' || 'ubuntu-24.04' }}
steps:
- name: Maximize build space
if: matrix.arch == 'x86_64'
uses: ublue-os/remove-unwanted-software@v7
- name: Checkout repository
uses: actions/checkout@v4
- name: Restore ccache
# Don't use cache on releases as github does not allow it
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/cache/restore@v4
with:
path: ccache
key: ccache-${{ matrix.arch }}-${{ github.sha }}
restore-keys: |
ccache-${{ matrix.arch }}
- name: Create Build Environment
run: |
FEDORA_VERSION="${{ matrix.fedora_version }}"
sudo podman build . --tag 'fedora_builder' \
--build-arg UID=$(id -u) --build-arg GID=$(id -g) \
--build-arg FEDORA_VERSION=${FEDORA_VERSION:-41}
- name: Write Changelog
run: |
sudo podman run --rm -v $(pwd):/workspace fedora_builder \
python3 release_changelog.py
- name: Compile Kernel
run: |
FEDORA_VERSION="${{ matrix.fedora_version }}"
ARCH="${{ matrix.arch }}"
DISABLE_ARG="${{ startsWith(github.ref, 'refs/tags/') && '--env CCACHE_DISABLE=true' || '' }}"
sudo podman run --rm -v $(pwd):/workspace $DISABLE_ARG \
--env CCACHE_DIR=/workspace/ccache \
--env CCACHE_MAXSIZE=5G \
--env CCACHE_COMPRESS=1 \
fedora_builder fedpkg \
--name kernel --namespace rpms --release "f${FEDORA_VERSION:-41}" \
local --arch ${ARCH:-x86_64} --with baseonly \
--builddir build --buildrootdir buildroot
- name: Print ccache stats
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
run: |
sudo apt install -y ccache
ccache -s
- name: Separate debuginfo into different folder
run: |
mkdir -p debuginfo
mv ${{ matrix.arch }}/kernel-debuginfo-*.rpm debuginfo/
- name: Upload Kernel to action
uses: actions/upload-artifact@v4
with:
name: kernel-f${{ matrix.fedora_version}}-${{ matrix.arch }}
path: |
.build-*.log
${{ matrix.arch }}/kernel-*.rpm
compression-level: 7
- name: Upload Kernel debuginfo to action
uses: actions/upload-artifact@v4
with:
name: kernel-f${{ matrix.fedora_version}}-${{ matrix.arch }}-debuginfo
path: |
.build-*.log
debuginfo/*.rpm
compression-level: 7
- name: Convert to Arch
if: matrix.arch == 'x86_64' && matrix.fedora_version == 41
run: |
# Grab kernel ver from the log
KERNEL_VER=$(ls -a | grep .build | head -n 1 | sed 's/.build-//' | sed 's/.log//')
ARCH_VER=$(echo $KERNEL_VER | sed 's/-/./g')
# Place in PKGBUILD
cat PKGBUILD | \
sed "s/VERSION_FEDORA/${KERNEL_VER}.x86_64/" | \
sed "s/VERSION_ARCH/${ARCH_VER}/" \
> x86_64/PKGBUILD
sudo podman build . -f Dockerfile-arch --tag 'arch_builder' --build-arg UID=$(id -u) --build-arg GID=$(id -g)
sudo podman run --rm -v $(pwd)/x86_64:/workspace arch_builder makepkg -s
- name: Upload Kernel arch package to action
uses: actions/upload-artifact@v4
if: matrix.arch == 'x86_64' && matrix.fedora_version == 41
with:
name: linux-f${{ matrix.fedora_version }}-arch
path: |
x86_64/linux-*.pkg.tar.zst
compression-level: 7
- name: Upload Kernel to release
if: github.event_name == 'release'
uses: Wandalen/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
attempt_limit: 3
attempt_delay: 15000
action: softprops/action-gh-release@v2
with: |
files: |
${{ matrix.arch }}/kernel-*.rpm
x86_64/linux-*.pkg.tar.zst
x86_64/linux-*.pkg.tar.zst.sig
fail_on_unmatched_files: false
make_latest: ${{ github.event.release.prerelease == false }}
# We always want to save the newest ccache
- name: Backup ccache
# Don't use cache on releases as github does not allow it
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/cache/save@v4
with:
path: ccache
key: ccache-${{ matrix.arch }}-${{ github.sha }}