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
76 changes: 10 additions & 66 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,69 +11,13 @@ permissions:
contents: read

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v7

- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
cache: true

- name: Download dependencies
run: go mod download

- name: Build binary
run: make build

- name: Check documentation examples and CLI contract
run: python3 scripts/check-docs.py --binary build/l8k

- name: Build all platforms
run: make build-all

test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v7

- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
cache: true

- name: Download dependencies
run: go mod download

- name: Run tests
run: go test -v -race -count=1 ./...

- name: Run tests with coverage
run: |
go test -coverprofile=coverage.out ./...
go tool cover -func=coverage.out

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v7

- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
cache: true

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.11
ci:
uses: Mellanox/cloud-orchestration-reusable-workflows/.github/workflows/go-ci-reusable.yml@main
with:
build-command: |
make build
python3 scripts/check-docs.py --binary build/l8k
make build-all
test-command: |
go test -v -race -count=1 -coverprofile=coverage.out ./...
go tool cover -func=coverage.out
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ Read [AGENTS.md](AGENTS.md) for repository navigation, behavior contracts,
build and test guidance, and the development workflow. These shared rules also
apply to agent-assisted contributions; `CLAUDE.md` points to the same guide.

### Continuous integration

Build, test, and lint jobs use `Mellanox/cloud-orchestration-reusable-workflows`.
Go and golangci-lint versions are selected centrally. CI retains documentation
contract checks and cross-platform builds, and combines race detection and
coverage in one test run. `make lint` installs a versioned local binary;
`GOLANGCILINT_VERSION` can select the same version used by CI.

### Extension Contracts

Use the [contract index](openspec/README.md) to identify the integration boundaries
Expand Down
21 changes: 14 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,23 @@ deps:
$(GOMOD) download
$(GOMOD) tidy

## Run linter (requires golangci-lint)
lint:
golangci-lint run ./...
# CI supplies this environment variable from the reusable workflow.
GOLANGCILINT_VERSION ?= v2.14.0
GOLANGCI_LINT = $(CURDIR)/bin/golangci-lint-$(GOLANGCILINT_VERSION)

## Install golangci-lint if not present
install-lint:
@which golangci-lint > /dev/null || (echo "Installing golangci-lint..." && go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest)
## Run linter
lint: install-lint
$(GOLANGCI_LINT) run ./...

## Install the selected golangci-lint version locally
install-lint: $(GOLANGCI_LINT)
$(GOLANGCI_LINT):
mkdir -p $(CURDIR)/bin
GOBIN=$(CURDIR)/bin go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCILINT_VERSION)
mv $(CURDIR)/bin/golangci-lint $(GOLANGCI_LINT)
Comment on lines +98 to +100

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Unquoted checkout paths

If the checkout path contains spaces, the shell splits the unquoted $(CURDIR) in mkdir, GOBIN, and mv. The linter cannot be installed or run from that checkout. Quote the generated paths throughout the installer and lint command.

Comment on lines +97 to +100

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Untracked linter binary

make lint now installs a versioned binary under bin/, but that directory is not ignored and make clean does not remove it. Each local installation leaves an untracked build artifact in the checkout. Ignore or clean up the generated binary.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!


## Run linter with installation check
lint-check: install-lint lint
lint-check: lint

## Build Docker image
docker-build:
Expand Down
Loading