Skip to content

Commit

Permalink
Merge pull request #32 from xrplevm/chore/bump-to-v3
Browse files Browse the repository at this point in the history
Bump to verison 3
  • Loading branch information
AdriaCarrera authored Aug 26, 2024
2 parents 3ef598c + b5a293a commit c5bb2a5
Show file tree
Hide file tree
Showing 80 changed files with 1,150 additions and 586 deletions.
18 changes: 16 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
.github
.gitignore
.idea
*Dockerfile
Dockerfile
release
build
build
.dockerignore

vue/node_modules
vue/dist
build/
release/
.idea/
.vscode/
.DS_Store


.exrpd/

bin/
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ release/
.DS_Store


.exrpd/
.exrpd/

bin/
65 changes: 58 additions & 7 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,59 @@
run:
timeout: 10m
skip-dirs:
- docs
issues:
exclude:
# Exclude deprecated rule
- SA1019
tests: true
timeout: 5m
concurrency: 4

linters:
enable:
- dogsled
- dupl
- errcheck
- goconst
- gocritic
- gofumpt
- revive
- gosec
- gosimple
- govet
- ineffassign
- misspell
- nakedret
- prealloc
- exportloopref
- staticcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- nolintlint
- asciicheck
- exportloopref
- gofumpt
- gomodguard

linters-settings:
dogsled:
max-blank-identifiers: 3
golint:
min-confidence: 0
maligned:
suggest-new: true
misspell:
locale: US
nolintlint:
allow-unused: false
allow-leading-space: true
require-explanation: false
require-specific: false
gofumpt:
lang-version: "1.22"
gomodguard:
blocked:
versions: # List of blocked module version constraints
- https://github.com/etcd-io/etcd: # Blocked module with version constraint
version: ">= 3.4.10 || ~3.3.23" # Version constraint, see https://github.com/Masterminds/semver#basic-comparisons
reason: "CVE-2020-15114; CVE-2020-15136; CVE-2020-15115" # Reason why the version constraint exists. (Optional)
- https://github.com/dgrijalva/jwt-go: # Blocked module with version constraint
version: ">= 4.0.0-preview1" # Version constraint, see https://github.com/Masterminds/semver#basic-comparisons
reason: "CVE-2020-26160" # Reason why the version constraint exists. (Optional)
39 changes: 24 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,44 @@
FROM golang:1.20 AS base
FROM golang:1.22.2 AS base
USER root
RUN apt update && \
apt-get install -y \
build-essential \
ca-certificates \
curl
RUN curl https://get.ignite.com/cli@v0.27.2! | bash
WORKDIR /go/src/github.com/xrplevm/node
ca-certificates
WORKDIR /app
COPY . .
RUN make install


FROM base AS build
ARG VERSION=0.0.0
RUN ignite chain build --release --release.prefix exrp_$VERSION -t linux:amd64 -v
RUN tar -xf /go/src/github.com/xrplevm/node/release/exrp_${VERSION}_linux_amd64.tar.gz -C /usr/bin
RUN make build


FROM base AS integration
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
RUN golangci-lint run
RUN make lint
# Unit tests
RUN go test $(go list ./... | grep -v github.com/xrplevm/node/tests/e2e/poa)
RUN go test $(go list ./... | grep -v github.com/xrplevm/node/v2/tests/e2e)
# End to end tests
# TODO: Temporary disabled e2e tests
# RUN TEST_CLEANUP_DIR=false go test -p 1 -v -timeout 30m ./tests/e2e/...
RUN <<EOF
#!/bin/bash
retry() {
local retries="$1"
local command="$2"
$command
local exit_code=$?
if [[ $exit_code -ne 0 && $retries -gt 0 ]]; then
retry $(($retries - 1)) "$command"
else
return $exit_code
fi
}
retry 5 "go test -p 1 -v -timeout 30m ./tests/e2e/..."
EOF
RUN touch /test.lock

FROM golang:1.20 AS release
FROM golang:1.22.2 AS release
WORKDIR /
COPY --from=integration /test.lock /test.lock
COPY --from=build /go/src/github.com/xrplevm/node/release /binaries
COPY --from=build /usr/bin/exrpd /usr/bin/exrpd
COPY --from=build /app/bin/exrpd /usr/bin/exrpd
ENTRYPOINT ["/bin/sh", "-ec"]
CMD ["exrpd"]
37 changes: 27 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,31 @@ endif

#$(info $$BUILD_FLAGS is [$(BUILD_FLAGS)])

all: install
@echo "--> project root: go mod tidy"
@go mod tidy
@echo "--> project root: linting --fix"
@GOGC=1 golangci-lint run --fix --timeout=8m
all: install lint

install: go.sum
go install -mod=readonly $(BUILD_FLAGS) ./cmd/exrpd

build:
go build $(BUILD_FLAGS) -o bin/exrpd ./cmd/exrpd
go build $(BUILD_FLAGS) -o ./bin/exrpd ./cmd/exrpd


###############################################################################
### Linting ###
###############################################################################
golangci_lint_cmd=golangci-lint
golangci_version=v1.53.3

lint:
@echo "--> Running linter"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
@$(golangci_lint_cmd) run --timeout=10m

lint-fix:
@echo "--> Running linter"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
@$(golangci_lint_cmd) run --fix --out-format=tab --issues-exit-code=0



###############################################################################
Expand All @@ -114,12 +128,11 @@ proto-all: proto-format proto-lint proto-gen

proto-gen:
@echo "Generating Protobuf files"
@$(protoImage) sh ./scripts/protocgen.sh
@$(protoImage) sh ./proto/scripts/protocgen.sh

proto-swagger-gen:
@echo "Generating Protobuf Swagger"
@$(protoImage) sh ./scripts/protoc-swagger-gen.sh
$(MAKE) update-swagger-docs
@$(protoImage) sh ./proto/scripts/protoc-swagger-gen.sh

proto-format:
@$(protoImage) find ./ -name "*.proto" -exec clang-format -i {} \;
Expand All @@ -130,4 +143,8 @@ proto-lint:
proto-check-breaking:
@$(protoImage) buf breaking --against $(HTTPS_GIT)#branch=main

.PHONY: proto-all proto-gen proto-gen-any proto-swagger-gen proto-format proto-lint proto-check-breaking proto-update-deps docs
proto-update-deps:
@echo "Updating Protobuf dependencies"
$(DOCKER) run --rm -v $(CURDIR)/proto:/workspace --workdir /workspace $(protoImageName) buf mod update

.PHONY: proto-all proto-gen proto-swagger-gen proto-format proto-lint proto-check-breaking proto-update-deps
Loading

0 comments on commit c5bb2a5

Please sign in to comment.