Skip to content

Commit

Permalink
Use env go version for tests
Browse files Browse the repository at this point in the history
Signed-off-by: James Hamlin <[email protected]>
  • Loading branch information
jfhamlin committed Nov 26, 2023
1 parent b462415 commit 10e5eeb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ jobs:
strategy:
fail-fast: false
matrix:
go: ['1.19', '1.20', '1.21']
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v19
- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v4
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: nix-shell --run 'PATH=$(go env GOPATH)/bin:$PATH make test'
go-version: ${{ matrix.go }}
cache: false
- run: make test
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ BINS=$(foreach platform,$(GOPLATFORMS),bin/$(platform)/glj$(if $(findstring wasm

# eventually, support multiple minor versions
GO_VERSION := 1.19.3
GO_CMD := go$(GO_VERSION)
GENIMPORTS_GO_CMD := go$(GO_VERSION)

.PHONY: all
all: gocmd $(STDLIB_TARGETS) generate $(GLJIMPORTS) $(BINS)

.PHONY: gocmd
gocmd:
@$(GO_CMD) version 2>&1 > /dev/null || \
(go install "golang.org/dl/$(GO_CMD)@latest" && \
$(GO_CMD) download > /dev/null && $(GO_CMD) version > /dev/null)
@$(GENIMPORTS_GO_CMD) version 2>&1 > /dev/null || \
(go install "golang.org/dl/$(GENIMPORTS_GO_CMD)@latest" && \
$(GENIMPORTS_GO_CMD) download > /dev/null && $(GENIMPORTS_GO_CMD) version > /dev/null)

.PHONY: generate
generate:
Expand All @@ -33,7 +33,7 @@ generate:
pkg/gen/gljimports/gljimports_%.go: ./scripts/gen-gljimports.sh ./cmd/gen-import-interop/main.go ./internal/genpkg/genpkg.go \
$(wildcard ./pkg/lang/*.go) $(wildcard ./pkg/runtime/*.go)
@echo "Generating $@"
@./scripts/gen-gljimports.sh $@ $* $(GO_CMD)
@./scripts/gen-gljimports.sh $@ $* $(GENIMPORTS_GO_CMD)

pkg/stdlib/glojure/%.glj: scripts/rewrite-core/originals/%.clj scripts/rewrite-core/run.sh scripts/rewrite-core/rewrite.clj
@echo "Rewriting $< to $@"
Expand All @@ -56,7 +56,8 @@ vet:

.PHONY: $(TEST_TARGETS)
$(TEST_TARGETS): gocmd
@$(GO_CMD) run ./cmd/glj/main.go $(basename $@) | tee /dev/stderr | grep FAIL > /dev/null && exit 1 || exit 0
@go run ./cmd/glj/main.go $(basename $@) | tee /dev/stderr | grep FAIL > /dev/null && exit 1 || exit 0

.PHONY: test
test: vet $(TEST_TARGETS)
@go test ./...

0 comments on commit 10e5eeb

Please sign in to comment.