-
Notifications
You must be signed in to change notification settings - Fork 65
148 lines (124 loc) · 4.36 KB
/
Copy pathgo-ci.yml
File metadata and controls
148 lines (124 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Go Build and Test
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
build-and-test:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
defaults:
run:
working-directory: ./
shell: bash # Forces Git Bash on Windows, standard Bash on Linux
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
lfs: true
- name: Setup Go Environment
uses: actions/setup-go@v6
with:
go-version: '1.26'
cache-dependency-path: go.sum
- name: Verify Module Dependencies
run: go mod verify
- name: Download Dependencies
run: go mod download
# Only build full Web UI on Linux to save time/resources on Windows
- name: Setup Node.js (for web UI build)
if: matrix.os == 'ubuntu-latest' && hashFiles('web/package.json') != ''
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: web/package-lock.json
- name: Build Web UI
if: matrix.os == 'ubuntu-latest' && hashFiles('web/package.json') != ''
working-directory: web
run: npm ci && npm run build
# Bash syntax works on Windows runners too
- name: Ensure web/dist exists (stub for go:embed)
run: |
if [ ! -f web/dist/index.html ]; then
mkdir -p web/dist
echo '<!doctype html><html><head><title>waza</title></head><body>placeholder</body></html>' > web/dist/index.html
echo '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y="80" font-size="80">w</text></svg>' > web/dist/favicon.svg
fi
- name: Format Check
if: matrix.os == 'ubuntu-latest'
run: |
if [ -n "$(gofmt -l .)" ]; then
echo "Go files must be formatted with gofmt:"
gofmt -l .
exit 1
fi
- name: Run Go Vet
run: go vet ./...
- name: Execute Tests
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
- name: Upload Coverage Report
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v7
with:
file: ./coverage.txt
flags: go-implementation
name: waza
- name: Build Binary
run: |
BINARY_NAME="waza"
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
BINARY_NAME="waza.exe"
fi
go build -v -o $BINARY_NAME ./cmd/waza
# Verify binary
chmod +x ./$BINARY_NAME
./$BINARY_NAME --version
- name: Integration Test
if: matrix.os == 'ubuntu-latest'
run: |
# Verify waza can load and execute an eval end-to-end with the
# mock executor. Exit code 1 = eval tasks failed (expected with
# mock output). Exit code >1 or signal = real crash — fail CI.
set +e
./waza run ./examples/code-explainer/eval.yaml --verbose
EXIT_CODE=$?
if [ $EXIT_CODE -gt 1 ]; then
echo "::error::waza crashed with exit code $EXIT_CODE"
exit $EXIT_CODE
fi
echo "Integration test completed (exit code: $EXIT_CODE)"
lint:
name: Lint
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
lfs: true
- name: Setup Go Environment
uses: actions/setup-go@v6
with:
go-version: '1.26'
# Required because golangci-lint might try to compile code that uses embed
- name: Ensure web/dist exists (stub for go:embed)
run: |
if [ ! -f web/dist/index.html ]; then
mkdir -p web/dist
echo '<!doctype html><html><head><title>waza</title></head><body>placeholder</body></html>' > web/dist/index.html
echo '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y="80" font-size="80">w</text></svg>' > web/dist/favicon.svg
fi
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.10.1
working-directory: ./
args: --timeout=5m