-
Notifications
You must be signed in to change notification settings - Fork 0
224 lines (181 loc) · 5.94 KB
/
Copy pathci.yml
File metadata and controls
224 lines (181 loc) · 5.94 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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: ['1.26.x']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: true
- name: Download dependencies
run: go mod download
- name: Verify dependencies
run: go mod verify
- name: Install toolchain dependencies
shell: bash
run: |
echo "Installing validator toolchains..."
# Install buf
if [[ "${{ runner.os }}" == "Windows" ]]; then
mkdir -p "$HOME/bin"
curl -sSL "https://github.com/bufbuild/buf/releases/download/v1.66.1/buf-Windows-x86_64.exe" -o "$HOME/bin/buf.exe"
chmod +x "$HOME/bin/buf.exe"
echo "$HOME/bin" >> $GITHUB_PATH
elif [[ "${{ runner.os }}" == "macOS" ]]; then
curl -sSL "https://github.com/bufbuild/buf/releases/download/v1.66.1/buf-Darwin-arm64" -o /tmp/buf
chmod +x /tmp/buf
sudo mv /tmp/buf /usr/local/bin/buf
else
curl -sSL "https://github.com/bufbuild/buf/releases/download/v1.66.1/buf-Linux-x86_64" -o /tmp/buf
chmod +x /tmp/buf
sudo mv /tmp/buf /usr/local/bin/buf
fi
# Install spectral (Node.js based) - latest version fixes deprecation warnings
npm install -g @stoplight/spectral-cli@6.15.0
# Install oasdiff using go install (latest stable version)
go install github.com/oasdiff/oasdiff@v1.11.7
# Verify installations
echo "Verifying tool installations..."
buf --version || echo "buf not found"
spectral --version || echo "spectral not found"
oasdiff --help | head -1 || echo "oasdiff not found"
- name: Build binary
shell: bash
run: |
mkdir -p ./bin
if [[ "${{ runner.os }}" == "Windows" ]]; then
echo "Building for Windows..."
go build -o ./bin/apx.exe ./cmd/apx
echo "Binary built. Checking if it exists:"
ls -la ./bin/
echo "Verifying binary works:"
./bin/apx.exe --version || echo "Binary execution failed"
else
echo "Building for Unix-like system..."
go build -o ./bin/apx ./cmd/apx
echo "Binary built. Checking if it exists:"
ls -la ./bin/
echo "Verifying binary works:"
./bin/apx --version || echo "Binary execution failed"
fi
- name: Run tests
env:
CI: "1"
NO_COLOR: "1"
run: go test ./... -race -count=1 -coverprofile=coverage.out
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.26.x'
uses: codecov/codecov-action@v3
with:
file: ./coverage.out
flags: unittests
name: codecov-umbrella
enforce-principles:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.26.x
- name: Enforce coding principles
run: make enforce-principles
integration-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.26.x
- name: Run integration tests
run: make integration-tests
e2e-tests:
runs-on: ubuntu-latest
timeout-minutes: 15
env:
K3D_VERSION: v5.8.3
KUBECTL_VERSION: v1.32.3
BUF_VERSION: v1.66.1
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.26.x
cache: true
- name: Cache E2E tool binaries
id: cache-e2e-tools
uses: actions/cache@v4
with:
path: |
~/.local/bin/k3d
~/.local/bin/kubectl
~/.local/bin/buf
key: e2e-tools-linux-amd64-k3d${{ env.K3D_VERSION }}-kubectl${{ env.KUBECTL_VERSION }}-buf${{ env.BUF_VERSION }}
- name: Install E2E dependencies
if: steps.cache-e2e-tools.outputs.cache-hit != 'true'
run: |
mkdir -p ~/.local/bin
# Install k3d
curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=${{ env.K3D_VERSION }} bash
cp /usr/local/bin/k3d ~/.local/bin/k3d
# Install kubectl
curl -LO "https://dl.k8s.io/release/${{ env.KUBECTL_VERSION }}/bin/linux/amd64/kubectl"
chmod +x kubectl && mv kubectl ~/.local/bin/kubectl
# Install buf
curl -sSL "https://github.com/bufbuild/buf/releases/download/${{ env.BUF_VERSION }}/buf-Linux-x86_64" -o ~/.local/bin/buf
chmod +x ~/.local/bin/buf
- name: Add tools to PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Verify tools
run: |
k3d version
kubectl version --client
buf --version
- name: Build APX binary
run: |
mkdir -p ./bin
go build -o ./bin/apx ./cmd/apx
- name: Run E2E tests
env:
CI: "1"
NO_COLOR: "1"
APX_DISABLE_TTY: "1"
run: make test-e2e
- name: Cleanup E2E resources
if: always()
run: make clean-e2e
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.26.x
- name: Run go vet
run: go vet ./...
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.26.x
- name: Run Go Vulnerability Check
uses: golang/govulncheck-action@v1