This repository has been archived by the owner on Mar 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
190 lines (184 loc) · 7.66 KB
/
build-testing-5.15.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
180
181
182
183
184
185
186
187
188
189
190
name: (5.15) Build Testing Brunch-mac using Github Actions
on:
workflow_dispatch:
branches:
- 'Testing-5.15'
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-mac source code
uses: actions/checkout@v3
- 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@v3
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: Free some disk space
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
sudo apt clean
- name: Checkout Brunch-mac source code
uses: actions/checkout@v3
- name: Download kernels source
uses: actions/download-artifact@v3
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@v3
with:
name: built-kernel-${{ matrix.kernel }}
path: /tmp/built-kernel-${{ matrix.kernel }}.tar.gz
if-no-files-found: error
build-brunch:
name: Build Brunch-mac
needs: build-kernels
runs-on: ubuntu-22.04
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 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-mac source code
uses: actions/checkout@v3
- name: Download built kernels
uses: actions/download-artifact@v3
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-mac
run: sudo bash build_brunch.sh
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: brunch-build
path: out/brunch_r*.tar.gz
if-no-files-found: error
release:
name: Make a Brunch-mac release
permissions:
contents: write
needs: build-brunch
runs-on: ubuntu-22.04
steps:
- name: Initialize Git repository
run: git init # Add this step to initialize Git
- name: Install dependencies
run: |
yes | DEBIAN_FRONTEND=noninteractive sudo apt update
yes | DEBIAN_FRONTEND=noninteractive sudo apt install jq
- name: Get latest tag
id: latest-tag
run: |
LATEST_TAG=$(curl -s "https://api.github.com/repos/ZProLegend007/brunch-mac/releases/latest" | jq -r .tag_name)
echo "Latest tag is $LATEST_TAG"
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
shell: bash
- name: Download built artifacts
uses: actions/download-artifact@v3
with:
name: brunch-build
- name: Generate release details
run: |
RELEASE_FILE=$(ls brunch_r*.tar.gz)
RELEASE_VERSION=$(echo "$RELEASE_FILE" | sed -n 's/brunch_r\([0-9]*\).*/\1/p')
MAJOR_VERSION="r${RELEASE_VERSION}"
LATEST_TAG="${{ env.LATEST_TAG }}"
LATEST_MAJOR_VERSION="${LATEST_TAG%%.*}"
if [ "$LATEST_MAJOR_VERSION" == "${MAJOR_VERSION}" ]; then
LAST_RELEASE_TAG="$LATEST_TAG"
LAST_DECIMAL=$(cut -d. -f2 <<< "$LAST_RELEASE_TAG")
NEW_DECIMAL=$((LAST_DECIMAL + 1))
else
NEW_DECIMAL="0"
fi
RELEASE_VERSION="${MAJOR_VERSION}.${NEW_DECIMAL}"
NEW_RELEASE_NAME="Brunch-mac ${RELEASE_VERSION} - TESTING - Kernel 5.15"
NEW_RELEASE_FILE="Brunch-mac_${RELEASE_VERSION}_TESTING_K5.15.tar.gz"
echo "Found brunch release: ${RELEASE_FILE} with version ${RELEASE_VERSION}"
echo "Renaming release file to: $NEW_RELEASE_FILE"
mv "$RELEASE_FILE" "$NEW_RELEASE_FILE"
echo "RELEASE_NAME=${NEW_RELEASE_NAME}" >> $GITHUB_ENV
echo "RELEASE_TAG=${RELEASE_VERSION}-Testing-K5.15" >> $GITHUB_ENV
echo "RELEASE_FILE=${NEW_RELEASE_FILE}" >> $GITHUB_ENV
id: generate-release-details
- 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 }}"