109 lines
3.1 KiB
YAML
109 lines
3.1 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ci-${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
test:
|
|
name: Test (${{ matrix.os }})
|
|
timeout-minutes: 30
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest]
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: Check out source
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
persist-credentials: false
|
|
- name: Set up Go
|
|
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
|
|
with:
|
|
go-version-file: go.mod
|
|
cache: true
|
|
cache-dependency-path: go.sum
|
|
- name: Verify dependency checksums
|
|
run: go mod verify
|
|
- name: Verify formatting
|
|
if: runner.os == 'Linux'
|
|
run: test -z "$(gofmt -l cmd internal)"
|
|
- name: Test
|
|
run: go test -shuffle=on ./...
|
|
- name: Test with race detector
|
|
run: go test -race ./...
|
|
- name: Vet
|
|
run: go vet ./...
|
|
- name: Build
|
|
run: go build -trimpath ./cmd/domainops
|
|
|
|
vulnerability-scan:
|
|
name: Go vulnerability scan
|
|
timeout-minutes: 15
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out source
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
persist-credentials: false
|
|
- name: Set up Go
|
|
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
|
|
with:
|
|
go-version-file: go.mod
|
|
cache: true
|
|
cache-dependency-path: go.sum
|
|
- name: Scan reachable code
|
|
run: go run golang.org/x/vuln/cmd/govulncheck@v1.6.0 ./...
|
|
|
|
release-config:
|
|
name: Validate release configuration
|
|
timeout-minutes: 10
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out full history
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
- name: Check GoReleaser configuration
|
|
uses: goreleaser/goreleaser-action@1a80836c5c9d9e5755a25cb59ec6f45a3b5f41a8 # v7.2.1
|
|
with:
|
|
distribution: goreleaser
|
|
version: v2.17.0
|
|
args: check
|
|
|
|
cross-build:
|
|
name: Cross-build supported targets
|
|
timeout-minutes: 20
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out source
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
persist-credentials: false
|
|
- name: Set up Go
|
|
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
|
|
with:
|
|
go-version-file: go.mod
|
|
cache: true
|
|
cache-dependency-path: go.sum
|
|
- name: Build supported targets
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
for os in linux darwin; do
|
|
for arch in amd64 arm64; do
|
|
CGO_ENABLED=0 GOOS="$os" GOARCH="$arch" go build -trimpath -o "build/domainops-$os-$arch" ./cmd/domainops
|
|
done
|
|
done
|