Pass context correctly #37
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
jobs: | |
matrix-build: | |
strategy: | |
matrix: | |
go: ["1.21", "1.22"] | |
db: ["7.1.26", "8.27.0"] | |
env: | |
DEFAULT_GO: "1.22" | |
DEFAULT_DB: "8.27.0" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-go-${{ matrix.go }}-db-${{ matrix.db }} | |
cancel-in-progress: true | |
name: Build with go version ${{ matrix.go }} and db ${{ matrix.db }} | |
runs-on: ubuntu-20.04 | |
defaults: | |
run: | |
shell: "bash" | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
id: go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
cache: true | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: v1.59.1 | |
skip-cache: true # Caching already done by actions/cache | |
- name: Enable testcontainer reuse | |
run: echo 'testcontainers.reuse.enable=true' > "$HOME/.testcontainers.properties" | |
- name: Go build | |
run: | | |
go clean | |
go build | |
go build ./... | |
- name: Go test -short | |
run: go test -v -count 1 -short ./... | |
- name: Go test with Exasol version ${{ matrix.db }} | |
env: | |
DB_VERSION: ${{ matrix.db }} | |
run: go test -v -p 1 -count 1 -coverprofile=coverage.out ./... | |
- name: SonarCloud Scan | |
if: matrix.go == env.DEFAULT_GO && matrix.db == env.DEFAULT_DB && github.repository_owner == 'exasol' && env.SONAR_TOKEN != null | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
- name: Run vulnerability check | |
if: matrix.go == env.DEFAULT_GO && matrix.db == env.DEFAULT_DB | |
run: | | |
go install golang.org/x/vuln/cmd/govulncheck@latest | |
govulncheck -version | |
govulncheck -format text -mode source -scan symbol -show verbose -test ./... | |
build: | |
needs: matrix-build | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "Build successful" |