-
Notifications
You must be signed in to change notification settings - Fork 2
331 lines (287 loc) · 10.2 KB
/
Copy pathbuild-test.yaml
File metadata and controls
331 lines (287 loc) · 10.2 KB
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
name: Build-Test
# Builds GCC and runs the testsuite.
# If the testsuite run times out, the build/test gets re-run on a self-hosted runner.
on:
workflow_call:
inputs:
mode:
required: true
type: string
target:
required: true
type: string
gcchash:
required: true
type: string
multilib:
required: true
type: string
multitarget:
required: false
type: string
run_on_self_hosted:
required: true
type: string
prefix:
required: false
type: string
jobs:
check:
runs-on: ubuntu-24.04
environment: production
steps:
- name: Early exit
if: ${{ inputs.multitarget != '' && !contains(inputs.multitarget, format('{0}:{1}', inputs.mode, inputs.target)) }}
id: early-exit
run: |
export EARLY_EXIT="exit"
echo "early_exit=$EARLY_EXIT" >> "$GITHUB_OUTPUT"
outputs:
early_exit: ${{ steps.early-exit.outputs.early_exit }}
build:
runs-on: ubuntu-24.04
environment: production
defaults:
run:
working-directory: riscv-gnu-toolchain
needs: [check]
if: ${{ needs.check.outputs.early_exit != 'exit' && inputs.run_on_self_hosted != 'true' }}
steps:
- uses: actions/checkout@v4
- name: Setup env
uses: ./.github/actions/common/setup-env
with:
free_up_space: true
- name: Restore submodules from cache
run: |
gh run download --repo ${{ github.repository }} "${{ github.run_id }}" --name "${{ inputs.prefix }}gcc-sources-${{ inputs.gcchash }}"
env:
GH_TOKEN: ${{ github.token }}
- name: Restore submodules
run: |
pwd
ls
rm -rf .git binutils dejagnu gcc gdb glibc newlib qemu
unzip cache.zip
rm -rf cache.zip
- name: Print gcc hash
run: |
cd gcc
git rev-parse HEAD
- name: Make log name
id: build-log
run: |
export BUILD_LOG_NAME=${{ inputs.mode }}-${{ inputs.target }}-${{ inputs.gcchash }}-${{ inputs.multilib }}-build-log
echo "build_log_name=$BUILD_LOG_NAME" >> $GITHUB_OUTPUT
- name: Build gcc
id: build-status
uses: ./.github/actions/common/build-target
with:
# Only 32/64gc multilibs run on github-hosted runners
multilib_target_string: ${{ inputs.target }}
build_log_name: ${{ steps.build-log.outputs.build_log_name }}
upload_stage2_artifacts: 'true'
mode: ${{ inputs.mode }}
target: ${{ inputs.target }}
gcchash: ${{ inputs.gcchash }}
multilib: ${{ inputs.multilib }}
prefix: ${{ inputs.prefix }}
outputs:
build_success: ${{ steps.build-status.outputs.build_success }}
test:
runs-on: ubuntu-24.04
environment: production
defaults:
run:
working-directory: riscv-gnu-toolchain
needs: [check, build]
# Skip linux multilib
if: ${{ needs.check.outputs.early_exit != 'exit' && inputs.run_on_self_hosted != 'true' }}
steps:
- uses: actions/checkout@v4
- name: Setup env
uses: ./.github/actions/common/setup-env
with:
free_up_space: true
- name: Restore submodules from cache
run: |
gh run download --repo ${{ github.repository }} "${{ github.run_id }}" --name "${{ inputs.prefix }}gcc-sources-${{ inputs.gcchash }}"
env:
GH_TOKEN: ${{ github.token }}
- name: Restore submodules
run: |
pwd
rm -rf .git binutils dejagnu gcc gdb glibc newlib qemu
unzip cache.zip
rm -rf cache.zip
- name: Print gcc hash
run: |
cd gcc
git rev-parse HEAD
- name: Install dependencies
run: sudo ./.github/setup-apt.sh
# Only 32/64gc multilibs run on github-hosted runners
- name: Configure
run: |
mkdir build
cd build
TARGET_TUPLE=($(echo ${{ inputs.target }} | tr "-" "\n"))
../../configure-scripts/${{ inputs.prefix }}${TARGET_TUPLE[0]}-${TARGET_TUPLE[1]}
sed -i "s/ --user / --user --break-system-packages /g" Makefile
- name: Restore Stage2 Artifacts
uses: ./.github/actions/common/restore-stage-2
with:
mode: ${{ inputs.mode }}
target: ${{ inputs.target }}
gcchash: ${{ inputs.gcchash }}
multilib: ${{ inputs.multilib }}
prefix: ${{ inputs.prefix }}
- name: Run Testsuite
uses: ./.github/actions/common/run-testsuite
with:
mode: ${{ inputs.mode }}
target: ${{ inputs.target }}
gcchash: ${{ inputs.gcchash }}
multilib: ${{ inputs.multilib }}
prefix: ${{ inputs.prefix }}
# The self-hosted environment does not have the same path setup as the hosted runners
# We need to rebuild since restoring the artifact won't work
# (the new path will break the existing build).
rerun-timeouts:
runs-on: self-hosted
environment: production
defaults:
run:
working-directory: riscv-gnu-toolchain
needs: [check, build, test]
if: ${{ failure() && needs.build.outputs.build_success == 'success' && inputs.run_on_self_hosted != 'true' }}
timeout-minutes: 1440 # 24 hours
steps:
- name: 'Cleanup build folder'
working-directory: ./
run: |
ls -la ./
rm -rf ./* || true
rm -rf ./.??* || true
ls -la ./
- uses: actions/checkout@v4
- name: Setup env
uses: ./.github/actions/common/setup-env
with:
free_up_space: false
- name: Restore submodules from cache
run: |
gh run download --repo ${{ github.repository }} "${{ github.run_id }}" --name "${{ inputs.prefix }}gcc-sources-${{ inputs.gcchash }}"
env:
GH_TOKEN: ${{ github.token }}
- name: Restore submodules
run: |
pwd
rm -rf .git binutils dejagnu gcc gdb glibc newlib qemu
unzip cache.zip
rm -rf cache.zip
- name: Print gcc hash
run: |
cd gcc
git rev-parse HEAD
- name: Install dependencies
run: |
sudo ./.github/setup-apt.sh
sudo apt install python3 -y
sudo apt install python-is-python3 -y
# Only 32/64gc multilibs run on github-hosted runners
- name: Configure
run: |
mkdir build
cd build
TARGET_TUPLE=($(echo ${{ inputs.target }} | tr "-" "\n"))
../../configure-scripts/${TARGET_TUPLE[0]}-${TARGET_TUPLE[1]}
sed -i "s/ --user / --user --break-system-packages /g" Makefile
- name: Build
run: |
cd build
make ${{ inputs.mode }} -j20 --output-sync=target
- name: Run Testsuite
uses: ./.github/actions/common/run-testsuite
with:
mode: ${{ inputs.mode }}
target: ${{ inputs.target }}
gcchash: ${{ inputs.gcchash }}
multilib: ${{ inputs.multilib }}
prefix: ${{ inputs.prefix }}
# The self-hosted environment does not have the same path setup as the hosted runners
# We need to rebuild since restoring the artifact won't work
# (the new path will break the existing build).
run-on-self-hosted:
runs-on: self-hosted
environment: production
defaults:
run:
working-directory: riscv-gnu-toolchain
needs: [check]
if: ${{ needs.check.outputs.early_exit != 'exit' && inputs.run_on_self_hosted == 'true' }}
timeout-minutes: 1440 # 24 hours
steps:
- name: 'Cleanup build folder'
working-directory: ./
run: |
ls -la ./
rm -rf ./* || true
rm -rf ./.??* || true
ls -la ./
- uses: actions/checkout@v4
- name: Setup env
uses: ./.github/actions/common/setup-env
with:
free_up_space: false
- name: Restore submodules from cache
run: |
gh run download --repo ${{ github.repository }} "${{ github.run_id }}" --name "${{ inputs.prefix }}gcc-sources-${{ inputs.gcchash }}"
env:
GH_TOKEN: ${{ github.token }}
- name: Restore submodules
run: |
pwd
rm -rf .git binutils dejagnu gcc gdb glibc newlib qemu
unzip cache.zip
rm -rf cache.zip
- name: Checkout gcc hash
run: |
cd gcc
echo "using hash $(git rev-parse HEAD)"
- name: Make log name
id: build-log
run: |
export BUILD_LOG_NAME=${{ inputs.mode }}-${{ inputs.target }}-${{ inputs.gcchash }}-${{ inputs.multilib }}-build-log
echo "build_log_name=$BUILD_LOG_NAME" >> $GITHUB_OUTPUT
- name: Set multilib target string
id: multilib-target
run: |
export MULTILIB_STRING="${{ inputs.target }}"
echo "multilib_string=$MULTILIB_STRING" >> $GITHUB_OUTPUT
# Don't upload stage 2 artifacts on self-hosted runners
# in interest of resources
# rv32gcv-ilp32d, # rv32 vector
# rv64gcv-lp64d, # rv64 vector
# rv64gcv_zvbb_zvbc_zvkg_zvkn_zvknc_zvkned_zvkng_zvknha_zvknhb_zvks_zvksc_zvksed_zvksg_zvksh_zvkt-lp64d, # rv64 vector crypto
# rv64imafdcv_zicond_zawrs_zbc_zvkng_zvksg_zvbb_zvbc_zicsr_zba_zbb_zbs_zicbom_zicbop_zicboz_zfhmin_zkt-lp64d, # RVA23U64 profile with optional extensions, excluding unsupported extensions
- name: Build gcc
id: build-status
uses: ./.github/actions/common/build-target
with:
multilib_target_string: ${{ steps.multilib-target.outputs.multilib_string }}
build_log_name: ${{ steps.build-log.outputs.build_log_name }}
upload_stage2_artifacts: 'false'
mode: ${{ inputs.mode }}
target: ${{ inputs.target }}
gcchash: ${{ inputs.gcchash }}
multilib: ${{ inputs.multilib }}
prefix: ${{ inputs.prefix }}
- name: Run Testsuite
uses: ./.github/actions/common/run-testsuite
with:
mode: ${{ inputs.mode }}
target: ${{ inputs.target }}
gcchash: ${{ inputs.gcchash }}
multilib: ${{ inputs.multilib }}
prefix: ${{ inputs.prefix }}