Skip to content

Commit 9747560

Browse files
committed
CI: Add compiler matrix for gcc and clang testing
Add compiler matrix strategy to test builds with both gcc and clang compilers. This ensures the codebase compiles and passes tests with different compilers.
1 parent 6c8728d commit 9747560

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

.github/workflows/main.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ jobs:
3636
host-x64:
3737
needs: [detect-code-related-file-changes]
3838
if: needs.detect-code-related-file-changes.outputs.has_code_related_changes == 'true'
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
compiler: [gcc, clang]
3943
runs-on: ubuntu-24.04
4044
steps:
4145
- uses: actions/checkout@v4
@@ -49,33 +53,53 @@ jobs:
4953
sudo chmod +x ./llvm.sh
5054
sudo ./llvm.sh 18
5155
shell: bash
56+
- name: Install compiler
57+
id: install_cc
58+
uses: rlalik/setup-cpp-compiler@master
59+
with:
60+
compiler: ${{ matrix.compiler }}
5261
- name: default build
62+
env:
63+
CC: ${{ steps.install_cc.outputs.cc }}
5364
run: make -j$(nproc)
5465
- name: check + tests
66+
env:
67+
CC: ${{ steps.install_cc.outputs.cc }}
5568
run: |
69+
make clean
5670
make check -j$(nproc)
5771
make tests -j$(nproc)
5872
make misalign -j$(nproc)
5973
make tool -j$(nproc)
6074
- name: diverse configurations
75+
env:
76+
CC: ${{ steps.install_cc.outputs.cc }}
6177
run: |
6278
make distclean && make ENABLE_EXT_M=0 check -j$(nproc)
6379
make distclean && make ENABLE_EXT_A=0 check -j$(nproc)
6480
make distclean && make ENABLE_EXT_F=0 check -j$(nproc)
6581
make distclean && make ENABLE_EXT_C=0 check -j$(nproc)
6682
make distclean && make ENABLE_SDL=0 check -j$(nproc)
6783
- name: misalignment test in block emulation
84+
env:
85+
CC: ${{ steps.install_cc.outputs.cc }}
6886
run: |
6987
make -C tests/system/alignment/
7088
make distclean && make ENABLE_ELF_LOADER=1 ENABLE_EXT_C=0 ENABLE_SYSTEM=1 misalign-in-blk-emu -j$(nproc)
7189
- name: MMU test
90+
env:
91+
CC: ${{ steps.install_cc.outputs.cc }}
7292
run: |
7393
make -C tests/system/mmu/
7494
make distclean && make ENABLE_ELF_LOADER=1 ENABLE_SYSTEM=1 mmu-test -j$(nproc)
7595
- name: gdbstub test
96+
env:
97+
CC: ${{ steps.install_cc.outputs.cc }}
7698
run: |
7799
make distclean && make ENABLE_GDBSTUB=1 gdbstub-test -j$(nproc)
78100
- name: JIT test
101+
env:
102+
CC: ${{ steps.install_cc.outputs.cc }}
79103
run: |
80104
make ENABLE_JIT=1 clean && make ENABLE_JIT=1 check -j$(nproc)
81105
make ENABLE_JIT=1 clean && make ENABLE_EXT_A=0 ENABLE_JIT=1 check -j$(nproc)
@@ -86,6 +110,8 @@ jobs:
86110
make clean && make ENABLE_UBSAN=1 check -j$(nproc)
87111
make ENABLE_JIT=1 clean && make ENABLE_JIT=1 ENABLE_UBSAN=1 check -j$(nproc)
88112
- name: boot Linux kernel test
113+
env:
114+
CC: ${{ steps.install_cc.outputs.cc }}
89115
run: |
90116
make clean && make ENABLE_SYSTEM=1 && make ENABLE_SYSTEM=1 artifact -j$(nproc)
91117
.ci/boot-linux.sh

0 commit comments

Comments
 (0)