notcrawl/.github/workflows/ci.yml
2026-05-05 19:29:37 -07:00

129 lines
3.1 KiB
YAML

name: CI
on:
pull_request:
push:
branches:
- main
- feat/use-crawlkit
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
jobs:
deps:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
- name: Verify module cache
run: go mod verify
- name: Check go.mod tidy
run: |
go mod tidy
git diff --exit-code -- go.mod go.sum
- name: Install govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@v1.3.0
- name: Run govulncheck
run: '"$(go env GOPATH)/bin/govulncheck" ./...'
lint:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
- name: Check formatting
run: |
changed="$(gofmt -l .)"
if [ -n "$changed" ]; then
printf 'gofmt wants changes in:\n%s\n' "$changed"
exit 1
fi
- name: Vet
run: go vet ./...
test:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
- name: Test
run: go test -count=1 ./...
- name: Build CLI
run: go build -ldflags "-X main.version=ci" -o bin/notcrawl ./cmd/notcrawl
- name: Smoke test CLI control surface
run: |
set -euo pipefail
output="$(./bin/notcrawl --help 2>&1)"
printf '%s\n' "$output"
printf '%s' "$output" | grep -q "Usage of notcrawl:"
printf '%s' "$output" | grep -q "metadata"
printf '%s' "$output" | grep -q "tui"
test "$(./bin/notcrawl --version)" = "ci"
./bin/notcrawl metadata --json | grep -q '"schema_version"'
cfg="$RUNNER_TEMP/notcrawl.toml"
db="$RUNNER_TEMP/notcrawl.db"
./bin/notcrawl --config "$cfg" init
./bin/notcrawl --config "$cfg" --db "$db" status --json | grep -q '"databases"'
./bin/notcrawl --config "$cfg" --db "$db" tui --json --limit 1 | grep -q '^\['
release-check:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
- name: Snapshot release build
uses: goreleaser/goreleaser-action@v7.2.1
with:
distribution: goreleaser
version: "~> v2"
args: release --snapshot --clean --skip=publish