-
Notifications
You must be signed in to change notification settings - Fork 10
238 lines (208 loc) · 7.72 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
name: mkimg-th1520-ci
on:
push:
tags:
- '*'
branches:
- '*'
pull_request:
workflow_dispatch:
env:
ARCH: riscv
jobs:
prepare:
runs-on: ubuntu-22.04
env:
CREATE_TARBALL: common_revyos_rootfs.tar
steps:
- name: Install Software
run: |
sudo apt update && \
sudo apt install -y gdisk dosfstools build-essential autoconf automake autotools-dev ninja-build make \
libncurses-dev gawk flex bison openssl libssl-dev tree \
gcc-riscv64-linux-gnu gfortran-riscv64-linux-gnu libgomp1-riscv64-cross \
qemu-user-static binfmt-support mmdebstrap
wget https://mirror.iscas.ac.cn/revyos/revyos-addons/pool/main/r/revyos-keyring/revyos-keyring_2023.06.12_all.deb
sudo apt install ./revyos-keyring_2023.06.12_all.deb
- name: Checkout qemu
uses: actions/checkout@v4
with:
repository: revyos/qemu
path: qemu
ref: ab8f84892a89feea60f1bb24432ff58ce6d2885c # TODO: remove this line
- name: build qemu
run: |
pushd qemu
./configure \
--prefix=$HOME/qemu-install \
--static \
--target-list=riscv64-linux-user \
--disable-system \
--disable-pie \
--interp-prefix=/etc/qemu-binfmt/%M
make -j$(nproc)
make install
sudo cp -fv $HOME/qemu-install/bin/qemu-riscv64 /usr/bin/qemu-riscv64-static
popd
ls -al /usr/bin/qemu-riscv64-static
sudo dpkg-reconfigure binfmt-support
- uses: actions/upload-artifact@v4
with:
name: qemu-riscv64-static-ci
path: /usr/bin/qemu-riscv64-static
- name: Checkout Repo
uses: actions/checkout@v4
with:
path: 'mkimg-th1520' # TODO: make this name a global variable
- name: Make rootfs tarball
run: |
pushd mkimg-th1520
sudo -E ./mkrootfs.sh
mv ${CREATE_TARBALL} ../
popd
- uses: actions/upload-artifact@v4
with:
name: common_revyos_rootfs
path: ${{ env.CREATE_TARBALL }}
mkrootfs:
needs: prepare
strategy:
fail-fast: false
matrix:
model: [lpi4a, ahead, console, laptop, lpi4amain, meles]
runs-on: ubuntu-22.04
env:
BOARD: ${{ matrix.model }}
steps:
- name: Run Configuration Commands
run: |
DATESTAMP="$(date --utc '+%Y.%m.%d')"
echo "Version: ${DATESTAMP}"
# Setup Artifacts Directory
ARTIFACTS_DIR="/opt/artifacts/"
mkdir -p $ARTIFACTS_DIR
# Setup environment variables
echo "DATESTAMP=${DATESTAMP}" >> $GITHUB_ENV
echo "ARTIFACTS_DIR=${ARTIFACTS_DIR}" >> $GITHUB_ENV
shell: bash
- name: Create Timestamp
run: |
echo "BUILD_ID=$(date +%Y%m%d_%H%M%S)" >> $GITHUB_ENV
echo "BUILD_DATE=$(date +%Y%m%d)" >> $GITHUB_ENV
- name: Install Software
run: |
sudo apt update && \
sudo apt install -y gdisk dosfstools build-essential autoconf automake autotools-dev ninja-build make \
libncurses-dev gawk flex bison openssl libssl-dev tree \
gcc-riscv64-linux-gnu gfortran-riscv64-linux-gnu libgomp1-riscv64-cross \
qemu-user-static binfmt-support mmdebstrap libconfuse-dev mtools
wget https://mirror.iscas.ac.cn/revyos/revyos-addons/pool/main/r/revyos-keyring/revyos-keyring_2023.06.12_all.deb
sudo apt install ./revyos-keyring_2023.06.12_all.deb
- name: Download Built Artifacts
uses: actions/download-artifact@v4
with:
path: ${{ env.ARTIFACTS_DIR }}
- name: Configure QEMU
run: |
tree ${ARTIFACTS_DIR}/
sudo cp -vf ${ARTIFACTS_DIR}/qemu-riscv64-static-ci/qemu-riscv64-static /usr/bin/qemu-riscv64-static
sudo chmod a+x /usr/bin/qemu-riscv64-static
ls -al /usr/bin/qemu-riscv64-static
sudo dpkg-reconfigure binfmt-support
echo "USE_TARBALL=${ARTIFACTS_DIR}/common_revyos_rootfs/common_revyos_rootfs.tar" >> $GITHUB_ENV
- name: Checkout genimage
uses: actions/checkout@v4
with:
repository: pengutronix/genimage
path: genimage
ref: v17
- name: build genimage
run: |
pushd genimage
./autogen.sh
./configure
make -j$(nproc)
sudo make install
popd
- name: Checkout Repo
uses: actions/checkout@v4
with:
path: 'mkimg-th1520' # TODO: make this name a global variable
- name: Make Image
run: |
# make revyos-release on CI
pushd mkimg-th1520
echo "BUILD_ID=${{ env.BUILD_ID }}" >> revyos-release
echo "BUILD_DATE=${{ env.BUILD_DATE }}" >> revyos-release
echo "BOARD_NAME=${{ env.BOARD }}" >> revyos-release
echo "RELEASE_ID=${{ github.ref_name }}" >> revyos-release
echo "COMMIT_ID=${{ github.sha }}" >> revyos-release
echo "RUNNER_ID=${{ github.run_id }}" >> revyos-release
sudo -E ./mkrootfs.sh
popd
- name: Make Checksum file & Compress files
run: |
pushd mkimg-th1520
zstd *.ext4
zstd *.img
sha256sum *.zst > SHA256SUMS
sha512sum *.zst > SHA512SUMS
popd
- name: 'Upload Artifact EMMC'
uses: actions/upload-artifact@v4
with:
retention-days: 30
name: th1520-${{ env.BOARD }}-${{ env.BUILD_ID }}
path: |
mkimg-th1520/*.ext4.zst
mkimg-th1520/SHA256SUMS
mkimg-th1520/SHA512SUMS
- name: 'Upload Artifact SDCARD'
uses: actions/upload-artifact@v4
with:
retention-days: 30
name: th1520-sdcard-${{ env.BOARD }}-${{ env.BUILD_ID }}
path: |
mkimg-th1520/*.img.zst
mkimg-th1520/SHA256SUMS
mkimg-th1520/SHA512SUMS
- name: 'Upload Release'
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
mkimg-th1520/*.zst
token: ${{ secrets.GITHUB_TOKEN }}
upload_checksum:
needs: mkrootfs
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-22.04
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: true
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Download Built Artifacts
uses: actions/download-artifact@v4
- name: Make Checksum file
run: |
find . -name "*.zst" | xargs -I{} mv -v {} .
sha256sum *.zst > SHA256SUMS
sha512sum *.zst > SHA512SUMS
- name: 'Upload checksum'
uses: softprops/action-gh-release@v2
with:
files: |
SHA256SUMS
SHA512SUMS
token: ${{ secrets.GITHUB_TOKEN }}