forked from chainflag/eth-faucet
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 🌱 Update UI * Add unit tests * 🔨 Code refactoring * 🌱 Add Makefile * Add workflow file * 👌 Applied suggestions * 👌 Applied suggestions * Add unit test for TransferERC20 method
- Loading branch information
1 parent
0c59d9a
commit 465997e
Showing
18 changed files
with
224 additions
and
188 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# This workflow will build a golang project | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | ||
|
||
name: 'PR CI' | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: setup-go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.22' | ||
- name: build | ||
run: make build | ||
- name: golangci-lint | ||
run: make lint | ||
- name: format | ||
run: | | ||
make format | ||
if [ -z "$(git status --untracked-files=no --porcelain)" ]; then | ||
echo "All files formatted" | ||
else | ||
echo "Running format is required" | ||
exit 1 | ||
fi | ||
- name: test | ||
run: make test |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
run: | ||
timeout: 5m | ||
skip-dirs: | ||
exclude-dirs: | ||
- .github | ||
- web | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
|
||
APP_NAME = lsk-faucet | ||
PKGS=$(shell go list ./... | grep -v "/vendor/") | ||
BLUE = \033[1;34m | ||
GREEN = \033[1;32m | ||
COLOR_END = \033[0;39m | ||
|
||
build: build-frontend build-backend | ||
|
||
build-backend: # Builds the application and create a binary at ./bin/ | ||
@echo "$(BLUE)» Building $(APP_NAME) application binary... $(COLOR_END)" | ||
@go build -a -o bin/$(APP_NAME) . | ||
@echo "$(GREEN)Binary successfully built$(COLOR_END)" | ||
|
||
build-frontend: # Builds the frontned application | ||
@echo "$(BLUE)» Building frontend... $(COLOR_END)" | ||
@go generate | ||
@echo "$(GREEN)Frontend successfully built$(COLOR_END)" | ||
|
||
run: # Runs the application, use `make run FLAGS="--help"` | ||
@./bin/${APP_NAME} ${FLAGS} | ||
|
||
test: # Runs tests | ||
@echo "Test packages" | ||
@go test -race -shuffle=on -coverprofile=coverage.out -cover $(PKGS) | ||
|
||
lint: # Runs golangci-lint on the repo | ||
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest | ||
golangci-lint run | ||
|
||
format: # Runs gofmt on the repo | ||
gofmt -s -w . | ||
|
||
build-image: # Builds docker image | ||
@echo "$(BLUE)Building docker image...$(COLOR_END)" | ||
@docker build -t $(APP_NAME) . | ||
|
||
docker-start: # Runs docker image | ||
@echo "$(BLUE)Starting docker container $(APP_NAME)...$(COLOR_END)" | ||
ifdef PRIVATE_KEY | ||
@docker run --name $(APP_NAME) -p 8080:8080 -d -e WEB3_PROVIDER=$(WEB3_PROVIDER) -e PRIVATE_KEY=$(PRIVATE_KEY) $(APP_NAME) | ||
else ifdef KEYSTORE | ||
@docker run --name $(APP_NAME) -p 8080:8080 -d -e WEB3_PROVIDER=$(WEB3_PROVIDER) -e KEYSTORE=$(KEYSTORE) -v $(KEYSTORE)/keystore:/app/keystore -v $(KEYSTORE)/password.txt:/app/password.txt $(APP_NAME) | ||
endif | ||
|
||
docker-stop: | ||
@echo "$(BLUE)Stopping and removing docker container $(APP_NAME)...$(COLOR_END)" | ||
@docker rm -f $(APP_NAME) | ||
|
||
.PHONY: help | ||
help: # Show help for each of the Makefile recipes | ||
@grep -E '^[a-zA-Z0-9 -]+:.*#' Makefile | sort | while read -r l; do printf "$(GREEN)$$(echo $$l | cut -f 1 -d':')$(COLOR_END):$$(echo $$l | cut -f 2- -d'#')\n"; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.