forked from wesm/agentsview
-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (120 loc) · 4.15 KB
/
ci.yml
File metadata and controls
147 lines (120 loc) · 4.15 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version-file: go.mod
- name: Stub frontend embed dir
run: mkdir -p internal/web/dist && echo ok > internal/web/dist/stub.html
- uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
with:
version: v2.10.1
test:
name: Go Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version-file: go.mod
- name: Setup MinGW (Windows)
if: runner.os == 'Windows'
uses: msys2/setup-msys2@4f806de0a5a7294ffabaff804b38a9b435a73bda # v2
with:
msystem: MINGW64
update: false
install: mingw-w64-x86_64-gcc
path-type: inherit
- name: Stub frontend embed dir
run: mkdir -p internal/web/dist && echo ok > internal/web/dist/stub.html
- name: Run Go tests
run: go test -tags fts5 ./... -v -count=1
env:
CGO_ENABLED: "1"
- name: Run Go tests (race detector)
if: runner.os == 'Linux'
run: go test -tags fts5 -race ./... -count=1
env:
CGO_ENABLED: "1"
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version-file: go.mod
- name: Stub frontend embed dir
run: mkdir -p internal/web/dist && echo ok > internal/web/dist/stub.html
- name: Test with coverage
run: go test -tags fts5 -race -coverprofile=coverage.out ./...
env:
CGO_ENABLED: "1"
- name: Upload coverage
id: codecov
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
files: coverage.out
continue-on-error: true
- name: Warn on coverage upload failure
if: steps.codecov.outcome == 'failure'
run: echo "::warning::Codecov upload failed"
e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version-file: go.mod
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: "24"
- name: Install frontend dependencies
run: npm ci
working-directory: frontend
- name: Build frontend
run: npm run build
working-directory: frontend
- name: Embed frontend in Go source tree
run: |
rm -rf internal/web/dist
cp -r frontend/dist internal/web/dist
- name: Pre-build Go binaries
run: |
CGO_ENABLED=1 go build -tags fts5 \
-o /tmp/testfixture ./cmd/testfixture
CGO_ENABLED=1 go build -tags fts5 \
-o /tmp/agentsview ./cmd/agentsview
env:
CGO_ENABLED: "1"
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium
working-directory: frontend
- name: Run E2E tests
run: npx playwright test
working-directory: frontend
env:
E2E_PREBUILT_FIXTURE: /tmp/testfixture
E2E_PREBUILT_SERVER: /tmp/agentsview