Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Releases/v1.1.0 #1163

Merged
merged 17 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
&& go install github.com/ory/[email protected] \

&& go install github.com/golangci/golangci-lint/cmd/[email protected]
- name: Run make setup
- name: Run make setup for mainnet
run: make setup
- name: Run gofmt
run: |
Expand Down Expand Up @@ -238,8 +238,9 @@ jobs:
run: echo "::set-output name=tag_name::${GITHUB_REF#refs/tags/}"

- name: Build and push Docker image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
file: ./Dockerfile.mainnet
context: .
platforms: linux/amd64,linux/arm64/v8
push: true
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ jobs:
go install github.com/ory/[email protected]
go install github.com/golangci/golangci-lint/cmd/[email protected]

- name: Run make setup
run: make setup
- name: Run make setup for testnet
run: make setup-testnet
- name: Run gofmt
run: |
gofmt
Expand Down Expand Up @@ -87,8 +87,9 @@ jobs:
id: sha
run: echo "::set-output name=short::$(git rev-parse --short HEAD)"
- name: Build and push Docker image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
file: ./Dockerfile.testnet
context: .
platforms: linux/amd64,linux/arm64/v8
push: true
Expand Down
96 changes: 96 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: CI/CD Release Pipeline
on:
push:
branches:
- "releases/*"

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.21
- name: Cache npm modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Cache Go dependencies
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- 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/[email protected]
go install github.com/ethereum/go-ethereum/cmd/[email protected]
go install github.com/mattn/[email protected]
go install github.com/ory/[email protected]
go install github.com/golangci/golangci-lint/cmd/[email protected]

- 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

push-docker-build:
runs-on: ubuntu-latest
needs: test
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: Get short SHA
id: sha
run: echo "::set-output name=short::$(git rev-parse --short HEAD)"
- 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.sha.outputs.short }}
File renamed without changes.
27 changes: 27 additions & 0 deletions Dockerfile.testnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM golang:1.21.1-alpine AS go
FROM ethereum/client-go:alltools-v1.12.2 AS ethereum

FROM node:18.18.0-alpine AS builder

COPY --from=ethereum /usr/local/bin/abigen /usr/local/bin/
COPY --from=go /usr/local/go/ /usr/local/go/

## Attaching current dir to workdir
WORKDIR /app
COPY . /app

## Install and Cleanup

RUN PATH="/usr/local/go/bin:${PATH}" \
&& apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python \
&& apk add --update make gcc musl musl-dev g++ libc-dev bash linux-headers \
&& apk add --no-cache jq \
&& npm install \
&& npm run build-noargs-testnet \
&& cp build/bin/razor /usr/local/bin/


FROM alpine:latest
RUN apk add --update bash
COPY --from=builder /usr/local/bin/razor /usr/local/bin/
ENTRYPOINT [ "razor" ]
35 changes: 30 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,43 @@ SHELL = /bin/bash
BIN_DIR = ./build/bin
RAZOR = ${BIN_DIR}/razor

all: fetch_bindings install_razor set_config
all: update_chainId fetch_bindings install_razor set_config
build: install_razor set_config
build-noargs: fetch_bindings install_razor
setup: fetch_bindings
build-noargs: update_chainId fetch_bindings install_razor
setup: update_chainId fetch_bindings

all-testnet: update_chainId_testnet fetch_bindings_testnet install_razor set_config
build-noargs-testnet: update_chainId_testnet fetch_bindings_testnet install_razor
setup-testnet: update_chainId_testnet fetch_bindings_testnet

fetch_bindings:
@echo "Installing contract dependencies..."
@echo ""
@${SHELL} generate-bindings.sh
@${SHELL} generate-bindings.sh mainnet
@echo "Contract bindings generated...."
@echo ""

fetch_bindings_testnet:
@echo "Installing contract dependencies..."
@echo ""
@${SHELL} generate-bindings.sh testnet
@echo "Contract bindings generated...."
@echo ""

update_chainId:
@echo "Update chainId..."
@echo ""
@${SHELL} update-chainId.sh mainnet
@echo "ChainId updated to mainnet...."
@echo ""

update_chainId_testnet:
@echo "Update chainId..."
@echo ""
@${SHELL} update-chainId.sh testnet
@echo "ChainId updated to testnet...."
@echo ""

install_razor:
@echo "Installing razor node...."
${GO} build -ldflags "-s -w" -o ./build/bin/razor main.go
Expand All @@ -25,4 +50,4 @@ set_config:
@echo "Setup initial config"
@${SHELL} config.sh
@echo ""
@echo "Razor node is set up and ready to use"
@echo "Razor node is set up and ready to use"
Loading
Loading