Repository navigation
109 lines (94 loc) · 3.38 KB
/
Copy pathci.yml
File metadata and controls
109 lines (94 loc) · 3.38 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
name: go
on:
push:
branches:
- main
pull_request:
jobs:
build:
strategy:
matrix:
goos: [darwin, linux, windows]
goarch: [amd64, arm64]
name: build ${{ matrix.goos }}/${{ matrix.goarch }}
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version: '1.26.5'
- run: go build ./...
env:
CGO_ENABLED: "0"
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
# sqlc's own tests: the end-to-end suite needs PostgreSQL and MySQL, which
# sqlc-test-setup installs on the runner.
test:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version: '1.26.5'
- name: install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: install sqlc-gen-test
run: go install github.com/sqlc-dev/sqlc-gen-test@v0.1.0
- name: install test-json-process-plugin
run: go install ./scripts/test-json-process-plugin/
- name: install ./...
run: go install ./...
env:
CGO_ENABLED: "0"
# A module of its own, so cgo stays on for the DuckDB driver the
# DuckDB golden imports.
- name: build internal/endtoend
run: go build ./...
working-directory: internal/endtoend/testdata
- name: install databases
run: go run ./cmd/sqlc-test-setup install postgresql mysql
- name: start databases
run: go run ./cmd/sqlc-test-setup start postgresql mysql
- name: test ./...
run: gotestsum --junitfile junit.xml -- --tags=examples -timeout 20m -failfast ./...
env:
CI_SQLC_PROJECT_ID: ${{ secrets.CI_SQLC_PROJECT_ID }}
CI_SQLC_AUTH_TOKEN: ${{ secrets.CI_SQLC_AUTH_TOKEN }}
SQLC_AUTH_TOKEN: ${{ secrets.CI_SQLC_AUTH_TOKEN }}
POSTGRESQL_SERVER_URI: "postgres://postgres:postgres@127.0.0.1:5432/postgres?sslmode=disable"
MYSQL_SERVER_URI: "root:mysecretpassword@tcp(127.0.0.1:3306)/mysql?multiStatements=true&parseTime=true"
CGO_ENABLED: "0"
# The examples run generated code against every database sqlc supports.
# They are a module of their own, so their drivers are not dependencies
# of sqlc, and cgo stays on for the DuckDB driver. sqlc-test-setup
# installs and starts every database on the runner.
examples:
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version: '1.26.5'
cache-dependency-path: |
go.sum
examples/go.sum
- name: install databases
run: go run ./cmd/sqlc-test-setup install
- name: start databases
run: go run ./cmd/sqlc-test-setup start
- name: test examples
run: go test --tags=examples -timeout 20m ./...
working-directory: examples
env:
POSTGRESQL_SERVER_URI: "postgres://postgres:postgres@127.0.0.1:5432/postgres?sslmode=disable"
MYSQL_SERVER_URI: "root:mysecretpassword@tcp(127.0.0.1:3306)/mysql?multiStatements=true&parseTime=true"
CLICKHOUSE_SERVER_URI: "clickhouse://default:mysecretpassword@127.0.0.1:9000"
MSSQL_SERVER_URI: "sqlserver://sa:Mysecretpassword1!@127.0.0.1:1433?encrypt=disable"
SPANNER_SERVER_URI: "localhost:15000"
vuln_check:
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- uses: golang/govulncheck-action@v1