-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (96 loc) · 3.11 KB
/
Copy pathci.yml
File metadata and controls
111 lines (96 loc) · 3.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
name: CI
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
env:
ZIG_VERSION: 0.14.0
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Zig
uses: mlugg/setup-zig@v1
with:
version: ${{ env.ZIG_VERSION }}
- name: Zig version
run: zig version
- name: Check compilation
run: zig build -Dtarget=x86-freestanding
continue-on-error: true
- name: Build kernel
run: |
mkdir -p build
zig build-exe -target x86-freestanding -femit-bin=build/system.bin init/main.zig --name system
build-boot:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y nasm gcc-multilib
- name: Build bootsect
run: nasm -f bin boot/bootsect.s -o build/bootsect.bin -l build/bootsect.lst
continue-on-error: true
- name: Build setup
run: nasm -f bin boot/setup.s -o build/setup.bin -l build/setup.lst
continue-on-error: true
- name: Build head
run: |
as --32 boot/head.s -o build/head.o
ld -m elf_i386 -Ttext 0x0 -s --oformat binary -e startup_32 build/head.o -o build/head.bin
continue-on-error: true
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Zig
uses: mlugg/setup-zig@v1
with:
version: ${{ env.ZIG_VERSION }}
- name: Check formatting
run: zig fmt --check .
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Zig
uses: mlugg/setup-zig@v1
with:
version: ${{ env.ZIG_VERSION }}
- name: Zig version
run: zig version
- name: Analyze
run: |
echo "=== File Structure ==="
find . -name "*.zig" | sort
echo "=== Assembly Files ==="
find . \( -name "*.s" -o -name "*.S" \) | sort
echo "=== Total Lines ==="
find . -name "*.zig" -exec cat {} + | wc -l
build-with-boot:
runs-on: ubuntu-latest
needs: [check, build-boot]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y nasm gcc-multilib
- name: Install Zig
uses: mlugg/setup-zig@v1
with:
version: ${{ env.ZIG_VERSION }}
- name: Full build
run: |
mkdir -p build
# Assemble bootloader
nasm -f bin boot/bootsect.s -o build/bootsect.bin
nasm -f bin boot/setup.s -o build/setup.bin
# Build kernel
zig build-exe -target x86-freestanding -femit-bin=build/system.bin init/main.zig --name system 2>&1 || true
# Combine into floppy image
dd if=/dev/zero of=build/image.img bs=512 count=2880
dd if=build/bootsect.bin of=build/image.img conv=notrunc
dd if=build/setup.bin of=build/image.img bs=512 seek=1 conv=notrunc
ls -la build/
continue-on-error: true