-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (125 loc) · 5.11 KB
/
Copy pathci.yml
File metadata and controls
147 lines (125 loc) · 5.11 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
name: CI Build
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Avoid running multiple instances of this workflow simultaneously on the same branch,
# which can happen with multiple pushes or PRs.
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
cross-platform-build:
name: Build (${{ matrix.os }}, ${{ matrix.build-type }})
strategy:
matrix:
# Order: Most important platforms first (Ubuntu for CI, then Windows/macOS)
os: [ubuntu-latest, windows-latest, macos-latest]
# Order: Release first (production), then debug (development), then debug+symbols
build-type: [release, debug]
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
make clean analyze
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
integration-tests:
name: Integration Tests
needs: cross-platform-build # Ensure this runs after the build job
strategy:
matrix:
os: [ubuntu-latest] # Run tests on Ubuntu for CI, can add Windows/macOS later
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: |
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"