9
9
- master
10
10
11
11
jobs :
12
+ cache :
13
+ name : Update Submodule Cache
14
+ runs-on : ubuntu-24.04
15
+ steps :
16
+ - uses : actions/checkout@v4
17
+
18
+ - name : Cache GCC
19
+ uses : actions/cache@v4
20
+ with :
21
+ path : |
22
+ .git/modules/gcc
23
+ gcc
24
+ key : compiler-gcc
25
+
26
+ - name : Cache LLVM
27
+ uses : actions/cache@v4
28
+ with :
29
+ path : |
30
+ .git/modules/llvm
31
+ llvm
32
+ key : compiler-llvm
33
+
34
+ - name : Cache Newlib
35
+ uses : actions/cache@v4
36
+ with :
37
+ path : |
38
+ .git/modules/newlib
39
+ newlib
40
+ key : mode-newlib
41
+
42
+ - name : Cache Linux
43
+ uses : actions/cache@v4
44
+ with :
45
+ path : |
46
+ .git/modules/glibc
47
+ glibc
48
+ key : mode-linux
49
+
50
+ - name : Cache musl
51
+ uses : actions/cache@v4
52
+ with :
53
+ path : |
54
+ .git/modules/musl
55
+ musl
56
+ key : mode-musl
57
+
58
+ - name : Cache uClibc
59
+ uses : actions/cache@v4
60
+ with :
61
+ path : |
62
+ .git/modules/uclibc-ng
63
+ uclibc-ng
64
+ key : mode-uclibc
65
+
66
+ - name : Cache Always Required Submodules
67
+ uses : actions/cache@v4
68
+ with :
69
+ path : |
70
+ .git/modules/binutils
71
+ .git/modules/gdb
72
+ binutils
73
+ gdb
74
+ key : general-dependencies
75
+
76
+ - name : Clone needed submodules
77
+ run : |
78
+ git submodule update --init --progress --depth 1 --jobs $(nproc) binutils gdb gcc llvm newlib glibc musl
79
+ git submodule update --init --progress uclibc-ng
80
+
81
+
82
+
12
83
build :
84
+ name : Build Toolchain Variants
13
85
runs-on : ${{ matrix.os }}
86
+ needs : [cache]
14
87
strategy :
15
88
matrix :
16
89
os : [ubuntu-22.04, ubuntu-24.04]
@@ -32,12 +105,68 @@ jobs:
32
105
echo "-- After --"
33
106
df -h
34
107
108
+ - name : Generate Required Submodules
109
+ id : required-submodules
110
+ run : |
111
+ case "${{ matrix.mode }}" in
112
+ "linux")
113
+ MODE_SUBMODULE="glibc";;
114
+ "musl")
115
+ MODE_SUBMODULE="musl";;
116
+ "uclibc")
117
+ MODE_SUBMODULE="uclibc-ng";;
118
+ "newlib")
119
+ MODE_SUBMODULE="newlib";;
120
+ *)
121
+ echo "Invalid Mode"; exit 1;;
122
+ esac
123
+ echo "MODE_SUBMODULE=$MODE_SUBMODULE" >> $GITHUB_OUTPUT
124
+ case "${{ matrix.compiler }}" in
125
+ "gcc")
126
+ COMPILER_SUBMODULE="gcc";;
127
+ "llvm")
128
+ COMPILER_SUBMODULE="llvm";;
129
+ *)
130
+ echo "Invalid Compiler"; exit 1;;
131
+ esac
132
+ echo "COMPILER_SUBMODULE=$COMPILER_SUBMODULE" >> $GITHUB_OUTPUT
133
+
35
134
- uses : actions/checkout@v4
36
135
37
- - name : install dependencies
136
+ - name : Load Compiler Submodule from Cache
137
+ uses : actions/cache/restore@v4
138
+ env :
139
+ submodule : ${{ steps.required-submodules.outputs.COMPILER_SUBMODULE }}
140
+ with :
141
+ path : |
142
+ .git/modules/${{ env.submodule }}
143
+ ${{ env.submodule }}
144
+ key : compiler-${{ matrix.compiler }}
145
+
146
+ - name : Load Mode Submodule from Cache
147
+ uses : actions/cache/restore@v4
148
+ env :
149
+ submodule : ${{ steps.required-submodules.outputs.MODE_SUBMODULE }}
150
+ with :
151
+ path : |
152
+ .git/modules/${{ env.submodule }}
153
+ ${{ env.submodule }}
154
+ key : mode-${{ matrix.mode }}
155
+
156
+ - name : Load Always Required Submodules from Cache
157
+ uses : actions/cache/restore@v4
158
+ with :
159
+ path : |
160
+ .git/modules/binutils
161
+ .git/modules/gdb
162
+ binutils
163
+ gdb
164
+ key : general-dependencies
165
+
166
+ - name : Install Dependencies
38
167
run : sudo ./.github/setup-apt.sh
39
168
40
- - name : build toolchain
169
+ - name : Build Toolchain
41
170
run : |
42
171
TARGET_TUPLE=($(echo ${{ matrix.target }} | tr "-" "\n"))
43
172
BUILD_TOOLCHAIN="./configure --prefix=/opt/riscv --with-arch=${TARGET_TUPLE[0]} --with-abi=${TARGET_TUPLE[1]}"
@@ -48,24 +177,24 @@ jobs:
48
177
fi
49
178
sudo make -j $(nproc) ${{ matrix.mode }}
50
179
51
- - name : make report
180
+ - name : Generate Report
52
181
if : |
53
182
matrix.os == 'ubuntu-24.04'
54
183
&& (matrix.mode == 'linux' || matrix.mode == 'newlib')
55
184
&& matrix.compiler == 'gcc'
56
185
run : |
57
186
sudo make report-${{ matrix.mode }} -j $(nproc)
58
187
59
- - name : recover space
188
+ - name : Recover Space
60
189
run : |
61
190
sudo du -hs / 2> /dev/null || true
62
191
sudo rm -rf binutils dejagnu gcc gdb glibc llvm musl newlib pk qemu spike uclibc-ng || true
63
192
sudo du -hs / 2> /dev/null || true
64
193
65
- - name : tarball build
194
+ - name : Tar Toolchain
66
195
run : tar czvf riscv.tar.gz -C /opt/ riscv/
67
196
68
- - name : generate prebuilt toolchain name
197
+ - name : Generate Prebuilt Toolchain Name
69
198
id : toolchain-name-generator
70
199
run : |
71
200
if [[ "${{ matrix.target }}" == *"32"* ]]; then BITS=32; else BITS=64; fi
87
216
path : riscv.tar.gz
88
217
89
218
test-sim :
219
+ name : Test Simulation
90
220
runs-on : ${{ matrix.os }}
91
221
strategy :
92
222
matrix :
@@ -106,16 +236,16 @@ jobs:
106
236
107
237
- uses : actions/checkout@v4
108
238
109
- - name : install dependencies
239
+ - name : Install Dependencies
110
240
run : sudo ./.github/setup-apt.sh
111
241
112
- - name : build toolchain
242
+ - name : Build Toolchain
113
243
run : |
114
244
TARGET_TUPLE=($(echo ${{ matrix.target }} | tr "-" "\n"))
115
245
./configure --prefix=/opt/riscv --with-arch=${TARGET_TUPLE[0]} --with-abi=${TARGET_TUPLE[1]} --with-sim=${{ matrix.sim }}
116
246
make -j $(nproc) ${{ matrix.mode }}
117
247
118
- - name : make report
248
+ - name : Generate Report
119
249
run : make report-${{ matrix.mode }} -j $(nproc)
120
250
121
251
build-multilib :
0 commit comments