Skip to content

Commit 2e85b17

Browse files
authored
Merge pull request #834 from jshufro/jms/deps
Single module monorepo
2 parents 4f86ba3 + 832c141 commit 2e85b17

14 files changed

Lines changed: 158 additions & 2073 deletions

File tree

.github/workflows/build.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,24 @@ jobs:
1313
build:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v3
17-
- uses: actions/setup-go@v4
16+
- run: sudo apt install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross g++-aarch64-linux-gnu
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-go@v5
1819
with:
1920
go-version: 1.21.8
20-
- run: make NO_DOCKER=true
21+
- run: make NO_DOCKER=true release
22+
docker-build:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
- name: Get Version
27+
id: get_version
28+
run: echo "sn_version=v$(cat shared/version.txt)" >> $GITHUB_OUTPUT
29+
- uses: docker/setup-buildx-action@v3
30+
- uses: docker/bake-action@v6
31+
env:
32+
VERSION: ${{steps.get_version.outputs.sn_version}}
33+
with:
34+
push: false
35+
files: docker/daemon-bake.hcl
36+
targets: smartnode

.github/workflows/lint.yml

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,21 @@ permissions:
1313
# Optional: allow read access to pull request. Use with `only-new-issues` option.
1414
# pull-requests: read
1515
jobs:
16-
detect-modules:
17-
runs-on: ubuntu-latest
18-
outputs:
19-
modules: ${{ steps.set-modules.outputs.modules }}
20-
steps:
21-
- uses: actions/checkout@v4
22-
- uses: actions/setup-go@v5
23-
with:
24-
go-version: 1.21.8
25-
- id: set-modules
26-
run: echo "modules=$(go list -m -json | jq -s '.' | jq -c '[.[].Dir]')" >> $GITHUB_OUTPUT
2716
golangci-lint:
28-
needs: detect-modules
2917
runs-on: ubuntu-latest
30-
strategy:
31-
max-parallel: 1
32-
matrix:
33-
modules: ${{ fromJSON(needs.detect-modules.outputs.modules) }}
3418
steps:
3519
- uses: actions/checkout@v4
3620
- uses: actions/setup-go@v5
3721
with:
3822
go-version: 1.21.8
39-
- name: golangci-lint ${{ matrix.modules }}
23+
- name: golangci-lint
4024
uses: golangci/golangci-lint-action@v8
4125
with:
4226
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
4327
version: v2.1
4428

4529
# Optional: working directory, useful for monorepos
46-
working-directory: ${{ matrix.modules }}
30+
# working-directory: ${{ matrix.modules }}
4731

4832
# Optional: golangci-lint command line arguments.
4933
# args: --issues-exit-code=0

Makefile

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ LOCAL_OS=$(shell go env GOOS)-$(shell go env GOARCH)
33

44
BUILD_DIR=build
55
BIN_DIR=${BUILD_DIR}/${VERSION}/bin
6-
DOCKER_DIR=${BUILD_DIR}/${VERSION}/docker
76

87
CLI_TARGET_OOS:=linux darwin
98
ARCHS:=arm64 amd64
@@ -12,10 +11,6 @@ CLI_TARGET_STRINGS:=$(foreach oos,$(CLI_TARGET_OOS), $(foreach arch,$(ARCHS),${B
1211
DAEMON_TARGET_STRINGS:=$(foreach arch,$(ARCHS),${BIN_DIR}/rocketpool-daemon-linux-$(arch))
1312
TREEGEN_TARGET_STRINGS:=$(foreach arch,$(ARCHS),${BIN_DIR}/treegen-linux-$(arch))
1413

15-
MODULES:=$(foreach path,$(shell find . -name go.mod),$(dir $(path)))
16-
MODULE_GLOBS:=$(foreach module,$(MODULES),$(module)...)
17-
TEST_GLOBS:=$(filter-out ./bindings/...,$(MODULE_GLOBS))
18-
1914
define rocketpool-cli-template
2015
.PHONY: ${BIN_DIR}/rocketpool-cli-$1-$2
2116
${BIN_DIR}/rocketpool-cli-$1-$2: ${bin_deps}
@@ -91,8 +86,6 @@ endif
9186

9287
${BIN_DIR}:
9388
mkdir -p ${BIN_DIR}
94-
${DOCKER_DIR}:
95-
mkdir -p ${DOCKER_DIR}
9689

9790
$(foreach oos,$(CLI_TARGET_OOS),$(foreach arch,$(ARCHS),$(eval $(call rocketpool-cli-template,$(oos),$(arch)))))
9891

@@ -116,7 +109,7 @@ endif
116109

117110
# Docker containers
118111
.PHONY: docker
119-
docker: ${DOCKER_DIR}
112+
docker:
120113
VERSION=${VERSION} docker bake -f docker/daemon-bake.hcl smartnode
121114

122115
.PHONY: docker-push
@@ -143,18 +136,15 @@ docker-prune:
143136
docker system prune -af
144137
docker buildx prune -af
145138

146-
define lint-template
147-
.PHONY: lint-$1
148-
lint-$1:
149-
docker run -e GOCACHE=/go/.cache/go-build -e GOLANGCI_LINT_CACHE=/go/.cache/golangci-lint --user $(shell id -u):$(shell id -g) --rm -v ~/.cache:/go/.cache -v .:/smartnode --workdir /smartnode/$1 golangci/golangci-lint:v2.1-alpine golangci-lint fmt --diff
150-
endef
151-
$(foreach module,$(MODULES),$(eval $(call lint-template,$(module))))
152139
.PHONY: lint
153-
lint: $(foreach module,$(MODULES),lint-$(module))
140+
lint:
141+
ifndef NO_DOCKER
142+
docker run -e GOMODCACHE=/go/.cache/pkg/mod -e GOCACHE=/go/.cache/go-build -e GOLANGCI_LINT_CACHE=/go/.cache/golangci-lint --user $(shell id -u):$(shell id -g) --rm -v ~/.cache:/go/.cache -v .:/smartnode --workdir /smartnode/ golangci/golangci-lint:v2.1-alpine golangci-lint fmt --diff
143+
endif
154144

155145
.PHONY: test
156146
test:
157-
go test -test.timeout 20m $(TEST_GLOBS)
147+
go test -test.timeout 20m $$(go list ./... | grep -v bindings)
158148

159149
.PHONY: clean
160150
clean:

addons/go.mod

Lines changed: 0 additions & 14 deletions
This file was deleted.

bindings/go.mod

Lines changed: 0 additions & 96 deletions
This file was deleted.

0 commit comments

Comments
 (0)