Code scanning - main #84 #84
This file contains hidden or 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: Code scanning | |
| run-name: "Code scanning - ${{ github.event.pull_request.title || format('{0} #{1}', github.ref_name, github.run_number) }}" | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| security-events: write | |
| jobs: | |
| golangci-lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Lint | |
| uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.0.2 | |
| with: | |
| version: v2.11.2 | |
| args: | | |
| --output.sarif.path golangci-lint-report.sarif | |
| - name: Upload linting SARIF | |
| uses: github/codeql-action/upload-sarif@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # v4.37.7 | |
| with: | |
| sarif_file: golangci-lint-report.sarif | |
| govulncheck: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Set up Golang | |
| uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | |
| with: | |
| go-version-file: tools/go.mod | |
| cache: false | |
| - name: Compute build cache key | |
| id: build-cache-key | |
| run: | | |
| checksum=$( | |
| { | |
| cat tools/go.mod tools/go.sum Makefile | |
| find . -type f -name '*.go' \ | |
| -not -path './tools/*' \ | |
| -print0 | sort -z | xargs -0 cat | |
| } | md5sum | awk '{print $1}' | |
| ) | |
| echo "checksum=$checksum" >> "$GITHUB_OUTPUT" | |
| - name: Cache Go module cache | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: ~/go/pkg/mod | |
| key: govulncheck-go-mod-${{ runner.os }}-${{ hashFiles('tools/go.sum') }} | |
| - name: Cache Go build cache | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: ~/.cache/go-build | |
| key: govulncheck-go-build-${{ runner.os }}-${{ steps.build-cache-key.outputs.checksum }} | |
| restore-keys: | | |
| govulncheck-go-build-${{ runner.os }}- | |
| - name: Run vulnerability scan | |
| run: make static-analysis/vulncheck/sarif | |
| - name: Upload vulnerability SARIF | |
| if: always() | |
| uses: github/codeql-action/upload-sarif@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # v4.37.7 | |
| with: | |
| sarif_file: build/govulncheck-report.sarif |