-
Notifications
You must be signed in to change notification settings - Fork 390
157 lines (137 loc) · 4.5 KB
/
Copy pathcontrol-plane.yml
File metadata and controls
157 lines (137 loc) · 4.5 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
name: Control Plane CI
on:
pull_request:
paths:
- 'control-plane/**'
- '.github/workflows/control-plane.yml'
push:
branches: [main]
paths:
- 'control-plane/**'
- '.github/workflows/control-plane.yml'
workflow_dispatch:
permissions:
contents: read
jobs:
linux-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25.x'
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: control-plane/web/client/package-lock.json
- name: Build control plane UI
working-directory: control-plane/web/client
run: |
npm ci
npm run build
- name: Build control plane
working-directory: control-plane
run: GOFLAGS=-buildvcs=false go build ./...
# NOTE: `go test` lives in .github/workflows/coverage.yml so we only
# run the control-plane suite once per PR. The coverage workflow is a
# required status check on main, so a test regression still blocks
# merge. This job continues to validate that the code *builds*, which
# is the contract the downstream compile-matrix job depends on.
- name: Lint
working-directory: control-plane
run: |
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
golangci-lint run
continue-on-error: true
compile-matrix:
runs-on: ubuntu-latest
needs: linux-tests
strategy:
fail-fast: false
matrix:
goos: [linux, darwin, windows]
goarch: [amd64]
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25.x'
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ matrix.goos }}-${{ matrix.goarch }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.goos }}-${{ matrix.goarch }}-
${{ runner.os }}-go-
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: control-plane/web/client/package-lock.json
- name: Build control plane UI
working-directory: control-plane/web/client
run: |
npm ci
npm run build
- name: Compile control plane binary
working-directory: control-plane
run: |
echo "Building for ${GOOS}/${GOARCH}"
go build -o /tmp/agentfield-server-${GOOS}-${GOARCH} ./cmd/agentfield-server
# The macOS menu-bar tray (cmd/af-tray) is darwin-only CGO code: the Linux
# jobs compile its !darwin stub and the CGO_ENABLED=0 matrix can't build it,
# so without this job a type error in tray_darwin.go would only surface at
# release time on the goreleaser macOS runner.
tray-darwin:
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25.x'
cache: true
cache-dependency-path: control-plane/go.sum
- name: Compile and vet the macOS tray
working-directory: control-plane
run: |
go build ./cmd/af-tray/
go vet ./cmd/af-tray/
# Summary job that depends on all critical checks
required-checks:
name: All Required Checks Passed
runs-on: ubuntu-latest
needs: [linux-tests, compile-matrix, tray-darwin]
if: always()
steps:
- name: Check all jobs
run: |
if [ "${{ needs.linux-tests.result }}" != "success" ] || [ "${{ needs.compile-matrix.result }}" != "success" ] || [ "${{ needs.tray-darwin.result }}" != "success" ]; then
echo "One or more required checks failed"
exit 1
fi
echo "All required checks passed successfully"