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
65 changes: 65 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: ci

# Minimal CI for pgrun-cli: tests, cross-platform build, lint, vulnerability scan.
# Action SHAs and tool versions are pinned (as in pgrundev/pgbot) so a release upstream cannot
# change what CI enforces without a commit here. Go comes from go.mod (go + toolchain lines).
on:
pull_request:
push:
branches: [main]

permissions:
contents: read

jobs:
test:
name: vet + gofmt + unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
- run: go vet ./...
- name: gofmt
run: |
unformatted=$(gofmt -l cmd internal)
if [ -n "$unformatted" ]; then echo "gofmt needed:"; echo "$unformatted"; exit 1; fi
- run: go test -race ./...

build:
name: build ${{ matrix.goos }}/${{ matrix.goarch }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
goos: [linux, darwin, windows]
goarch: [amd64, arm64]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
- name: build (same flags as the Makefile)
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: "0"
run: go build -trimpath -ldflags "-s -w" -o "bin/pgrun-$GOOS-$GOARCH" ./cmd/pgrun

lint:
name: golangci-lint + govulncheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
- name: "golangci-lint (config: .golangci.yml)"
run: |
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.14.0
"$(go env GOPATH)/bin/golangci-lint" run ./...
- name: govulncheck
run: |
go install golang.org/x/vuln/cmd/govulncheck@v1.9.0
"$(go env GOPATH)/bin/govulncheck" ./...
28 changes: 28 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Minimal lint baseline for pgrun-cli (golangci-lint v2, default linters: errcheck, govet,
# ineffassign, staticcheck, unused). The exclusions are the accepted patterns of a CLI, not bugs:
# - writes to the user's terminal (fmt/tabwriter/io to stdout/stderr) and best-effort cleanup
# (Close, Remove, RemoveAll, waiting on a launched browser) are intentionally unchecked;
# - tests: unchecked fixture writes, and staticcheck's quick-fix style hints.
version: "2"
linters:
settings:
errcheck:
exclude-functions:
- fmt.Fprint
- fmt.Fprintf
- fmt.Fprintln
- io.WriteString
- (io.Writer).Write
- (io.Closer).Close
- (*os.File).Close
- (*text/tabwriter.Writer).Flush
- (net/http.ResponseWriter).Write
- (*os/exec.Cmd).Wait
- os.Remove
- os.RemoveAll
exclusions:
rules:
- path: _test\.go
linters: [errcheck]
- linters: [staticcheck]
text: "QF1002"
2 changes: 1 addition & 1 deletion internal/pgbot/pgbot.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const MinVersion = "0.9.0"

// PinnedVersion is what `pgrun bot install` downloads by default: the release
// this pgrun was tested against.
const PinnedVersion = "0.9.0"
const PinnedVersion = "0.10.0"

// SchemaMinVersion is the first pgbot release with `schema snapshot|diff|compare`
// (the migration review `pgrun bot verify` needs). Until PinnedVersion reaches it,
Expand Down
2 changes: 1 addition & 1 deletion npm/pgrun/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"README.md"
],
"dependencies": {
"@pgbot/cli": "^0.9.0"
"@pgbot/cli": "^0.10.0"
},
"optionalDependencies": {
"@pgrun/linux-x64": "0.0.0-dev",
Expand Down
Loading