-
Notifications
You must be signed in to change notification settings - Fork 804
84 lines (74 loc) · 2.31 KB
/
ci.yml
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
name: go
on:
push:
branches:
- main
pull_request:
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
cgo: ['1', '0']
# Workaround no native support for conditional matrix items
# https://github.com/orgs/community/discussions/26253#discussioncomment-6745038
isMain:
- ${{ github.ref == 'refs/heads/main' }}
exclude:
- isMain: false
include:
- os: ubuntu-latest
cgo: '1'
- os: ubuntu-latest
cgo: '0'
name: test ${{ matrix.os }} cgo=${{ matrix.cgo }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
- name: install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: install sqlc-gen-test
run: go install github.com/sqlc-dev/[email protected]
- name: install ./...
run: go install ./...
env:
CGO_ENABLED: ${{ matrix.cgo }}
- name: build internal/endtoend
run: go build ./...
working-directory: internal/endtoend/testdata
env:
CGO_ENABLED: ${{ matrix.cgo }}
# Start a PostgreSQL server
- uses: sqlc-dev/action-setup-postgres@master
with:
postgres-version: "16"
id: postgres
# Start a MySQL server
- uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: "8.1"
- name: test ./...
run: gotestsum --junitfile junit.xml -- --tags=examples -timeout 20m ./...
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 }}
MYSQL_SERVER_URI: root:@tcp(localhost:3306)/mysql?multiStatements=true&parseTime=true
POSTGRESQL_SERVER_URI: ${{ steps.postgres.outputs.connection-uri }}?sslmode=disable
CGO_ENABLED: ${{ matrix.cgo }}
vuln_check:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.21.9'
# go-version-file: go.mod
# check-latest: true
- run: go install golang.org/x/vuln/cmd/govulncheck@latest
- run: govulncheck ./...