84 lines
2.3 KiB
YAML
84 lines
2.3 KiB
YAML
name: ci
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
# A CVE published after a merge is still our problem, so rescan daily.
|
|
schedule:
|
|
- cron: "0 4 * * *"
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
# A push supersedes the run of the commit before it, so drop that one instead of
|
|
# waiting for a verdict on code nobody has any more.
|
|
concurrency:
|
|
group: ci-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
go:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: actions/setup-go@v7
|
|
with:
|
|
go-version-file: go.mod
|
|
- run: gofmt -l cmd lib | tee /dev/stderr | (! read -r)
|
|
- run: go mod tidy -diff
|
|
- run: go vet ./...
|
|
- run: go test -race ./...
|
|
- run: make build
|
|
# Read from a plain file so the upstream-sync workflow can bump it without a
|
|
# token carrying the workflow scope.
|
|
- id: lint-version
|
|
run: echo "version=$(cat hack/golangci-lint.version)" >> "$GITHUB_OUTPUT"
|
|
- uses: golangci/golangci-lint-action@v9
|
|
with:
|
|
version: ${{ steps.lint-version.outputs.version }}
|
|
|
|
security:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
# Reachability-aware, so it only fails on vulnerabilities we actually call.
|
|
# It installs its own Go, hence no setup-go step; go-version-input must be
|
|
# cleared or it collides with go-version-file.
|
|
- uses: golang/govulncheck-action@v1.1.0
|
|
with:
|
|
repo-checkout: false
|
|
go-version-file: go.mod
|
|
go-version-input: ""
|
|
- uses: aquasecurity/trivy-action@v0.36.0
|
|
with:
|
|
scan-type: fs
|
|
scan-ref: .
|
|
scanners: vuln,secret
|
|
format: table
|
|
exit-code: "1"
|
|
ignore-unfixed: true
|
|
severity: CRITICAL,HIGH
|
|
|
|
image:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: docker/setup-buildx-action@v4
|
|
- uses: docker/build-push-action@v7
|
|
with:
|
|
context: .
|
|
push: false
|
|
load: true
|
|
tags: routingtabletowg:ci
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
- uses: aquasecurity/trivy-action@v0.36.0
|
|
with:
|
|
image-ref: routingtabletowg:ci
|
|
format: table
|
|
exit-code: "1"
|
|
ignore-unfixed: true
|
|
severity: CRITICAL,HIGH
|