Skip to content

Commit 726241b

Browse files
authored
ci: stabilize keep tool bootstrap (#49)
* ci: stabilize keep tool bootstrap * ci: restore PATH-based opa lookup
1 parent 6f66142 commit 726241b

2 files changed

Lines changed: 18 additions & 13 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
python-version: ${{ env.PYTHON_VERSION }}
3030

3131
- name: Install uv
32-
uses: astral-sh/setup-uv@v5
32+
uses: astral-sh/setup-uv@v7
3333

3434
- name: Install toolchains
3535
run: make install-tools
@@ -82,7 +82,7 @@ jobs:
8282
python-version: ${{ env.PYTHON_VERSION }}
8383

8484
- name: Install uv
85-
uses: astral-sh/setup-uv@v5
85+
uses: astral-sh/setup-uv@v7
8686

8787
- name: Install Python dependencies
8888
run: |
@@ -124,7 +124,7 @@ jobs:
124124
check-latest: true
125125

126126
- name: Install uv
127-
uses: astral-sh/setup-uv@v5
127+
uses: astral-sh/setup-uv@v7
128128

129129
- name: Prepare tooling
130130
run: make install-tools

Makefile

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
PROJECT_NAME := keep
2-
GOLANGCI_LINT ?= golangci-lint
2+
GOLANGCI_LINT_VERSION ?= 1.64.8
33
GOBIN := $(shell go env GOPATH)/bin
4+
GOLANGCI_LINT ?= $(GOBIN)/golangci-lint
5+
GOIMPORTS ?= $(GOBIN)/goimports
6+
GOVULNCHECK ?= $(GOBIN)/govulncheck
7+
GOSEC ?= $(GOBIN)/gosec
8+
OPA ?= opa
49
export PATH := $(GOBIN):$(PATH)
510

611
.PHONY: all tidy build test lint format lint-go lint-python format-go format-python docker-up docker-down docker-logs db-migrate opa-test cert-refresh setup-venv security
@@ -26,7 +31,7 @@ format: format-go format-python
2631
format-go:
2732
@echo "Formatting Go code..."
2833
go fmt ./...
29-
goimports -w -local github.com/EvalOps/keep .
34+
$(GOIMPORTS) -w -local github.com/EvalOps/keep .
3035

3136
format-python:
3237
@echo "Formatting Python code..."
@@ -65,7 +70,7 @@ db-migrate-status:
6570
go run ./cmd/migrate -version
6671

6772
opa-test:
68-
opa test ./policies
73+
$(OPA) test ./policies
6974

7075
cert-refresh:
7176
go run ./cmd/authz cert-refresh
@@ -74,7 +79,7 @@ cert-refresh:
7479
install-tools:
7580
@echo "Installing Go tools..."
7681
mkdir -p $(GOBIN)
77-
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
82+
GOPROXY=https://proxy.golang.org,direct go install github.com/golangci/golangci-lint/cmd/golangci-lint@v$(GOLANGCI_LINT_VERSION)
7883
go install golang.org/x/tools/cmd/goimports@v0.36.0
7984
go install golang.org/x/vuln/cmd/govulncheck@latest
8085
go install github.com/securego/gosec/v2/cmd/gosec@v2.22.6
@@ -120,10 +125,10 @@ dev-bootstrap:
120125

121126
check-tools:
122127
@echo "Checking Go tools..."
123-
@command -v golangci-lint >/dev/null 2>&1 || { echo "golangci-lint not found. Run 'make install-tools'"; exit 1; }
124-
@command -v goimports >/dev/null 2>&1 || { echo "goimports not found. Run 'make install-tools'"; exit 1; }
125-
@command -v govulncheck >/dev/null 2>&1 || { echo "govulncheck not found. Run 'make install-tools'"; exit 1; }
126-
@command -v gosec >/dev/null 2>&1 || { echo "gosec not found. Run 'make install-tools'"; exit 1; }
128+
@test -x "$(GOLANGCI_LINT)" || { echo "golangci-lint not found at $(GOLANGCI_LINT). Run 'make install-tools'"; exit 1; }
129+
@test -x "$(GOIMPORTS)" || { echo "goimports not found at $(GOIMPORTS). Run 'make install-tools'"; exit 1; }
130+
@test -x "$(GOVULNCHECK)" || { echo "govulncheck not found at $(GOVULNCHECK). Run 'make install-tools'"; exit 1; }
131+
@test -x "$(GOSEC)" || { echo "gosec not found at $(GOSEC). Run 'make install-tools'"; exit 1; }
127132
@echo "Checking Python tools..."
128133
@command -v black >/dev/null 2>&1 || { echo "black not found. Run 'make install-tools'"; exit 1; }
129134
@command -v flake8 >/dev/null 2>&1 || { echo "flake8 not found. Run 'make install-tools'"; exit 1; }
@@ -134,11 +139,11 @@ check-tools:
134139
security:
135140
@echo "Running govulncheck..."
136141
@# govulncheck currently fails due to golang.org/x/sync/semaphore type info missing via github.com/jackc/puddle/v2
137-
@if ! govulncheck ./...; then \
142+
@if ! $(GOVULNCHECK) ./...; then \
138143
echo "Warning: govulncheck encountered known issue (golang.org/x/sync/semaphore via github.com/jackc/puddle/v2); continuing"; \
139144
fi
140145
@echo "Running gosec..."
141-
gosec ./...
146+
$(GOSEC) ./...
142147

143148
# CI/CD targets
144149
ci-lint: check-tools lint

0 commit comments

Comments
 (0)