File tree Expand file tree Collapse file tree 4 files changed +56
-22
lines changed
Expand file tree Collapse file tree 4 files changed +56
-22
lines changed Original file line number Diff line number Diff line change @@ -13,29 +13,40 @@ permissions:
1313 # Optional: allow read access to pull request. Use with `only-new-issues` option.
1414 # pull-requests: read
1515jobs :
16- golangci :
17- name : lint
16+ detect-modules :
1817 runs-on : ubuntu-latest
18+ outputs :
19+ modules : ${{ steps.set-modules.outputs.modules }}
1920 steps :
20- - uses : actions/setup-go@v4
21+ - uses : actions/checkout@v4
22+ - uses : actions/setup-go@v5
2123 with :
2224 go-version : 1.21.8
23- - uses : actions/checkout@v3
24- - name : golangci-lint
25- uses : golangci/golangci-lint-action@v4
25+ - id : set-modules
26+ run : echo "modules=$(go list -m -json | jq -s '.' | jq -c '[.[].Dir]')" >> $GITHUB_OUTPUT
27+ golangci-lint :
28+ needs : detect-modules
29+ runs-on : ubuntu-latest
30+ strategy :
31+ matrix :
32+ modules : ${{ fromJSON(needs.detect-modules.outputs.modules) }}
33+ steps :
34+ - uses : actions/checkout@v4
35+ - uses : actions/setup-go@v5
36+ with :
37+ go-version : 1.21.8
38+ - name : golangci-lint ${{ matrix.modules }}
39+ uses : golangci/golangci-lint-action@v8
2640 with :
2741 # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
28- version : latest
42+ version : v2.1
2943
3044 # Optional: working directory, useful for monorepos
31- # working-directory: somedir
45+ working-directory : ${{ matrix.modules }}
3246
3347 # Optional: golangci-lint command line arguments.
3448 # args: --issues-exit-code=0
3549
36- # For now, Smart Node will only enforce goimports linting
37- args : --disable-all --enable goimports addons/... shared/... rocketpool/... rocketpool-cli/...
38-
3950 # Optional: show only new issues if it's a pull request. The default value is `false`.
4051 # only-new-issues: true
4152
Original file line number Diff line number Diff line change 1+ version : " 2"
2+ linters :
3+ default : none
4+ formatters :
5+ enable :
6+ - goimports
7+ run :
8+ relative-path-mode : cfg
9+ go : ' 1.21.8'
10+ output :
11+ formats :
12+ text :
13+ path : stderr
Original file line number Diff line number Diff line change @@ -63,15 +63,19 @@ docker:
6363 docker manifest create rocketpool/smartnode:${VERSION} --amend rocketpool/smartnode:${VERSION} -amd64 --amend rocketpool/smartnode:${VERSION} -arm64
6464 docker manifest create rocketpool/smartnode:latest --amend rocketpool/smartnode:${VERSION} -amd64 --amend rocketpool/smartnode:${VERSION} -arm64
6565
66- .PHONY : clean
67- clean :
68- rm -rf ${BUILD_DIR}
69-
66+ define lint-template
67+ .PHONY: lint-$1
68+ lint-$1:
69+ docker run --rm -v .:/go/smartnode --workdir /go/smartnode/$1 golangci/golangci-lint:v2.1-alpine golangci-lint fmt --diff
70+ endef
71+ $(foreach module,$(MODULES),$(eval $(call lint-template,$(module))))
7072.PHONY : lint
71- lint :
72- @echo $(MODULE_GLOBS )
73- docker run --rm -v .:/go/smartnode --workdir /go/smartnode golangci/golangci-lint:v2.1-alpine golangci-lint fmt --enable goimports $(MODULE_GLOBS )
73+ lint : $(foreach module,$(MODULES ) ,lint-$(module ) )
7474
7575.PHONY : test
7676test :
7777 go test -test.timeout 20m $(MODULE_GLOBS )
78+
79+ .PHONY : clean
80+ clean :
81+ rm -rf ${BUILD_DIR}
Original file line number Diff line number Diff line change @@ -28,11 +28,17 @@ See the [Smartnode Installer](https://github.com/rocket-pool/smartnode-install)
2828
2929A [ Makefile] ( ./Makefile ) is included for building, testing, and linting.
3030
31- * ` make all ` will build rocketpool-cli, rocketpool-daemon, and run the linter.
32- * ` make rocketpool-daemon ` will build the docker containers required to build the daemon, then build the daemon.
33- * ` make rocketpool-cli ` will build the cli for linux and osx.
31+ * ` make ` or ` make all ` will build rocketpool-cli, rocketpool-daemon, and run the linter.
32+ * build/rocketpool-cli and build/rocketpool-daemon will be symlinked to the version and architecture specific binaries in build/
33+ * ` make release ` will build all architecture specific binaries as well as docker images and manifests
34+ * It will tag docker images as latest as well as the version in ` shared/version.txt `
35+ * It will put cli and native mode binaries in build/\< version\>
36+ * ` make build/rocketpool-cli ` builds just the cli
37+ * ` make build/rocketpool-daemon ` builds just the daemon
38+ * ` make docker ` builds the rocketpool/smartnode container and tags it with latest as well as the version from ` shared/version.txt `
39+ * ` make lint ` runs the linter.
3440* ` make test ` runs all unit tests.
35- * ` make clean ` deletes any binaries. It does not clear your go caches.
41+ * ` make clean ` deletes any binaries. It does not clear your go caches. It does not clean up old docker images.
3642
3743## CLI Commands
3844
You can’t perform that action at this time.
0 commit comments