-
Notifications
You must be signed in to change notification settings - Fork 398
179 lines (179 loc) · 7.59 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: Build Brunch using Github Actions
on:
push:
branches:
- 'r125'
paths-ignore:
- 'README.md'
concurrency:
group: environment-${{ github.ref }}
cancel-in-progress: true
jobs:
prepare-kernels:
name: Prepare Kernels
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.kernels.outputs.matrix }}
steps:
- name: Install dependencies
run: |
yes | DEBIAN_FRONTEND=noninteractive sudo apt update
#yes | DEBIAN_FRONTEND=noninteractive sudo apt dist-upgrade
yes | DEBIAN_FRONTEND=noninteractive sudo apt install gcc-12 g++-12 git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc flex libelf-dev bison sbsigntool
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 110 --slave /usr/bin/g++ g++ /usr/bin/g++-12 --slave /usr/bin/gcov gcov /usr/bin/gcov-12
- name: Checkout Brunch source code
uses: actions/checkout@v4
- name: Download kernels and apply patches
run: ./prepare_kernels.sh
- name: Define kernels matrix
id: kernels
run: echo "matrix=$(echo [\"$(ls -d ./kernels/* | cut -f3 -d'/' | sed -Ez '$ s/\n+$//' | sed -z 's#\n#","#g')\"])" >> $GITHUB_OUTPUT
- name: Compress kernels source files
run: tar zcf /tmp/kernels-source.tar.gz kernels
- name: Upload kernels source
uses: actions/upload-artifact@v4
with:
name: kernels-source
path: /tmp/kernels-source.tar.gz
if-no-files-found: error
build-kernels:
name: Build Kernels
needs: prepare-kernels
runs-on: ubuntu-22.04
strategy:
matrix:
kernel: ${{ fromJson(needs.prepare-kernels.outputs.matrix) }}
steps:
- name: Install dependencies
run: |
yes | DEBIAN_FRONTEND=noninteractive sudo apt update
#yes | DEBIAN_FRONTEND=noninteractive sudo apt dist-upgrade
yes | DEBIAN_FRONTEND=noninteractive sudo apt install gcc-12 g++-12 git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc flex libelf-dev bison sbsigntool
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 110 --slave /usr/bin/g++ g++ /usr/bin/g++-12 --slave /usr/bin/gcov gcov /usr/bin/gcov-12
- name: Checkout Brunch source code
uses: actions/checkout@v4
- name: Download kernels source
uses: actions/download-artifact@v4
with:
name: kernels-source
path: /tmp
- name: Extract kernels source files
run: |
tar -zxf /tmp/kernels-source.tar.gz
rm -f /tmp/kernels-source.tar.gz
- name: Install Secure Boot certificate
env:
BRUNCH_PRIV: ${{ secrets.BRUNCH_PRIV }}
BRUNCH_PEM: ${{ secrets.BRUNCH_PEM }}
run: |
sudo ln -s $RUNNER_TEMP /persist
mkdir /persist/keys
echo "$BRUNCH_PRIV" | base64 -d > /persist/keys/brunch.priv
echo "$BRUNCH_PEM" | base64 -d > /persist/keys/brunch.pem
- name: Build kernels
run: ./build_kernels.sh ${{ matrix.kernel }}
- name: Clear keys
run: rm -r /persist/keys
- name: Compress built kernel
run: tar zcf /tmp/built-kernel-${{ matrix.kernel }}.tar.gz kernels/${{ matrix.kernel }}
- name: Upload kernels source
uses: actions/upload-artifact@v4
with:
name: built-kernel-${{ matrix.kernel }}
path: /tmp/built-kernel-${{ matrix.kernel }}.tar.gz
if-no-files-found: error
build-brunch:
name: Build Brunch
needs: build-kernels
runs-on: ubuntu-22.04
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
- name: Display disk space
run: |
echo "Free space:"
df -h
- name: Install dependencies
run: |
yes | DEBIAN_FRONTEND=noninteractive sudo apt update
#yes | DEBIAN_FRONTEND=noninteractive sudo apt dist-upgrade
yes | DEBIAN_FRONTEND=noninteractive sudo apt install gcc-12 g++-12 git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc flex libelf-dev bison sbsigntool python3-protobuf rdfind zstd
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 110 --slave /usr/bin/g++ g++ /usr/bin/g++-12 --slave /usr/bin/gcov gcov /usr/bin/gcov-12
pip3 install --upgrade google-api-python-client
- name: Free some disk space
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
sudo apt clean
- name: Checkout Brunch source code
uses: actions/checkout@v4
- name: Download built kernels
uses: actions/download-artifact@v4
with:
path: /tmp
- name: Copy built kernels
run: |
for file in /tmp/built-kernel-*/built-kernel-*.tar.gz
do
tar zxf $file
rm -f $file
done
rm -r /tmp/kernels-source/kernels-source.tar.gz
- name: Build brunch
run: sudo bash build_brunch.sh
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: brunch-build
path: out/brunch_r*.tar.gz
if-no-files-found: error
release:
name: Make a Brunch release
permissions:
contents: write
needs: build-brunch
runs-on: ubuntu-22.04
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
- name: Display disk space
run: |
echo "Free space:"
df -h
- name: Download built artifacts
uses: actions/download-artifact@v4
with:
name: brunch-build
- name: Identify custom version
if: ${{ (github.repository != 'sebanc/brunch') && (github.repository != 'sebanc/brunch-unstable') }}
run: echo "RELEASE_VERSION_TYPE=custom" >> $GITHUB_ENV
- name: Identify unstable version
if: ${{ (github.repository == 'sebanc/brunch-unstable') }}
run: echo "RELEASE_VERSION_TYPE=unstable" >> $GITHUB_ENV
- name: Identify stable version
if: ${{ (github.repository == 'sebanc/brunch') }}
run: echo "RELEASE_VERSION_TYPE=stable" >> $GITHUB_ENV
- name: Generate release details
run: |
RELEASE_FILE=$(ls brunch_r*.tar.gz)
RELEASE_VERSION=$(echo "$RELEASE_FILE" | cut -d'.' -f1 | cut -d'_' -f2)
RELEASE_DATE=$(echo "$RELEASE_FILE" | cut -d'.' -f1 | cut -d'_' -f3)
echo "Found brunch release: ${RELEASE_FILE} with version ${RELEASE_VERSION} and date ${RELEASE_DATE}"
mv "brunch_${RELEASE_VERSION}_${RELEASE_DATE}.tar.gz" "brunch_${RELEASE_VERSION}_${RELEASE_VERSION_TYPE}_${RELEASE_DATE}.tar.gz"
echo "Brunch release renamed from brunch_${RELEASE_VERSION}_${RELEASE_DATE}.tar.gz to brunch_${RELEASE_VERSION}_${RELEASE_VERSION_TYPE}_${RELEASE_DATE}.tar.gz"
echo "RELEASE_FILE=brunch_${RELEASE_VERSION}_${RELEASE_VERSION_TYPE}_${RELEASE_DATE}.tar.gz" >> $GITHUB_ENV
echo "RELEASE_TAG=${RELEASE_VERSION}-${RELEASE_VERSION_TYPE}-${RELEASE_DATE}" >> $GITHUB_ENV
echo "RELEASE_NAME=Brunch ${RELEASE_VERSION} ${RELEASE_VERSION_TYPE} ${RELEASE_DATE}" >> $GITHUB_ENV
- name: Create a release and upload artifacts as assets
uses: ncipollo/release-action@v1
with:
artifacts: "${{ env.RELEASE_FILE }}"
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: false
tag: "${{ env.RELEASE_TAG }}"
name: "${{ env.RELEASE_NAME }}"
commit: "${{ github.ref_name }}"
body: "${{ github.event.head_commit.message }}"