fix: added context parameter to functions to sync with updated generic retry function to make build successful #139
Workflow file for this run
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
--- | |
name: CI/CD Pipeline | |
on: | |
push: | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- "*" | |
types: | |
- opened | |
- synchronize | |
permissions: | |
contents: write | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
- name: Setup Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.21 | |
- name: Install Dependencies | |
run: > | |
sudo add-apt-repository -y ppa:ethereum/ethereum | |
sudo apt-get update | |
sudo apt-get install -y npm ethereum | |
npm install | |
go get -d github.com/ethereum/go-ethereum@v1.12.2 \ | |
&& go install github.com/ethereum/go-ethereum/cmd/abigen@v1.12.2 \ | |
&& go install github.com/mattn/goveralls@v0.0.11 \ | |
&& go install github.com/ory/go-acc@v0.2.7 \ | |
&& go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.2 | |
- name: Run make setup for mainnet | |
run: make setup | |
- name: Run gofmt | |
run: | | |
gofmt | |
- name: Run golangci-lint | |
run: | | |
golangci-lint run -v --timeout 5m | |
- name: Execute test case | |
run: > | |
go-acc ./... --ignore razor/accounts/mocks --ignore razor/cmd/mocks | |
--ignore razor/utils/mocks --ignore pkg --ignore razor/path/mocks | |
--output coverage.txt | |
- name: Run benchmarks | |
run: | | |
go test ./... -bench=. -run=^# | |
- name: Publish Coverage to Coveralls.io | |
env: | |
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: goveralls -coverprofile=coverage.txt -service=github | |
- uses: bissolli/gh-action-persist-workspace@v1 | |
with: | |
action: persist | |
build-amd: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
- name: Setup Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.21 | |
- name: Install Dependencies | |
run: > | |
sudo add-apt-repository -y ppa:ethereum/ethereum | |
sudo apt-get update | |
sudo apt-get install -y npm ethereum | |
npm install | |
go get -d github.com/ethereum/go-ethereum@v1.12.2 \ | |
&& go install github.com/ethereum/go-ethereum/cmd/abigen@v1.12.2 \ | |
&& go install github.com/mattn/goveralls@v0.0.11 \ | |
&& go install github.com/ory/go-acc@v0.2.7 \ | |
&& go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.2 | |
- name: Create AMD Artifact | |
run: | | |
# ... [commands to create AMD artifact] | |
make setup | |
GOOS=linux GOARCH=amd64 go build -o ./build/bin/razor_go.linux-amd64 main.go | |
cd build/bin | |
tar -czvf razor_go.linux-amd64.tar.gz razor_go.linux-amd64 | |
mv razor_go.linux-amd64.tar.gz ../../ | |
- name: Upload AMD Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: razor_go.linux-amd64.tar.gz | |
path: razor_go.linux-amd64.tar.gz | |
build-arm: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
- name: Setup Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.21 | |
- name: Install Dependencies | |
run: > | |
sudo add-apt-repository -y ppa:ethereum/ethereum | |
sudo apt-get update | |
sudo apt-get install -y npm ethereum | |
npm install | |
go get -d github.com/ethereum/go-ethereum@v1.12.2 \ | |
&& go install github.com/ethereum/go-ethereum/cmd/abigen@v1.12.2 \ | |
&& go install github.com/mattn/goveralls@v0.0.11 \ | |
&& go install github.com/ory/go-acc@v0.2.7 \ | |
&& go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.2 | |
- name: Create ARM Artifact | |
run: | | |
# ... [commands to create ARM artifact] | |
make setup | |
GOOS=linux GOARCH=arm64 go build -o ./build/bin/razor_go.linux-arm64 main.go | |
cd build/bin | |
tar -czvf razor_go.linux-arm64.tar.gz razor_go.linux-arm64 | |
mv razor_go.linux-arm64.tar.gz ../../ | |
- name: Upload ARM Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: razor_go.linux-arm64.tar.gz | |
path: razor_go.linux-arm64.tar.gz | |
publish-github-release: | |
runs-on: ubuntu-latest | |
needs: | |
- build-amd | |
- build-arm | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
- name: Download Artifacts AMD | |
uses: actions/download-artifact@v3 | |
with: | |
name: razor_go.linux-amd64.tar.gz | |
- name: Download Artifacts ARM | |
uses: actions/download-artifact@v3 | |
with: | |
name: razor_go.linux-arm64.tar.gz | |
- name: Display structure of downloaded files | |
run: ls -R | |
- name: Publish Release on GitHub | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
generate_release_notes: true | |
files: | | |
razor_go.linux-arm64.tar.gz | |
razor_go.linux-amd64.tar.gz | |
push-docker-build: | |
runs-on: ubuntu-latest | |
needs: test | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Extract tag name | |
id: extract_tag | |
run: echo "::set-output name=tag_name::${GITHUB_REF#refs/tags/}" | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
file: ./Dockerfile.mainnet | |
context: . | |
platforms: linux/amd64,linux/arm64/v8 | |
push: true | |
tags: razornetwork/razor-go:${{ steps.extract_tag.outputs.tag_name }} | |