Skip to content

Commit

Permalink
ci: bump Sage
Browse files Browse the repository at this point in the history
  • Loading branch information
odsod committed Sep 18, 2022
1 parent 4be51ae commit 2cb934a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .sage/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module sage

go 1.17

require go.einride.tech/sage v0.128.0
require go.einride.tech/sage v0.159.0
4 changes: 2 additions & 2 deletions .sage/go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
go.einride.tech/sage v0.128.0 h1:Oh0bUf5sYJ56ujmBORj2b/js8YnXVtzVW54RQXgTRr8=
go.einride.tech/sage v0.128.0/go.mod h1:EzV5uciFX7/2ho8EKB5K9JghOfXIxlzs694b+Tkl5GQ=
go.einride.tech/sage v0.159.0 h1:sRcbZnIVS27HIZUuARkQp9gOeTF2j1957MtzD+P9zx8=
go.einride.tech/sage v0.159.0/go.mod h1:EzV5uciFX7/2ho8EKB5K9JghOfXIxlzs694b+Tkl5GQ=
36 changes: 29 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,41 @@

.DEFAULT_GOAL := all

sagefile := .sage/bin/sagefile

$(sagefile): .sage/go.mod .sage/*.go
@cd .sage && go mod tidy && go run .
cwd := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
sagefile := $(abspath $(cwd)/.sage/bin/sagefile)

# Setup Go.
go := $(shell command -v go 2>/dev/null)
export GOWORK ?= off
ifndef go
SAGE_GO_VERSION ?= 1.18.4
export GOROOT := $(abspath $(cwd)/.sage/tools/go/$(SAGE_GO_VERSION)/go)
export PATH := $(PATH):$(GOROOT)/bin
go := $(GOROOT)/bin/go
os := $(shell uname | tr '[:upper:]' '[:lower:]')
arch := $(shell uname -m)
ifeq ($(arch),x86_64)
arch := amd64
endif
$(go):
$(info installing Go $(SAGE_GO_VERSION)...)
@mkdir -p $(dir $(GOROOT))
@curl -sSL https://go.dev/dl/go$(SAGE_GO_VERSION).$(os)-$(arch).tar.gz | tar xz -C $(dir $(GOROOT))
@touch $(GOROOT)/go.mod
@chmod +x $(go)
endif

.PHONY: $(sagefile)
$(sagefile): $(go)
@cd .sage && $(go) mod tidy && $(go) run .

.PHONY: sage
sage:
@git clean -fxq $(sagefile)
@$(MAKE) $(sagefile)

.PHONY: update-sage
update-sage:
@cd .sage && go get -d go.einride.tech/sage@latest && go mod tidy && go run .
update-sage: $(go)
@cd .sage && $(go) get -d go.einride.tech/sage@latest && $(go) mod tidy && $(go) run .

.PHONY: clean-sage
clean-sage:
Expand Down

0 comments on commit 2cb934a

Please sign in to comment.