Skip to content

Commit 8fe4cfa

Browse files
authored
Merge pull request #853 from axone-protocol/build/heighliner
Build/heighliner
2 parents 55b88c3 + 2d77b6e commit 8fe4cfa

File tree

5 files changed

+53
-15
lines changed

5 files changed

+53
-15
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727

2828
- name: Build go project
2929
run: |
30-
make build
30+
make build-go
3131
3232
build-docker:
3333
runs-on: ubuntu-22.04

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484

8585
- name: Install AXONE blockchain
8686
run: |
87-
make build && make install
87+
make build-go && make install
8888
8989
- name: Initialize blockchain
9090
run: |

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ RUN set -eux \
1515

1616
COPY . /src/
1717

18-
RUN BUILD_TAGS=muslc LINK_STATICALLY=true make build
18+
RUN BUILD_TAGS=muslc LINK_STATICALLY=true make build-go
1919

2020
#--- Image stage
2121
FROM alpine:3.20.3

Makefile

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,15 @@ DOCKER_IMAGE_MARKDOWNLINT = thegeeklab/markdownlint-cli:0.32.2
2121
DOCKER_IMAGE_GOTEMPLATE = hairyhenderson/gomplate:v3.11.3-alpine
2222

2323
# Tools
24-
TOOL_TPARSE_NAME := tparse
25-
TOOL_TPARSE_VERSION := v0.16.0
26-
TOOL_TPARSE_PKG := github.com/mfridman/$(TOOL_TPARSE_NAME)@$(TOOL_TPARSE_VERSION)
27-
TOOL_TPARSE_BIN := ${TOOLS_FOLDER}/$(TOOL_TPARSE_NAME)/$(TOOL_TPARSE_VERSION)/$(TOOL_TPARSE_NAME)
24+
TOOL_TPARSE_NAME := tparse
25+
TOOL_TPARSE_VERSION := v0.16.0
26+
TOOL_TPARSE_PKG := github.com/mfridman/$(TOOL_TPARSE_NAME)@$(TOOL_TPARSE_VERSION)
27+
TOOL_TPARSE_BIN := ${TOOLS_FOLDER}/$(TOOL_TPARSE_NAME)/$(TOOL_TPARSE_VERSION)/$(TOOL_TPARSE_NAME)
28+
29+
TOOL_HEIGHLINER_NAME := heighliner
30+
TOOL_HEIGHLINER_VERSION := v1.7.1
31+
TOOL_HEIGHLINER_PKG := github.com/strangelove-ventures/$(TOOL_HEIGHLINER_NAME)@$(TOOL_HEIGHLINER_VERSION)
32+
TOOL_HEIGHLINER_BIN := ${TOOLS_FOLDER}/$(TOOL_HEIGHLINER_NAME)/$(TOOL_HEIGHLINER_VERSION)/$(TOOL_HEIGHLINER_NAME)
2833

2934
# Some colors (if supported)
3035
define get_color
@@ -168,7 +173,7 @@ format-proto: ## Format proto files
168173

169174
## Build:
170175
.PHONY: build
171-
build: build-go ## Build all available artefacts (executable, docker image, etc.)
176+
build: build-go build-docker ## Build all available artefacts (executable, docker image, etc.)
172177

173178
.PHONY: build-go
174179
build-go: ## Build node executable for the current environment (default build)
@@ -177,6 +182,11 @@ build-go: ## Build node executable for the current environment (default build)
177182

178183
build-go-all: $(ENVIRONMENTS_TARGETS) ## Build node executables for all available environments
179184

