-
Notifications
You must be signed in to change notification settings - Fork 10
78 lines (65 loc) · 1.77 KB
/
Copy pathsdk-go.yml
File metadata and controls
78 lines (65 loc) · 1.77 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
name: Go SDK
on:
push:
branches: [ main, develop ]
paths:
- 'sdk/go/**'
- 'sdk/go/openapi.json'
- '.github/workflows/sdk-go.yml'
pull_request:
branches: [ main, develop ]
paths:
- 'sdk/go/**'
- 'sdk/go/openapi.json'
- '.github/workflows/sdk-go.yml'
schedule:
- cron: '0 2 * * *'
permissions:
contents: read
jobs:
build-and-test:
name: Go SDK Build & Test
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: sdk/go/go.mod
cache-dependency-path: sdk/go/go.sum
- name: Build
working-directory: sdk/go
run: go build ./...
- name: Test
working-directory: sdk/go
run: go test ./...
check-drift:
name: Check Generated Code Drift
runs-on: ubuntu-latest
permissions:
contents: read
# Only run drift check when openapi.json changes
if: github.event_name == 'pull_request'
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: sdk/go/go.mod
cache-dependency-path: sdk/go/go.sum
- name: Install ogen
run: go install github.com/ogen-go/ogen/cmd/ogen@latest
- name: Regenerate SDK
working-directory: sdk/go
run: go generate ./...
- name: Check for drift
run: |
if ! git diff --exit-code sdk/go/; then
echo "Generated Go SDK code is out of sync with openapi.json."
echo "Run 'cd sdk/go && go generate ./...' and commit the result."
exit 1
fi