jobs: # Fast feedback: this finishes in seconds, so it is not held behind the # suite. build: image: localhost/gitbay-ci:3 steps: - go build ./... - go vet ./... # The suite drives real git, ssh, sshd and gpg. Several tests skip # themselves when a tool is absent, so the prerequisites are asserted # first, all of them in one step so one run names everything to install. # A green check that quietly tested less is worse than a red one. # The 20m is under the runner's own 30m limit, so go times out first and # says which test hung instead of the runner killing it blind. test: image: localhost/gitbay-ci:3 steps: - missing=""; for t in git git-lfs gpg; do command -v "$t" >/dev/null || missing="$missing $t"; done; test -x /usr/sbin/sshd || missing="$missing sshd"; test -z "$missing" || { echo "runner is missing:$missing"; exit 1; } - go test ./... -count=1 -timeout 20m paths-ignore: - .gitbay/wiki/** # Static analysis through Qlty (.qlty/qlty.toml). Secrets and gofmt fail # the build. The full report, including radarlint-go's Sonar rules, is # printed without failing it. The CLI is pinned, and unpacked with Python # because this image has no xz. quality: image: localhost/gitbay-ci:3 steps: - curl -fsSL -o /tmp/qlty.tar.xz https://qlty-releases.s3.amazonaws.com/qlty/v0.661.0/qlty-x86_64-unknown-linux-gnu.tar.xz && python3 -c "import tarfile; tarfile.open('/tmp/qlty.tar.xz').extractall('/tmp', filter='data')" - QLTY_TELEMETRY=off /tmp/qlty-x86_64-unknown-linux-gnu/qlty check --all --no-progress --filter trufflehog,gofmt - QLTY_TELEMETRY=off /tmp/qlty-x86_64-unknown-linux-gnu/qlty check --all --no-progress --no-fail paths-ignore: - .gitbay/wiki/** # Vulnerability scanning, separate from test so a newly published advisory # against unchanged code does not mask a real test failure. It fails the # build on purpose: an advisory that only lands in a report nobody reads is # the state this replaced. @latest matches deploy/audit.sh, so a run scans # against the database as it is today, not as it was at commit time. # # Nightly rather than per-push, because that last sentence is the whole # job: the trigger is the advisory database, not the code. An advisory # published against code nobody touched was invisible until someone # happened to push, while a rebase that changed nothing re-scanned it. # A schedule asks the question on the cadence the answer changes. # `build trigger krz/gitbay vuln` runs it on demand before a release # (#177). vuln: image: localhost/gitbay-ci:3 schedule: "0 3 * * *" steps: - go run golang.org/x/vuln/cmd/govulncheck@latest ./... # osv-scanner also reports advisories in dependencies the code does not # call, which govulncheck skips. - curl -fsSL -o /tmp/qlty.tar.xz https://qlty-releases.s3.amazonaws.com/qlty/v0.661.0/qlty-x86_64-unknown-linux-gnu.tar.xz && python3 -c "import tarfile; tarfile.open('/tmp/qlty.tar.xz').extractall('/tmp', filter='data')" - QLTY_TELEMETRY=off /tmp/qlty-x86_64-unknown-linux-gnu/qlty check --all --no-progress --filter osv-scanner