185+
.PHONY: build-docker
186+
build-docker: $(TOOL_HEIGHLINER_BIN) ## Build docker image
187+
@echo "${COLOR_CYAN} 🐳 Building local ${COLOR_RESET}docker${COLOR_CYAN} image${COLOR_RESET}"
188+
@$(TOOL_HEIGHLINER_BIN) build -c axone --local
189+
180190
$(ENVIRONMENTS_TARGETS):
181191
@GOOS=$(word 3, $(subst -, ,$@)); \
182192
GOARCH=$(word 4, $(subst -, ,$@)); \
@@ -213,7 +223,7 @@ test-go: $(TOOL_TPARSE_BIN) build ## Pass the test for the go source code
213223
@go test -v -coverprofile ./target/coverage.txt ./... -json | $(TOOL_TPARSE_BIN)
214224

215225
## Chain:
216-
chain-init: build ## Initialize the blockchain with default settings.
226+
chain-init: build-go ## Initialize the blockchain with default settings.
217227
@echo "${COLOR_CYAN} 🛠️ Initializing chain ${COLOR_RESET}${CHAIN}${COLOR_CYAN} under ${COLOR_YELLOW}${CHAIN_HOME}${COLOR_RESET}"
218228

219229
@rm -rf "${CHAIN_HOME}"; \
@@ -245,7 +255,7 @@ chain-init: build ## Initialize the blockchain with default settings.
245255
${CHAIN_BINARY} genesis collect-gentxs \
246256
--home "${CHAIN_HOME}"
247257

248-
chain-start: build ## Start the blockchain with existing configuration (see chain-init)
258+
chain-start: build-go ## Start the blockchain with existing configuration (see chain-init)
249259
@echo "${COLOR_CYAN} 🛠️ Starting chain ${COLOR_RESET}${CHAIN}${COLOR_CYAN} with configuration ${COLOR_YELLOW}${CHAIN_HOME}${COLOR_RESET}"; \
250260
${CHAIN_BINARY} start --moniker ${CHAIN_MONIKER} \
251261
--home ${CHAIN_HOME}
@@ -254,14 +264,14 @@ chain-stop: ## Stop the blockchain
254264
@echo "${COLOR_CYAN} ✋️ Stopping chain ${COLOR_RESET}${CHAIN}${COLOR_CYAN} with configuration ${COLOR_YELLOW}${CHAIN_HOME}${COLOR_RESET}"
255265
@killall axoned
256266

257-
chain-upgrade: build ## Test the chain upgrade from the given FROM_VERSION to the given TO_VERSION.
267+
chain-upgrade: build-go ## Test the chain upgrade from the given FROM_VERSION to the given TO_VERSION.
258268
@echo "${COLOR_CYAN} ⬆️ Upgrade the chain ${COLOR_RESET}${CHAIN}${COLOR_CYAN} from ${COLOR_YELLOW}${FROM_VERSION}${COLOR_RESET}${COLOR_CYAN} to ${COLOR_YELLOW}${TO_VERSION}${COLOR_RESET}"
259269
@killall cosmovisor || \
260270
rm -rf ${TARGET_FOLDER}/${FROM_VERSION}; \
261271
git clone -b ${FROM_VERSION} https://github.com/axone-protocol/axoned.git ${TARGET_FOLDER}/${FROM_VERSION}; \
262272
echo "${COLOR_CYAN} 🏗 Build the ${COLOR_YELLOW}${FROM_VERSION}${COLOR_RESET}${COLOR_CYAN} binary...${COLOR_RESET}"; \
263273
cd ${TARGET_FOLDER}/${FROM_VERSION}; \
264-
make build; \
274+
make build-go; \
265275
BINARY_OLD=${TARGET_FOLDER}/${FROM_VERSION}/${DIST_FOLDER}/${DAEMON_NAME}; \
266276
cd ../../; \
267277
echo $$BINARY_OLD; \
@@ -429,16 +439,33 @@ ensure-buildx-builder:
429439

430440
## Dependencies:
431441
.PHONY: deps
432-
deps: deps-$(TOOL_TPARSE_NAME) ## Install all the dependencies (tools, etc.)
442+
deps: deps-$(TOOL_TPARSE_NAME) deps-$(TOOL_HEIGHLINER_NAME) ## Install all the dependencies (tools, etc.)
433443

