-
Notifications
You must be signed in to change notification settings - Fork 10
75 lines (62 loc) · 1.58 KB
/
Copy pathsdk-go.yml
File metadata and controls
75 lines (62 loc) · 1.58 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
name: Go SDK
on:
push:
branches: [ main, develop ]
paths:
- 'sdk/go/**'
- 'go.mod'
- 'go.sum'
- '.github/workflows/sdk-go.yml'
pull_request:
branches: [ main, develop ]
paths:
- 'sdk/go/**'
- 'go.mod'
- 'go.sum'
- '.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@v6
with:
go-version-file: go.mod
- name: Build
run: make sdk-go-build
- name: Test
run: make sdk-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@v6
with:
go-version-file: go.mod
- name: Install ogen
run: go install github.com/ogen-go/ogen/cmd/ogen@latest
- name: Regenerate SDK
run: make sdk-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