Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Run CI Tests
on:
pull_request:
paths-ignore:
- 'README.md'
- 'LICENSE'
push:
branches:
- 'main'
jobs:
run-copywrite:
timeout-minutes: 5
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-copywrite@v1.1.3
- name: verify copyright
run: |
copywrite --config .github/workflows/scripts/copywrite.hcl \
headers --spdx "BSD-3-Clause" --plan
run-tests:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v2
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache-dependency-path: '**/go.sum'
- uses: golangci/golangci-lint-action@v6
with:
version: v1.62.2
skip-cache: true
args: --config .github/workflows/scripts/golangci.yaml
- name: Run Go Test
run: |
just test

14 changes: 14 additions & 0 deletions .github/workflows/scripts/copywrite.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
schema_version = 1

project {
license = "BSD-3-Clause"
copyright_holder = "CattleCloud LLC"
copyright_year = 2024
header_ignore = [
"**/*.sh",
".src/**",
".bin/**",
".github/**",
".golangci.yaml",
]
}
43 changes: 43 additions & 0 deletions .github/workflows/scripts/golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
run:
timeout: 5m
linters:
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- copyloopvar
- dogsled
- dupword
- durationcheck
- errcheck
- errname
- errorlint
- exhaustive
- gochecknoinits
- gocritic
- gofmt
- gosimple
- govet
- ineffassign
- makezero
- misspell
- musttag
- nilnil
- noctx
- perfsprint
- prealloc
- predeclared
- reassign
- revive
- rowserrcheck
- staticcheck
- sqlclosecheck
- tagalign
- tenv
- unused
- whitespace

linters-settings:
exhaustive:
default-signifies-exhaustive: true
37 changes: 37 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
set shell := ["bash", "-u", "-c"]

export scripts := ".github/workflows/scripts"
export GOBIN := `echo $PWD/.bin`

# show available commands
[private]
default:
@just --list

# tidy up Go modules
[group('build')]
tidy:
go mod tidy

# run tests across source tree
[group('build')]
test:
go test -v -race -count=1 ./...

# ensure copywrite headers present on source files
[group('lint')]
copywrite:
copywrite \
--config {{scripts}}/copywrite.hcl headers \
--spdx "BSD-3-Clause"

# apply go vet command on source tree
[group('lint')]
vet:
go vet ./...

# apply golangci-lint linters on source tree
[group('lint')]
lint: vet
golangci-lint run --config .github/workflows/scripts/golangci.yaml