-
Notifications
You must be signed in to change notification settings - Fork 0
145 lines (125 loc) · 4.54 KB
/
ci.yml
File metadata and controls
145 lines (125 loc) · 4.54 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
name: ThunderOS CI
on:
push:
branches: [ main, 'dev/**', 'feature/**', 'release/**' ]
pull_request:
branches: [ main, 'dev/**' ]
jobs:
build-and-test:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image with caching
uses: docker/build-push-action@v5
with:
context: .
tags: thunderos-build:latest
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Verify toolchain in Docker
run: |
docker run --rm thunderos-build:latest riscv64-unknown-elf-gcc --version
docker run --rm thunderos-build:latest qemu-system-riscv64 --version
- name: Build kernel in Docker
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
thunderos-build:latest \
bash -c "make clean && make"
- name: Verify build artifacts
run: |
test -f build/thunderos.elf || (echo "thunderos.elf not found" && exit 1)
test -f build/thunderos.bin || (echo "thunderos.bin not found" && exit 1)
ls -lh build/thunderos.*
- name: Run QEMU boot test in Docker
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
thunderos-build:latest \
bash -c "timeout --foreground 8s make qemu > qemu_output.log 2>&1 || EXIT_CODE=\$?; \
if [ \"\${EXIT_CODE:-0}\" -ne 0 ] && [ \"\${EXIT_CODE:-0}\" -ne 124 ]; then \
echo 'ERROR: QEMU exited with unexpected code \$EXIT_CODE'; \
cat qemu_output.log; \
exit 1; \
fi"
# Display output for debugging
echo "=== QEMU Output ==="
cat qemu_output.log
echo "=== End Output ==="
# Check for boot loop (multiple initializations indicate crash/reboot)
BOOT_COUNT=$(grep -c "^Initializing\.\.\.$" qemu_output.log || echo 0)
if [ "$BOOT_COUNT" -gt 2 ]; then
echo "ERROR: Kernel is stuck in a boot loop (rebooted $BOOT_COUNT times)"
echo "This indicates a crash after initialization"
exit 1
fi
# Verify boot messages
if ! grep -q "ThunderOS\|Kernel" qemu_output.log; then
echo "ERROR: Boot messages not found"
exit 1
fi
# Check for successful initialization (PMM, Paging, or Process messages)
if ! grep -q "Process\|PMM\|Paging\|Scheduler\|Multitasking" qemu_output.log; then
echo "ERROR: Kernel initialization incomplete or process scheduling not working"
exit 1
fi
echo "✓ Boot test passed"
- name: Build tests
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
thunderos-build:latest \
bash -c "echo 'Tests are now built-in to kernel'"
- name: Run test suite
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
thunderos-build:latest \
bash -c "make test"
- name: Check for build warnings
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
thunderos-build:latest \
bash -c "make clean && make 2>&1 | tee build_warnings.log; \
if grep -i 'warning:' build_warnings.log; then \
echo '⚠ Build produced warnings (non-fatal)'; \
else \
echo '✓ Clean build with no warnings'; \
fi"
- name: Upload build artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: thunderos-build-${{ github.sha }}
path: |
build/thunderos.elf
build/thunderos.bin
retention-days: 7
- name: Upload test logs
if: always()
uses: actions/upload-artifact@v4
with:
name: test-logs-${{ github.sha }}
path: |
qemu_output.log
build_warnings.log
tests/outputs/test_results.log
retention-days: 7
- name: Report success
if: success()
run: |
echo "✅ All checks passed!"
echo "Kernel built successfully and boots correctly in QEMU"