Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions .github/workflows/build.yml

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Building natively helps cover cases where cross compilation fails
Building in docker is largely just done to ensure that the docker build itself doesn't break.

Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,24 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- run: sudo apt install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross g++-aarch64-linux-gnu
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.21.8
- run: make NO_DOCKER=true
- run: make NO_DOCKER=true release
docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get Version
id: get_version
run: echo "sn_version=v$(cat shared/version.txt)" >> $GITHUB_OUTPUT
- uses: docker/setup-buildx-action@v3
- uses: docker/bake-action@v6
env:
VERSION: ${{steps.get_version.outputs.sn_version}}
with:
push: false
files: docker/daemon-bake.hcl
targets: smartnode
20 changes: 2 additions & 18 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,21 @@ permissions:
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read
jobs:
detect-modules:
runs-on: ubuntu-latest
outputs:
modules: ${{ steps.set-modules.outputs.modules }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.21.8
- id: set-modules
run: echo "modules=$(go list -m -json | jq -s '.' | jq -c '[.[].Dir]')" >> $GITHUB_OUTPUT
golangci-lint:
needs: detect-modules
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
modules: ${{ fromJSON(needs.detect-modules.outputs.modules) }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.21.8
- name: golangci-lint ${{ matrix.modules }}
- name: golangci-lint
uses: golangci/golangci-lint-action@v8
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v2.1

# Optional: working directory, useful for monorepos
working-directory: ${{ matrix.modules }}
# working-directory: ${{ matrix.modules }}

# Optional: golangci-lint command line arguments.
# args: --issues-exit-code=0
Expand Down
22 changes: 6 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ LOCAL_OS=$(shell go env GOOS)-$(shell go env GOARCH)

BUILD_DIR=build
BIN_DIR=${BUILD_DIR}/${VERSION}/bin
DOCKER_DIR=${BUILD_DIR}/${VERSION}/docker

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

MODULES:=$(foreach path,$(shell find . -name go.mod),$(dir $(path)))
MODULE_GLOBS:=$(foreach module,$(MODULES),$(module)...)
TEST_GLOBS:=$(filter-out ./bindings/...,$(MODULE_GLOBS))

define rocketpool-cli-template
.PHONY: ${BIN_DIR}/rocketpool-cli-$1-$2
${BIN_DIR}/rocketpool-cli-$1-$2: ${bin_deps}
Expand Down Expand Up @@ -91,8 +86,6 @@ endif

${BIN_DIR}:
mkdir -p ${BIN_DIR}
${DOCKER_DIR}:
mkdir -p ${DOCKER_DIR}

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

Expand All @@ -116,7 +109,7 @@ endif

# Docker containers
.PHONY: docker
docker: ${DOCKER_DIR}
docker:
VERSION=${VERSION} docker bake -f docker/daemon-bake.hcl smartnode

.PHONY: docker-push
Expand All @@ -143,18 +136,15 @@ docker-prune:
docker system prune -af
docker buildx prune -af

define lint-template
.PHONY: lint-$1
lint-$1:
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
endef
$(foreach module,$(MODULES),$(eval $(call lint-template,$(module))))
.PHONY: lint
lint: $(foreach module,$(MODULES),lint-$(module))
lint:
ifndef NO_DOCKER
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
endif

.PHONY: test
test:
go test -test.timeout 20m $(TEST_GLOBS)
go test -test.timeout 20m $$(go list ./... | grep -v bindings)

.PHONY: clean
clean:
Expand Down
14 changes: 0 additions & 14 deletions addons/go.mod

This file was deleted.

96 changes: 0 additions & 96 deletions bindings/go.mod

This file was deleted.

Loading
Loading