-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (113 loc) · 4.36 KB
/
build.yml
File metadata and controls
130 lines (113 loc) · 4.36 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
name: Build & Test
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
schedule:
- cron: "0 0 * * 0" # Weekly on Sunday
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
build-type: [debug, release, relwithdebinfo]
fail-fast: false # Don't cancel other jobs if one fails, to get full test coverage
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- name: Set up build environment
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
choco install mingw -y
elif [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get update
sudo apt-get install -y build-essential --no-install-recommends
sudo apt-get install pkg-config libglfw3-dev libgl1-mesa-dev xorg-dev -y
elif [ "$RUNNER_OS" == "macOS" ]; then
brew update
fi
shell: bash
- name: Cache build artifacts
uses: actions/cache@v4
with:
path: |
examples/task-manager/build/
examples/donut-basic/build/
key: ${{ runner.os }}-build-${{ matrix.build-type }}-${{ hashFiles('examples/task-manager/makefile', 'examples/task-manager/**/*.cpp', 'examples/donut-basic/makefile', 'examples/donut-basic/**/*.cpp') }}
restore-keys: |
${{ runner.os }}-build-${{ matrix.build-type }}-
- name: Build task-manager example (${{ matrix.build-type }})
run: |
cd examples/task-manager
if [ "$RUNNER_OS" = "macOS" ]; then
make BUILD_TYPE=${{ matrix.build-type }} CXX=clang++ clean all -j$(nproc 2>/dev/null || echo 4)
else
make BUILD_TYPE=${{ matrix.build-type }} clean all -j$(nproc 2>/dev/null || echo 4)
fi
shell: bash
- name: Build donut-basic example (${{ matrix.build-type }})
run: |
cd examples/donut-basic
if [ "$RUNNER_OS" = "macOS" ]; then
make BUILD_TYPE=${{ matrix.build-type }} CXX=clang++ clean all -j$(nproc 2>/dev/null || echo 4)
else
make BUILD_TYPE=${{ matrix.build-type }} clean all -j$(nproc 2>/dev/null || echo 4)
fi
shell: bash
- name: Generate assembly and disassembly
run: |
cd examples/task-manager
if [ "$RUNNER_OS" = "macOS" ]; then
make CXX=clang++ asm disassemble || true
else
make asm disassemble || true
fi
shell: bash
- name: Build task-manager with static analysis
if: matrix.build-type == 'debug' && runner.os == 'Linux'
run: |
cd examples/task-manager
if [ "$RUNNER_OS" = "macOS" ]; then
make clean CXX=clang++ analyze
else
make clean analyze
fi
shell: bash
- name: Check compilation
if: matrix.os == 'ubuntu-latest'
run: |
cd examples/task-manager
make BUILD_TYPE=debug WARN_LEVEL=normal clean all 2>&1 | tee build.log
# Count actual compilation errors (not warnings)
ERROR_COUNT=$(grep -c "error:" build.log || true)
if [ "$ERROR_COUNT" -gt 0 ]; then
echo "❌ Compilation errors found:"
grep "error:" build.log
exit 1
else
echo "✅ Build successful (warnings are allowed in CI)"
fi
shell: bash
test-examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up build environment
run: |
sudo apt-get update
sudo apt-get install -y build-essential --no-install-recommends
- name: Build task-manager example
run: |
cd examples/task-manager
make BUILD_TYPE=release clean all asm disassemble -j$(nproc)
- name: Build donut-basic example
run: |
cd examples/donut-basic
make BUILD_TYPE=release clean all -j$(nproc)
- name: Verify executables
run: |
[ -f "examples/task-manager/build/app/tm" ] || { echo "task-manager executable not found!"; exit 1; }
echo "✓ task-manager executable built successfully"
[ -f "examples/donut-basic/build/app/donut" ] || { echo "donut-basic executable not found!"; exit 1; }
echo "✓ donut-basic executable built successfully"