-
Notifications
You must be signed in to change notification settings - Fork 1
188 lines (152 loc) · 4.86 KB
/
Copy pathci.yml
File metadata and controls
188 lines (152 loc) · 4.86 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
test:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
defaults:
run:
working-directory: packages/zig
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Setup project dependencies with Pantry
uses: pantry-pm/pantry/packages/action@v0.11.28
- name: Build
run: zig build -Doptimize=ReleaseSafe
- name: Run tests
run: zig build test
- name: Check formatting
run: zig fmt --check src/
build-docker:
name: Build Docker Image
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup project dependencies with Pantry
uses: pantry-pm/pantry/packages/action@v0.11.28
- name: Install workspace dependencies
run: bun install --frozen-lockfile
# The Docker context is packages/zig only and webmail_dist is gitignored,
# so render the webmail bundle on the runner first; the image build then
# embeds the pre-rendered dist (no bun inside the image).
- name: Build webmail bundle
working-directory: packages/webmail
run: bun run build
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: ./packages/zig
push: false
tags: mail:test
cache-from: type=gha
cache-to: type=gha,mode=max
lint:
name: Lint
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/zig
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup project dependencies with Pantry
uses: pantry-pm/pantry/packages/action@v0.11.28
- name: Check formatting
run: zig fmt --check src/
- name: Install workspace dependencies
working-directory: ${{ github.workspace }}
run: bun install --frozen-lockfile
# Guards the release flow: the preflight suite asserts every manifest bumpx
# rewrites is still on the same version, so drift fails a PR instead of
# silently shipping a stale package at release time.
- name: Test release scripts
working-directory: ${{ github.workspace }}
run: bun test scripts
- name: Static analysis (future)
run: echo "Static analysis placeholder"
coverage:
name: Code Coverage
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/zig
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Setup project dependencies with Pantry
uses: pantry-pm/pantry/packages/action@v0.11.28
- name: Install coverage dependencies
working-directory: ${{ github.workspace }}
run: |
sudo apt-get update
sudo apt-get install -y binutils-dev libdw-dev
- name: Install kcov from source
working-directory: ${{ github.workspace }}
run: |
KCOV_VERSION=42
wget -q https://github.com/SimonKagstrom/kcov/releases/download/v${KCOV_VERSION}/kcov-amd64.tar.gz
tar xzf kcov-amd64.tar.gz
sudo cp usr/local/bin/kcov /usr/local/bin/
rm -rf usr kcov-amd64.tar.gz
- name: Build with debug info
run: zig build -Doptimize=Debug
- name: Run tests with coverage
run: |
mkdir -p coverage
kcov --include-pattern=src/ coverage/ zig build test 2>/dev/null || true
- name: Generate coverage report
run: |
if [ -d "coverage" ]; then
echo "Coverage report generated"
ls -la coverage/
fi
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
directory: ./packages/zig/coverage
fail_ci_if_error: false
verbose: true
benchmark:
name: Performance Benchmarks
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
defaults:
run:
working-directory: packages/zig
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Setup project dependencies with Pantry
uses: pantry-pm/pantry/packages/action@v0.11.28
- name: Build release
run: zig build -Doptimize=ReleaseFast
- name: Run benchmarks
run: |
if [ -f "zig-out/bin/benchmark" ]; then
./zig-out/bin/benchmark --json > benchmark-results.json
else
echo '{"note": "benchmark binary not found"}' > benchmark-results.json
fi
- name: Upload benchmark results
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: packages/zig/benchmark-results.json