Skip to content

Commit

Permalink
Merge pull request #288 from kjsanger/feature/build-improvements
Browse files Browse the repository at this point in the history
Remove use of CGO when building
  • Loading branch information
kjsanger authored Jan 3, 2025
2 parents 7e49f37 + 55412d2 commit c50d4a4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
with:
name: ${{ env.RELEASE_VERSION }}
prerelease: ${{ !(github.sha == env.MASTER_SHA) }}
artifacts: "build/*.tar.bz2,build/*.tar.bz2.sha256"
artifacts: "./build/*.tar.bz2,./build/*.tar.bz2.sha256"
removeArtifacts: true
artifactErrorsFailBuild: true
generateReleaseNotes: true
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,6 @@ jobs:
baton-do --version
- name: "Install test runner"
run: |
go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo
go get github.com/onsi/gomega/...
- name: "Run tests"
run: |
make test
23 changes: 15 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
VERSION := $(shell git describe --always --tags --dirty)
ldflags := "-X github.com/wtsi-npg/valet/valet.Version=${VERSION}"
build_args := -a -v -ldflags ${ldflags}

build_path = "build/valet-${VERSION}"

CGO_ENABLED := 1
GOARCH := amd64
GOOS := linux
export CGO_ENABLED := 0

export GOARCH := $(shell go env GOARCH)

ifeq ($(GITHUB_ACTIONS),true)
DOCKER_REGISTRY?=ghcr.io
Expand All @@ -32,9 +33,12 @@ git_commit=$(shell git log --pretty=format:'%H' -n 1)

all: build

build:
build: build-linux

build-linux: export GOOS = linux
build-linux:
mkdir -p ${build_path}
go build ${build_args} -o ${build_path}/valet-${GOARCH} ./main.go
go build ${build_args} -o ${build_path}/valet-${GOOS}-${GOARCH} ./main.go

install:
go install ${build_args}
Expand All @@ -44,10 +48,13 @@ lint:

check: test

test:
ginkgo -r --race
test-install:
go install github.com/onsi/ginkgo/v2/ginkgo

test: test-install
CGO_ENABLED=1 ginkgo -r --race

coverage:
coverage: test-install
ginkgo -r --cover -coverprofile=coverage.out

dist: build
Expand Down

0 comments on commit c50d4a4

Please sign in to comment.