-
Notifications
You must be signed in to change notification settings - Fork 20
98 lines (87 loc) · 2.74 KB
/
pr-test.yml
File metadata and controls
98 lines (87 loc) · 2.74 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
name: PR Test
on:
push:
branches:
- main
pull_request:
merge_group:
permissions:
contents: read
jobs:
test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Run tests
run: go test ./...
generated-files-check:
name: Validate generated files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || '' }}
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Generate OpenAPI client
run: make generate-api
- name: Check OpenAPI client is up-to-date
run: |
if [ ! -z "$(git status --porcelain internal/api/client/)" ]; then
echo "::error ::OpenAPI client generation produced diff. Run 'make generate-api' and commit results."
git diff internal/api/client/
exit 1
fi
- name: Generate documentation
run: make generate-docs
- name: Check documentation is up-to-date
run: |
if [ ! -z "$(git status --porcelain docs/)" ]; then
echo "::error ::Documentation generation produced diff. Run 'make generate-docs' and commit results."
git diff docs/
exit 1
fi
- name: Generate schema
run: make generate-schema
- name: Check schema is up-to-date
run: |
if [ ! -z "$(git status --porcelain schema/)" ]; then
echo "::error ::Schema generation produced diff. Run 'make generate-schema' and commit results."
git diff schema/
exit 1
fi
- name: Final check for any uncommitted changes
run: |
if [ ! -z "$(git status --porcelain)" ]; then
echo "::error ::Generation produced uncommitted changes. Please run 'make generate' and commit all changes."
echo "Changed files:"
git status --porcelain
echo ""
echo "Diff:"
git diff
exit 1
fi
integration-tests:
name: 'Generator Integration Tests'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Run all integration tests with Dagger
uses: dagger/dagger-for-github@b81317a976cb7f7125469707321849737cd1b3bc # v7
with:
workdir: .
verb: run
args: go run ./test/integration/cmd/run.go
version: 'latest'