Skip to content
This repository was archived by the owner on Feb 21, 2026. It is now read-only.

Commit 6f83980

Browse files
committed
setup ci
1 parent f6b9104 commit 6f83980

3 files changed

Lines changed: 268 additions & 6 deletions

File tree

.github/workflows/main.yml

Lines changed: 264 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,264 @@
1+
name: CMake on multiple platforms
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
build_ubuntu:
8+
runs-on: ubuntu-22.04
9+
strategy:
10+
matrix:
11+
build_type: [Release]
12+
c_compiler: [clang, gcc]
13+
include:
14+
- c_compiler: clang
15+
- c_compiler: gcc
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
submodules: recursive
20+
- name: Set reusable strings
21+
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
22+
id: strings
23+
shell: bash
24+
run: |
25+
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
26+
- name: Configure CMake
27+
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
28+
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
29+
run: >
30+
cmake -B ${{ steps.strings.outputs.build-output-dir }}
31+
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
32+
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
33+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
34+
-S ${{ github.workspace }}
35+
- name: Build
36+
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
37+
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
38+
- name: Run
39+
run: |
40+
mkdir -p output/linux_x64_${{ matrix.c_compiler }}
41+
${{ steps.strings.outputs.build-output-dir }}/dmath_test
42+
cp ${{ github.workspace }}/case_result.txt output/linux_x64_${{ matrix.c_compiler }}
43+
- uses: actions/upload-artifact@v4
44+
with:
45+
name: linux_x64_${{ matrix.c_compiler }}
46+
path: output
47+
48+
build_ubuntu_multiarch:
49+
runs-on: ubuntu-22.04
50+
strategy:
51+
matrix:
52+
build_type: [Release]
53+
arch: [x86, aarch64, armv7]
54+
c_compiler: [clang, gcc]
55+
include:
56+
- arch: x86
57+
c_compiler: clang
58+
- arch: x86
59+
c_compiler: gcc
60+
- arch: aarch64
61+
c_compiler: clang
62+
- arch: aarch64
63+
c_compiler: gcc
64+
- arch: armv7
65+
c_compiler: clang
66+
- arch: armv7
67+
c_compiler: gcc
68+
steps:
69+
- uses: actions/checkout@v4
70+
with:
71+
submodules: recursive
72+
- name: Setup Alpine Linux for ${{ matrix.arch }}
73+
uses: jirutka/setup-alpine@v1
74+
with:
75+
arch: ${{ matrix.arch }}
76+
packages: gcc make cmake libc-dev linux-headers python3
77+
- name: Set reusable strings
78+
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
79+
id: strings
80+
shell: bash
81+
run: |
82+
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
83+
- name: Configure CMake
84+
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
85+
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
86+
run: >
87+
cmake -B ${{ steps.strings.outputs.build-output-dir }}
88+
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
89+
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
90+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
91+
-S ${{ github.workspace }}
92+
- name: Build
93+
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
94+
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
95+
- name: Run
96+
run: ${{ steps.strings.outputs.build-output-dir }}/dmath_test
97+
- name: Run
98+
run: |
99+
mkdir -p output/linux_${{ matrix.arch }}_${{ matrix.c_compiler }}
100+
${{ steps.strings.outputs.build-output-dir }}/dmath_test
101+
cp ${{ github.workspace }}/case_result.txt output/linux_${{ matrix.arch }}_${{ matrix.c_compiler }}
102+
- uses: actions/upload-artifact@v4
103+
with:
104+
name: linux_${{ matrix.arch }}_${{ matrix.c_compiler }}
105+
path: output
106+
107+
build_macos:
108+
runs-on: macos-14
109+
strategy:
110+
matrix:
111+
build_type: [Release]
112+
c_compiler: [clang]
113+
steps:
114+
- uses: actions/checkout@v4
115+
with:
116+
submodules: recursive
117+
- name: Set reusable strings
118+
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
119+
id: strings
120+
shell: bash
121+
run: |
122+
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
123+
- name: Configure CMake
124+
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
125+
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
126+
run: >
127+
cmake -B ${{ steps.strings.outputs.build-output-dir }}
128+
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
129+
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
130+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
131+
-S ${{ github.workspace }}
132+
- name: Build
133+
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
134+
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
135+
- name: Run
136+
run: |
137+
mkdir -p output/macos_${{ matrix.c_compiler }}
138+
${{ steps.strings.outputs.build-output-dir }}/dmath_test
139+
cp ${{ github.workspace }}/case_result.txt output/macos_${{ matrix.c_compiler }}
140+
- uses: actions/upload-artifact@v4
141+
with:
142+
name: macos_${{ matrix.c_compiler }}
143+
path: output
144+
145+
build_win32:
146+
runs-on: windows-2022
147+
strategy:
148+
matrix:
149+
build_type: [Release]
150+
c_compiler: [cl]
151+
cpp_compiler: [cl]
152+
steps:
153+
- uses: actions/checkout@v4
154+
with:
155+
submodules: recursive
156+
- name: Set reusable strings
157+
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
158+
id: strings
159+
shell: bash
160+
run: |
161+
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
162+
- name: Configure CMake
163+
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
164+
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
165+
run: >
166+
cmake -B ${{ steps.strings.outputs.build-output-dir }}
167+
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
168+
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
169+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
170+
-S ${{ github.workspace }}
171+
- name: Build
172+
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
173+
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
174+
- name: Run
175+
run: |
176+
mkdir -p output/win32_${{ matrix.c_compiler }}
177+
${{ steps.strings.outputs.build-output-dir }}/${{ matrix.build_type }}/dmath_test.exe
178+
cp ${{ github.workspace }}/case_result.txt output/win32_${{ matrix.c_compiler }}
179+
- uses: actions/upload-artifact@v4
180+
with:
181+
name: win32_${{ matrix.c_compiler }}
182+
path: output
183+
merge:
184+
runs-on: ubuntu-22.04
185+
needs: [build_ubuntu, build_ubuntu_multiarch, build_macos, build_win32]
186+
steps:
187+
- uses: actions/checkout@v4
188+
with:
189+
submodules: recursive
190+
- name: "Create output directory"
191+
run: |
192+
mkdir output
193+
mkdir output/all-in-one
194+
195+
- name: "Merge win32"
196+
uses: actions/download-artifact@v4.1.7
197+
with:
198+
name: win32_cl
199+
path: ${{ github.workspace }}/output/all-in-one
200+
201+
- name: "Merge macos"
202+
uses: actions/download-artifact@v4.1.7
203+
with:
204+
name: macos_clang
205+
path: ${{ github.workspace }}/output/all-in-one
206+
207+
- name: "Merge linux_x64_clang"
208+
uses: actions/download-artifact@v4.1.7
209+
with:
210+
name: linux_x64_clang
211+
path: ${{ github.workspace }}/output/all-in-one
212+
213+
- name: "Merge linux_x64_gcc"
214+
uses: actions/download-artifact@v4.1.7
215+
with:
216+
name: linux_x64_gcc
217+
path: ${{ github.workspace }}/output/all-in-one
218+
219+
- name: "Merge linux_x86_gcc"
220+
uses: actions/download-artifact@v4.1.7
221+
with:
222+
name: linux_x86_gcc
223+
path: ${{ github.workspace }}/output/all-in-one
224+
225+
- name: "Merge linux_aarch64_gcc"
226+
uses: actions/download-artifact@v4.1.7
227+
with:
228+
name: linux_aarch64_gcc
229+
path: ${{ github.workspace }}/output/all-in-one
230+
231+
- name: "Merge linux_armv7_gcc"
232+
uses: actions/download-artifact@v4.1.7
233+
with:
234+
name: linux_armv7_gcc
235+
path: ${{ github.workspace }}/output/all-in-one
236+
237+
- name: "Merge linux_x86_clang"
238+
uses: actions/download-artifact@v4.1.7
239+
with:
240+
name: linux_x86_clang
241+
path: ${{ github.workspace }}/output/all-in-one
242+
243+
- name: "Merge linux_aarch64_clang"
244+
uses: actions/download-artifact@v4.1.7
245+
with:
246+
name: linux_aarch64_clang
247+
path: ${{ github.workspace }}/output/all-in-one
248+
249+
- name: "Merge linux_armv7_clang"
250+
uses: actions/download-artifact@v4.1.7
251+
with:
252+
name: linux_armv7_clang
253+
path: ${{ github.workspace }}/output/all-in-one
254+
255+
- name: "Compare artifacts"
256+
run: |
257+
pip install pandas
258+
python scripts/all-in-one.py ${{ github.workspace }}/output
259+
260+
- name: "Upload merged artifact"
261+
uses: actions/upload-artifact@v4.3.3
262+
with:
263+
name: all-in-one
264+
path: ${{ github.workspace }}/output

compile_flags.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
-Iinclude/common
22
-Iinclude/win32
3-
-Imusl
4-
-D_XOPEN_SOURCE=700

include/linux/bits/stdint.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#pragma once
22

33
#if defined(__x86_64__) || defined(_M_X64)
4-
#include "../../../arch/x86_64/bits/stdint.h"
4+
#include "../../../musl/arch/x86_64/bits/stdint.h"
55
#elif defined(__i386__) || defined(_M_IX86)
6-
#include "../../../arch/i386/bits/stdint.h"
6+
#include "../../../musl/arch/i386/bits/stdint.h"
77
#elif defined(__x32__)
8-
#include "../../../arch/x32/bits/stdint.h"
8+
#include "../../../musl/arch/x32/bits/stdint.h"
99
#elif defined(__aarch64__)
1010
#include "../../../musl/arch/aarch64/bits/stdint.h"
1111
#elif defined(__arm__)
12-
#include "../../../arch/arm/bits/stdint.h"
12+
#include "../../../musl/arch/arm/bits/stdint.h"
1313
#else
1414
#error "Unsupported architecture"
1515
#endif

0 commit comments

Comments
 (0)