.gitbay/ci.yml
56 lines · 3485 bytes
1jobs:
2 # Fast feedback: this finishes in seconds, so it is not held behind the
3 # suite.
4 build:
5 image: localhost/gitbay-ci:3
6 steps:
7 - go build ./...
8 - go vet ./...
9 # The suite drives real git, ssh, sshd and gpg. Several tests skip
10 # themselves when a tool is absent, so the prerequisites are asserted
11 # first, all of them in one step so one run names everything to install.
12 # A green check that quietly tested less is worse than a red one.
13 # The 20m is under the runner's own 30m limit, so go times out first and
14 # says which test hung instead of the runner killing it blind.
15 test:
16 image: localhost/gitbay-ci:3
17 steps:
18 - 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; }
19 - go test ./... -count=1 -timeout 20m
20 paths-ignore:
21 - .gitbay/wiki/**
22 # Static analysis through Qlty (.qlty/qlty.toml). Secrets and gofmt fail
23 # the build. The full report, including radarlint-go's Sonar rules, is
24 # printed without failing it. The CLI is pinned and checked against the
25 # sha256 Qlty publishes beside it, and unpacked with Python because this
26 # image has no xz.
27 quality:
28 image: localhost/gitbay-ci:3
29 steps:
30 - 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 && echo "fa07eb51fbb32a0854113e81ce2d957b73f1c027c58b478d32c233b6aba7a977 /tmp/qlty.tar.xz" | sha256sum -c - && python3 -c "import tarfile; tarfile.open('/tmp/qlty.tar.xz').extractall('/tmp', filter='data')"
31 - QLTY_TELEMETRY=off /tmp/qlty-x86_64-unknown-linux-gnu/qlty check --all --no-progress --filter trufflehog,gofmt
32 - QLTY_TELEMETRY=off /tmp/qlty-x86_64-unknown-linux-gnu/qlty check --all --no-progress --no-fail
33 paths-ignore:
34 - .gitbay/wiki/**
35 # Vulnerability scanning, separate from test so a newly published advisory
36 # against unchanged code does not mask a real test failure. It fails the
37 # build on purpose: an advisory that only lands in a report nobody reads is
38 # the state this replaced. @latest matches deploy/audit.sh, so a run scans
39 # against the database as it is today, not as it was at commit time.
40 #
41 # Nightly rather than per-push, because that last sentence is the whole
42 # job: the trigger is the advisory database, not the code. An advisory
43 # published against code nobody touched was invisible until someone
44 # happened to push, while a rebase that changed nothing re-scanned it.
45 # A schedule asks the question on the cadence the answer changes.
46 # `build trigger krz/gitbay vuln` runs it on demand before a release
47 # (#177).
48 vuln:
49 image: localhost/gitbay-ci:3
50 schedule: "0 3 * * *"
51 steps:
52 - go run golang.org/x/vuln/cmd/govulncheck@latest ./...
53 # osv-scanner also reports advisories in dependencies the code does not
54 # call, which govulncheck skips.
55 - 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 && echo "fa07eb51fbb32a0854113e81ce2d957b73f1c027c58b478d32c233b6aba7a977 /tmp/qlty.tar.xz" | sha256sum -c - && python3 -c "import tarfile; tarfile.open('/tmp/qlty.tar.xz').extractall('/tmp', filter='data')"
56 - QLTY_TELEMETRY=off /tmp/qlty-x86_64-unknown-linux-gnu/qlty check --all --no-progress --filter osv-scanner