99 - master
1010
1111jobs :
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+
1283 build :
84+ name : Build Toolchain Variants
1385 runs-on : ${{ matrix.os }}
86+ needs : [cache]
1487 strategy :
1588 matrix :
1689 os : [ubuntu-22.04, ubuntu-24.04]
@@ -32,12 +105,68 @@ jobs:
32105 echo "-- After --"
33106 df -h
34107
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+
35134 - uses : actions/checkout@v4
36135
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
38167 run : sudo ./.github/setup-apt.sh
39168
40- - name : build toolchain
169+ - name : Build Toolchain
41170 run : |
42171 TARGET_TUPLE=($(echo ${{ matrix.target }} | tr "-" "\n"))
43172 BUILD_TOOLCHAIN="./configure --prefix=/opt/riscv --with-arch=${TARGET_TUPLE[0]} --with-abi=${TARGET_TUPLE[1]}"
@@ -48,24 +177,24 @@ jobs:
48177 fi
49178 sudo make -j $(nproc) ${{ matrix.mode }}
50179
51- - name : make report
180+ - name : Generate Report
52181 if : |
53182 matrix.os == 'ubuntu-24.04'
54183 && (matrix.mode == 'linux' || matrix.mode == 'newlib')
55184 && matrix.compiler == 'gcc'
56185 run : |
57186 sudo make report-${{ matrix.mode }} -j $(nproc)
58187
59- - name : recover space
188+ - name : Recover Space
60189 run : |
61190 sudo du -hs / 2> /dev/null || true
62191 sudo rm -rf binutils dejagnu gcc gdb glibc llvm musl newlib pk qemu spike uclibc-ng || true
63192 sudo du -hs / 2> /dev/null || true
64193
65- - name : tarball build
194+ - name : Tar Toolchain
66195 run : tar czvf riscv.tar.gz -C /opt/ riscv/
67196
68- - name : generate prebuilt toolchain name
197+ - name : Generate Prebuilt Toolchain Name
69198 id : toolchain-name-generator
70199 run : |
71200 if [[ "${{ matrix.target }}" == *"32"* ]]; then BITS=32; else BITS=64; fi
87216 path : riscv.tar.gz
88217
89218 test-sim :
219+ name : Test Simulation
90220 runs-on : ${{ matrix.os }}
91221 strategy :
92222 matrix :
@@ -106,16 +236,16 @@ jobs:
106236
107237 - uses : actions/checkout@v4
108238
109- - name : install dependencies
239+ - name : Install Dependencies
110240 run : sudo ./.github/setup-apt.sh
111241
112- - name : build toolchain
242+ - name : Build Toolchain
113243 run : |
114244 TARGET_TUPLE=($(echo ${{ matrix.target }} | tr "-" "\n"))
115245 ./configure --prefix=/opt/riscv --with-arch=${TARGET_TUPLE[0]} --with-abi=${TARGET_TUPLE[1]} --with-sim=${{ matrix.sim }}
116246 make -j $(nproc) ${{ matrix.mode }}
117247
118- - name : make report
248+ - name : Generate Report
119249 run : make report-${{ matrix.mode }} -j $(nproc)
120250
121251 build-multilib :
0 commit comments