1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- name: go
- on:
- push:
- branches:
- - main
- pull_request:
- jobs:
- test:
- strategy:
- matrix:
- # Disabling windows builds while we figure out why they're broken
- # os: [ubuntu-latest, macos-latest, windows-latest]
- os: [ubuntu-latest, macos-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.8'
- - 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.8'
- - run: go install golang.org/x/vuln/cmd/govulncheck@latest
- - run: govulncheck ./...
|