Skip to content

Use Go 1.22 in ci.yml (#3369) #5024

Use Go 1.22 in ci.yml (#3369)

Use Go 1.22 in ci.yml (#3369) #5024

Workflow file for this run

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: '1.22.3'
- 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 ./...
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.22.3'
- run: go install golang.org/x/vuln/cmd/govulncheck@latest
- run: govulncheck ./...