-
Notifications
You must be signed in to change notification settings - Fork 25
feat(hardware): use NVML to grab the hardware profile during the regi… #314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9fa4720
6a6d007
42ec5a0
1cc4b80
bc41666
15b4a01
75ebd43
beeebff
95e0202
74d6200
ce8252b
90b0a17
e75f724
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,4 +65,4 @@ jobs: | |
| go-version: '1.24.0' | ||
| cache: true | ||
| - name: Release test | ||
| run: make build | ||
| run: make build-cross | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,49 @@ | ||
| version: 2 | ||
| before: | ||
| hooks: | ||
| - go mod download | ||
| # Separate builds per target so CC/CXX are correct in goreleaser-cross (avoids aarch64-gcc being used for linux/amd64). | ||
| builds: | ||
| - env: | ||
| - CGO_ENABLED=0 | ||
| goos: | ||
| - darwin | ||
| - linux | ||
| # - windows | ||
| goarch: | ||
| - amd64 | ||
| - arm64 | ||
| - id: darwin-amd64 | ||
| env: | ||
| - CGO_ENABLED=1 | ||
| goos: [darwin] | ||
| goarch: [amd64] | ||
| binary: brev | ||
| ldflags: | ||
| - -X github.com/brevdev/brev-cli/pkg/cmd/version.Version={{.Tag}} | ||
| - id: darwin-arm64 | ||
| env: | ||
| - CGO_ENABLED=1 | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like under the hood the goreleaser image finds its own C toolchain for OSX |
||
| goos: [darwin] | ||
| goarch: [arm64] | ||
| binary: brev | ||
| ldflags: | ||
| - -X github.com/brevdev/brev-cli/pkg/cmd/version.Version={{.Tag}} | ||
| - id: linux-amd64 | ||
| env: | ||
| - CGO_ENABLED=1 | ||
| - CC=x86_64-linux-gnu-gcc | ||
| - CXX=x86_64-linux-gnu-g++ | ||
| goos: [linux] | ||
| goarch: [amd64] | ||
| binary: brev | ||
| ldflags: | ||
| - -X github.com/brevdev/brev-cli/pkg/cmd/version.Version={{.Tag}} | ||
| - id: linux-arm64 | ||
| env: | ||
| - CGO_ENABLED=1 | ||
| - CC=aarch64-linux-gnu-gcc | ||
| - CXX=aarch64-linux-gnu-g++ | ||
| goos: [linux] | ||
| goarch: [arm64] | ||
| binary: brev | ||
| ldflags: | ||
| - -X github.com/brevdev/brev-cli/pkg/cmd/version.Version={{.Tag}} | ||
|
|
||
| brews: | ||
| - name: brev | ||
| folder: Formula | ||
| directory: Formula | ||
|
Comment on lines
-20
to
+46
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Renamed in |
||
| # GitHub/GitLab repository to push the formula to | ||
| repository: | ||
| owner: brevdev | ||
|
|
@@ -37,9 +63,11 @@ brews: | |
| archives: | ||
| - format_overrides: | ||
| - goos: windows | ||
| format: zip | ||
| formats: [zip] | ||
|
Comment on lines
-40
to
+66
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| release: | ||
| github: | ||
| owner: brevdev | ||
| name: brev-cli | ||
|
Comment on lines
+69
to
+70
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are now required in |
||
| prerelease: auto | ||
| # dockers: | ||
| # - image_templates: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,39 @@ | ||
| .DEFAULT_GOAL := fast-build | ||
| VERSION := dev-$(shell git rev-parse HEAD | cut -c 1-8) | ||
|
|
||
| # Cross-compilation via Docker (golang:1.24 native Linux container). | ||
| # When arch=<GOOS>/<GOARCH> is provided, spin up a container that matches | ||
| # the target platform so CGO uses the native Linux gcc/GNU ld toolchain | ||
| _GOMODCACHE := $(shell go env GOMODCACHE) | ||
| ifdef arch | ||
| _CROSS_GOOS := $(word 1,$(subst /, ,$(arch))) | ||
| _CROSS_GOARCH := $(word 2,$(subst /, ,$(arch))) | ||
| _BUILD_PREFIX := docker run --rm \ | ||
| --platform $(_CROSS_GOOS)/$(_CROSS_GOARCH) \ | ||
| -v $(CURDIR):/app \ | ||
| -v $(_GOMODCACHE):/go/pkg/mod \ | ||
| -e CGO_ENABLED=1 \ | ||
| -e GOPRIVATE=github.com/brevdev/* \ | ||
| -e GONOSUMDB=github.com/brevdev/* \ | ||
| -w /app \ | ||
| golang:1.24 | ||
| else | ||
| _BUILD_PREFIX := CGO_ENABLED=1 | ||
| endif | ||
|
|
||
| .PHONY: fast-build | ||
| fast-build: ## go build -o brev | ||
| $(call print-target) | ||
| echo ${VERSION} | ||
| CGO_ENABLED=0 go build -o brev -ldflags "-X github.com/brevdev/brev-cli/pkg/cmd/version.Version=${VERSION}" | ||
| CGO_ENABLED=1 go build -o brev -ldflags "-X github.com/brevdev/brev-cli/pkg/cmd/version.Version=${VERSION}" | ||
|
|
||
| .PHONY: local | ||
| local: ## build with env wrapper (use: make local env=dev0|dev1|dev2|stg arch=linux/amd64, or make local for defaults) | ||
| $(call print-target) | ||
| ifdef env | ||
| @echo "Building with env=$(env) wrapper..." | ||
| @echo ${VERSION} | ||
| $(if $(arch),GOOS=$(word 1,$(subst /, ,$(arch))) GOARCH=$(word 2,$(subst /, ,$(arch))),) CGO_ENABLED=0 go build -o brev-local -ldflags "-X github.com/brevdev/brev-cli/pkg/cmd/version.Version=${VERSION}" | ||
| $(_BUILD_PREFIX) go build -o brev-local -ldflags "-X github.com/brevdev/brev-cli/pkg/cmd/version.Version=${VERSION}" | ||
| @echo '#!/bin/sh' > brev | ||
| @echo '# Auto-generated wrapper with environment overrides' >> brev | ||
| @echo 'export BREV_CONSOLE_URL="https://localhost.nvidia.com:3000"' >> brev | ||
|
|
@@ -26,7 +46,7 @@ ifdef env | |
| @chmod +x brev | ||
| else | ||
| @echo "Building without environment overrides (using config.go defaults)..." | ||
| $(if $(arch),GOOS=$(word 1,$(subst /, ,$(arch))) GOARCH=$(word 2,$(subst /, ,$(arch))),) CGO_ENABLED=0 go build -o brev -ldflags "-X github.com/brevdev/brev-cli/pkg/cmd/version.Version=${VERSION}" | ||
| $(_BUILD_PREFIX) go build -o brev -ldflags "-X github.com/brevdev/brev-cli/pkg/cmd/version.Version=${VERSION}" | ||
| endif | ||
|
|
||
| .PHONY: install-dev | ||
|
|
@@ -104,18 +124,42 @@ diff: ## git diff | |
| git diff --exit-code | ||
| RES=$$(git status --porcelain) ; if [ -n "$$RES" ]; then echo $$RES && exit 1 ; fi | ||
|
|
||
| .PHONY: build | ||
| build: ## goreleaser --snapshot --skip-publish --rm-dist | ||
| build: install-tools | ||
| $(call print-target) | ||
| goreleaser --snapshot --skip-publish --rm-dist | ||
|
|
||
| .PHONY: release | ||
| release: ## goreleaser --rm-dist | ||
| release: install-tools | ||
| $(call print-target) | ||
| goreleaser --rm-dist | ||
|
|
||
| # Docker-based build/release using goreleaser-cross. | ||
| # See: https://goreleaser.com/limitations/cgo (goreleaser needs explicit instructions for CGO builds) | ||
| # See: https://github.com/goreleaser/goreleaser-cross (docker image with cross-compilers for CGO builds) | ||
| # See: https://github.com/goreleaser/example-cross (example of using goreleaser-cross) | ||
| GOLANG_CROSS_VERSION ?= v1.24.5 | ||
| BREV_MODULE ?= github.com/brevdev/brev-cli | ||
|
|
||
| # Dry-run build using goreleaser-cross | ||
| .PHONY: build-cross | ||
| build-cross: | ||
| $(call print-target) | ||
| docker run --rm \ | ||
| -e CGO_ENABLED=1 \ | ||
| -v "$$(pwd):/go/src/$(BREV_MODULE)" \ | ||
| -w "/go/src/$(BREV_MODULE)" \ | ||
| ghcr.io/goreleaser/goreleaser-cross:$(GOLANG_CROSS_VERSION) \ | ||
| --clean --skip=validate --skip=publish | ||
|
|
||
| # Release using goreleaser-cross. Requires GITHUB_TOKEN to be set. | ||
| .PHONY: release-cross | ||
| release-cross: | ||
| $(call print-target) | ||
| docker run --rm \ | ||
| -e CGO_ENABLED=1 \ | ||
| -e "GITHUB_TOKEN=$$GITHUB_TOKEN" \ | ||
| -v "$$(pwd):/go/src/$(BREV_MODULE)" \ | ||
| -w "/go/src/$(BREV_MODULE)" \ | ||
| ghcr.io/goreleaser/goreleaser-cross:$(GOLANG_CROSS_VERSION) \ | ||
| release --clean | ||
|
|
||
| .PHONY: run | ||
| run: ## go run | ||
| @go run -race . | ||
|
|
@@ -169,7 +213,7 @@ full-smoke-test: ci fast-build | |
| build-linux-amd: | ||
| $(call print-target) | ||
| echo ${VERSION} | ||
| GOOS=linux GOARCH=amd64 go build -o brev -ldflags "-X github.com/brevdev/brev-cli/pkg/cmd/version.Version=${VERSION}" | ||
| CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o brev -ldflags "-X github.com/brevdev/brev-cli/pkg/cmd/version.Version=${VERSION}" | ||
|
|
||
| .PHONY: build-darwin-amd | ||
| build-darwin-amd: | ||
|
|
@@ -305,8 +349,8 @@ develop-with-nix: | |
| update-devplane-deps: ## update devplane dependencies (use: make update-devplane-deps commit=<hash-or-tag>, defaults to latest) | ||
| @COMMIT=$${commit:-latest}; \ | ||
| echo "Updating devplane dependencies to: $$COMMIT"; \ | ||
| go get -u github.com/brevdev/dev-plane@$$COMMIT; \ | ||
| GOPRIVATE=github.com/brevdev/* go get -u github.com/brevdev/dev-plane@$$COMMIT; \ | ||
| go get buf.build/gen/go/brevdev/devplane/grpc/go@$$COMMIT; \ | ||
| go get buf.build/gen/go/brevdev/devplane/protocolbuffers/go@$$COMMIT; \ | ||
| go mod tidy; \ | ||
| GOPRIVATE=github.com/brevdev/* go mod tidy; \ | ||
| echo "Successfully updated to $$COMMIT" | ||
|
Comment on lines
-308
to
356
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unrelated but this allows for fetching internal dependencies without relying on the |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now always need CGO