434444
.PHONY: deps-$(TOOL_TPARSE_NAME)
435445
deps-tparse: $(TOOL_TPARSE_BIN) ## Install $TOOL_TPARSE_NAME $TOOL_TPARSE_VERSION ($TOOL_TPARSE_PKG)
436446

447+
.PHONY: deps-$(TOOL_HEIGHLINER_NAME)
448+
deps-heighliner: $(TOOL_HEIGHLINER_BIN) ## Install $TOOL_HEIGHLINER_NAME $TOOL_HEIGHLINER_VERSION ($TOOL_HEIGHLINER_PKG)
449+
437450
$(TOOL_TPARSE_BIN):
438451
@echo "${COLOR_CYAN} 📦 Installing ${COLOR_GREEN}$(TOOL_TPARSE_NAME)@$(TOOL_TPARSE_VERSION)${COLOR_CYAN}...${COLOR_RESET}"
439452
@mkdir -p $(dir $(TOOL_TPARSE_BIN))
440453
@GOBIN=$(dir $(abspath $(TOOL_TPARSE_BIN))) go install $(TOOL_TPARSE_PKG)
441454

455+
$(TOOL_HEIGHLINER_BIN):
456+
@echo "${COLOR_CYAN} 📦 Installing ${COLOR_GREEN}$(TOOL_HEIGHLINER_NAME)@$(TOOL_HEIGHLINER_VERSION)${COLOR_CYAN}...${COLOR_RESET}"
457+
@mkdir -p $(dir $(TOOL_HEIGHLINER_BIN))
458+
CUR_DIR=$(shell pwd) && \
459+
TEMP_DIR=$(shell mktemp -d) && \
460+
GIT_URL=https://$(firstword $(subst @, ,$(TOOL_HEIGHLINER_PKG))).git && \
461+
GIT_TAG=$(word 2,$(subst @, ,$(TOOL_HEIGHLINER_PKG))) && \
462+
git clone --branch $$GIT_TAG --depth 1 $$GIT_URL $$TEMP_DIR && \
463+
cd $$TEMP_DIR && \
464+
make build && \
465+
cd $$CUR_DIR && \
466+
mv $$TEMP_DIR/heighliner $(TOOL_HEIGHLINER_BIN) && \
467+
rm -rf $$TEMP_DIR
468+
442469
## Help:
443470
.PHONY: help
444471
help: ## Show this help.

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ Targets:
110110
build Build all available artefacts (executable, docker image, etc.)
111111
build-go Build node executable for the current environment (default build)
112112
build-go-all Build node executables for all available environments
113+
build-docker Build docker image
113114
Install:
114115
install Install node executable
115116
Test:
@@ -137,6 +138,7 @@ Targets:
137138
Dependencies:
138139
deps Install all the dependencies (tools, etc.)
139140
deps-tparse Install tparse v0.16.0 (github.com/mfridman/tparse@v0.16.0)
141+
deps-heighliner Install heighliner v1.7.1 (github.com/strangelove-ventures/heighliner@v1.7.1)
140142
Help:
141143
help Show this help.
142144
@@ -148,14 +150,23 @@ This Makefile depends on docker. To install it, please follow the instructions:
148150

149151
### Build
150152

151-
To build the `axoned` node, invoke the goal `build` of the `Makefile`:
153+
To build the `axoned` node, invoke the goal `build-go` of the `Makefile`:
152154

153155
```sh
154-
make build
156+
make build-go
155157
```
156158

157159
The binary will be generated under the folder `target/dist`.
158160

161+
### Build a docker image
162+
163+
This project leverages [heighliner](https://github.com/strangelove-ventures/heighliner) to simplify the management and
164+
creation of production-grade container images. To build a Docker image, use the `build-docker` target in the `Makefile`:
165+
166+
```sh
167+
make build-docker
168+
```
169+
159170
### Run a local network
160171

161172
To initialize a local network configuration, invoke the goal `chain-init` of the `Makefile`:

0 commit comments

Comments
 (0)