Skip to content

Commit

Permalink
Add workflow file
Browse files Browse the repository at this point in the history
  • Loading branch information
nagdahimanshu committed Jun 18, 2024
1 parent ec58713 commit 7aa2646
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 142 deletions.
60 changes: 0 additions & 60 deletions .github/workflows/build.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/docker.yml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/pr.yaml
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
33 changes: 0 additions & 33 deletions .github/workflows/release.yml

This file was deleted.

11 changes: 4 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ BLUE = \033[1;34m
GREEN = \033[1;32m
COLOR_END = \033[0;39m

build: build-backend build-frontend
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)"
Expand All @@ -20,7 +20,6 @@ build-frontend: # Builds the frontned application
run: # Runs the application, use `make run FLAGS="--help"`
@./bin/${APP_NAME} ${FLAGS}

.PHONY: test
test: # Runs tests
@echo "Test packages"
@go test -race -shuffle=on -coverprofile=coverage.out -cover $(PKGS)
Expand All @@ -32,22 +31,20 @@ lint: # Runs golangci-lint on the repo
format: # Runs gofmt on the repo
gofmt -s -w .

.PHONY: docker-build
build-image: # Builds docker image
@echo "$(BLUE) Building docker image...$(COLOR_END)"
@echo "$(BLUE)Building docker image...$(COLOR_END)"
@docker build -t $(APP_NAME) .

.PHONY: docker-run
docker-start: # Runs docker image
@echo "$(BLUE) Starting docker container $(APP_NAME)...$(COLOR_END)"
@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)"
@echo "$(BLUE)Stopping and removing docker container $(APP_NAME)...$(COLOR_END)"
@docker rm -f $(APP_NAME)

.PHONY: help
Expand Down
2 changes: 1 addition & 1 deletion internal/chain/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func (b *TxBuild) TransferERC20(ctx context.Context, to string, value *big.Int)
if err = b.client.SendTransaction(ctx, signedTx); err != nil {
log.Error("failed to send tx", "tx hash", signedTx.Hash().String(), "err", err)
if strings.Contains(err.Error(), "nonce") {
b.refreshNonce(context.Background())
b.refreshNonce(ctx)
}
return emptyHash, err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/chain/transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/ethereum/go-ethereum/ethclient/simulated"
)

func TestTxBuilder(t *testing.T) {
func TestTxBuilder_TransferETH(t *testing.T) {
privateKey, _ := crypto.HexToECDSA("976f9f7772781ff6d1c93941129d417c49a209c674056a3cf5e27e225ee55fa8")
fromAddress := crypto.PubkeyToAddress(privateKey.PublicKey)
simBackend := simulated.NewBackend(
Expand Down

0 comments on commit 7aa2646

Please sign in to comment.