forked from managarm/mlibc
-
Notifications
You must be signed in to change notification settings - Fork 0
176 lines (172 loc) · 7.68 KB
/
ci.yml
File metadata and controls
176 lines (172 loc) · 7.68 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
name: Continuous Integration
on: [pull_request, merge_group]
jobs:
build-mlibc:
strategy:
matrix:
arch: [x86_64, riscv64, aarch64, x86, m68k, loongarch64]
builds: [mlibc, mlibc-static, mlibc-shared, mlibc-ansi-only, mlibc-headers-only]
compiler: [gcc, clang]
exclude:
- compiler: clang
include:
- arch: x86_64
builds: mlibc
compiler: clang
name: Build mlibc
runs-on: ubuntu-latest
container: debian:sid
steps:
- name: Install prerequisites
run: |
apt-get update
apt-get install -y ninja-build qemu-user \
python3-setuptools python3-jsonschema \
python3-pexpect python3-pip netbase clang lld \
git rsync wget
case "${{matrix.arch}}" in \
x86) \
apt-get install -y gcc-i686-linux-gnu g++-i686-linux-gnu;; \
x86_64) \
apt-get install -y gcc g++;; \
*) \
apt-get install -y gcc-${{matrix.arch}}-linux-gnu g++-${{matrix.arch}}-linux-gnu;; \
esac
pip install --break-system-packages -U xbstrap pyexpect meson
- name: Prepare directories
run: |
mkdir src/
mkdir src/mlibc/
mkdir build/
- name: Get libgcc-binaries
run: |
set -e
case "${{matrix.arch}}" in \
x86) \
wget -O /tmp/libgcc-${{matrix.arch}}.a https://github.com/osdev0/libgcc-binaries/raw/refs/heads/trunk/libgcc-i686.a;; \
*) \
wget -O /tmp/libgcc-${{matrix.arch}}.a https://github.com/osdev0/libgcc-binaries/raw/refs/heads/trunk/libgcc-${{matrix.arch}}.a;; \
esac
- name: Checkout
uses: actions/checkout@v2
with:
path: src/mlibc/
- name: Prepare src/
run: |
cp mlibc/ci/bootstrap.yml .
touch mlibc/checkedout.xbstrap
working-directory: src/
- name: Prepare build/
run: |
cat > bootstrap-site.yml << EOF
define_options:
arch: ${{matrix.arch}}
compiler: ${{matrix.compiler}}
EOF
xbstrap init ../src
working-directory: build/
- name: Build mlibc
run: 'xbstrap install ${{matrix.builds}}'
working-directory: build/
- name: Check public headers conform to ISO standards with pedantic warnings
if: ${{matrix.builds == 'mlibc-headers-only'}}
working-directory: build/
shell: bash
run: |
shopt -s globstar
GCC_ARCH="${{matrix.arch}}"
case "$GCC_ARCH" in
"x86")
GCC_ARCH="i686"
;;
esac
ALL_INCLUDES="-- -include\0%s\0 packages/${{matrix.builds}}/usr/include/**/*.h"
GCC_ARGS="-S /dev/null -o /dev/null -I packages/${{matrix.builds}}/usr/include -I packages/linux-headers/usr/include -nostdlib -Werror -Wpedantic -Wsystem-headers"
GCC_C_ARGS="$GCC_ARCH-linux-gnu-gcc -x c $GCC_ARGS"
GCC_CXX_ARGS="$GCC_ARCH-linux-gnu-g++ -x c++ $GCC_ARGS"
# For C89, exclude complex.h. We also exclude -Wlong-long because fixing it mostly involves adding
# __extension__ to a bunch of places (and musl doesn't even bother).
printf $ALL_INCLUDES | sed 's/complex.h/stdio.h/' | xargs -0 $GCC_C_ARGS -std=c89 -Wno-long-long
printf $ALL_INCLUDES | xargs -0 $GCC_C_ARGS -std=c99
printf $ALL_INCLUDES | xargs -0 $GCC_C_ARGS -std=c11
printf $ALL_INCLUDES | xargs -0 $GCC_CXX_ARGS -std=c++98 -Wno-long-long
printf $ALL_INCLUDES | xargs -0 $GCC_CXX_ARGS -std=c++11
printf $ALL_INCLUDES | xargs -0 $GCC_CXX_ARGS -std=c++14
printf $ALL_INCLUDES | xargs -0 $GCC_CXX_ARGS -std=c++17
- name: Test mlibc
run: 'meson test -v -C pkg-builds/${{matrix.builds}}'
working-directory: build/
compile-sysdeps:
strategy:
matrix:
sysdeps: [dripos, lemon, aero, ironclad, keyronex, managarm, vinix, astral, menix, nyaux]
name: Compile sysdeps
runs-on: ubuntu-latest
container: debian:sid
steps:
- name: Install prerequisites
run: |
apt-get update
apt-get install -y ninja-build qemu-user \
python3-setuptools python3-jsonschema \
python3-pip git rsync wget
pip install --break-system-packages -U xbstrap meson
- if: ${{ matrix.sysdeps == 'managarm' }}
name: Checkout bootstrap-managarm
uses: actions/checkout@v2
with:
repository: 'managarm/bootstrap-managarm'
path: src/
- name: Checkout
uses: actions/checkout@v2
with:
path: src/mlibc/
- if: ${{ matrix.sysdeps == 'managarm' }}
name: Clone managarm/managarm
uses: actions/checkout@v4
with:
repository: 'managarm/managarm'
path: 'src/mlibc/subprojects/managarm'
- if: ${{ matrix.sysdeps == 'managarm' }}
name: Clone managarm/bragi
uses: actions/checkout@v4
with:
repository: 'managarm/bragi'
path: 'src/mlibc/subprojects/bragi'
- if: ${{ matrix.sysdeps == 'managarm' }}
name: Install bragi
run: |
pip install --break-system-packages -U bragi
- name: Set up linux kernel headers
run: |
mkdir -p build/mlibc/
cp src/mlibc/ci/bootstrap.yml src/
(
cd build
xbstrap init ../src
xbstrap install linux-headers
)
- if: ${{ matrix.sysdeps == 'managarm' }}
name: Set up drm headers
run: |
xbstrap install libdrm-headers
ln -sv $(pwd)/packages/libdrm-headers/usr/src/libdrm-headers ../src/mlibc/subprojects/
working-directory: build/
- name: Get libgcc-binaries
run: |
set -e
wget -O /tmp/libgcc-x86_64.a https://github.com/osdev0/libgcc-binaries/raw/refs/heads/trunk/libgcc-x86_64.a
- name: Compile sysdeps
run: |
LDFLAGS="-Wl,/tmp/libgcc-x86_64.a" meson setup \
"-Dc_args=['-fno-stack-protector', '-U__linux__', '-Wno-error=maybe-uninitialized', '-D__${{matrix.sysdeps}}__']" \
"-Dcpp_args=['-fno-stack-protector', '-U__linux__', '-Wno-error=maybe-uninitialized', '-D__${{matrix.sysdeps}}__']" \
"-Dlibgcc_dependency=false" \
"-Duse_freestnd_hdrs=enabled" \
"-Dbuild_tests=true" \
"-Db_sanitize=undefined" \
"-Dlinux_kernel_headers=$(pwd)/packages/linux-headers/usr/include" \
--cross-file ../src/mlibc/ci/${{matrix.sysdeps}}.cross-file compile-${{matrix.sysdeps}} \
"../src/mlibc/"
ninja -C compile-${{matrix.sysdeps}}
working-directory: build/