From f1c96944f8e5101ff5bb7b42f4cc09d7c43f0e6c Mon Sep 17 00:00:00 2001 From: Madhur Shrimal Date: Sat, 2 Dec 2023 20:41:10 -0800 Subject: [PATCH] add pipelines (#10) * add pipelines --- .github/dependabot.yml | 11 ++++++++++ .github/workflows/build.yml | 19 ++++++++++++++++ .github/workflows/golangci-lint.yml | 22 +++++++++++++++++++ .../workflows/{unit-tests.yml => tests.yml} | 6 ++--- Makefile | 20 +++++++++++++++-- pkg/operator/keys/import.go | 2 +- 6 files changed, 74 insertions(+), 6 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/golangci-lint.yml rename .github/workflows/{unit-tests.yml => tests.yml} (81%) diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..81c33fa0 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "gomod" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..07ffcb13 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,19 @@ +name: build + +on: + push: + branches: + - master + pull_request: + +jobs: + Test: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version: '1.21' + - name: Build + run: make build \ No newline at end of file diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 00000000..15ad759d --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,22 @@ +name: lint + +on: + push: + branches: + - master + pull_request: + +jobs: + Lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version: '1.21' + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: latest + args: --timeout 3m \ No newline at end of file diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/tests.yml similarity index 81% rename from .github/workflows/unit-tests.yml rename to .github/workflows/tests.yml index 7545f55f..47761cc6 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: unit-tests +name: tests on: push: @@ -8,12 +8,12 @@ on: jobs: Test: - name: Test + name: Unit Test runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v4 with: go-version: '1.21' - - name: Test + - name: Unit Test run: make tests \ No newline at end of file diff --git a/Makefile b/Makefile index 76ff8fca..8d64385b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: help build tests mocks +.PHONY: help build tests mocks fmt format-lines lint install build-linux-amd64 build-linux-arm64 build-linux include .env @@ -26,4 +26,20 @@ fmt: ## formats all go files format-lines: ## formats all go files with golines go install github.com/segmentio/golines@latest - golines -w -m 120 --ignore-generated --shorten-comments --ignored-dirs=${GO_LINES_IGNORED_DIRS} ${GO_FOLDERS} \ No newline at end of file + golines -w -m 120 --ignore-generated --shorten-comments --ignored-dirs=${GO_LINES_IGNORED_DIRS} ${GO_FOLDERS} + +lint: ## runs all linters + go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest + golangci-lint run ./... + +install: build ## compile the binary and copy it to PATH + @sudo cp bin/$(APP_NAME) /usr/local/bin + +build-linux-amd64: ## Compile the binary for amd64 + @env GOOS=linux GOARCH=amd64 go build -o bin/$(APP_NAME)-linux-amd64 cmd/$(APP_NAME)/main.go + +build-linux-arm64: ## Compile the binary for arm64 + @env GOOS=linux GOARCH=arm64 go build -o bin/$(APP_NAME)-linux-arm64 cmd/$(APP_NAME)/main.go + +build-linux: ## Compile the binary for linux + @env GOOS=linux go build -o bin/$(APP_NAME) cmd/$(APP_NAME)/main.go diff --git a/pkg/operator/keys/import.go b/pkg/operator/keys/import.go index 532d5a88..8e2e5f3e 100644 --- a/pkg/operator/keys/import.go +++ b/pkg/operator/keys/import.go @@ -66,7 +66,7 @@ This command will import keys in $HOME/.eigenlayer/operator_keys/ location case KeyTypeBLS: privateKeyBigInt := new(big.Int) _, ok := privateKeyBigInt.SetString(privateKey, 10) - blsKeyPair := new(bls.KeyPair) + var blsKeyPair *bls.KeyPair var err error if ok { fmt.Println("Importing from large integer")