Skip to content

Commit

Permalink
Merge pull request #689 from Shrikant1212/configure-binary-build
Browse files Browse the repository at this point in the history
Configure binary build
  • Loading branch information
SkandaBhat authored May 4, 2022
2 parents e7c488d + b0d68a0 commit b6e01b2
Show file tree
Hide file tree
Showing 2 changed files with 139 additions and 0 deletions.
121 changes: 121 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,131 @@ jobs:
command: |
echo "$DOCKERHUB_PASSWORD" | docker login --username "$DOCKERHUB_USERNAME" --password-stdin
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag $IMAGE_NAME:$CIRCLE_TAG .
build-amd:
machine:
image: ubuntu-2004:202101-01
steps:
- checkout
- run:
name: "Installing Go"
command: |
sudo apt-get update
sudo rm -rf /usr/local/go
wget https://dl.google.com/go/go1.17.7.linux-amd64.tar.gz
sudo tar -xvf go1.17.7.linux-amd64.tar.gz
sudo mv go /usr/local
- run:
name: "Check Version"
command: |
go version
node -v
- run:
name: "Installing abigen"
command: |
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update -y
sudo apt-get install ethereum -y
- run:
name: "Start building"
command: |
npm i
npm run build-noargs
- run:
name: "Creating Zip"
command: |
cd build/bin
tar -czvf razor_go.linux-amd64.tar.gz razor
mv razor_go.linux-amd64.tar.gz ../../
- persist_to_workspace:
root: .
paths:
- razor_go.linux-amd64.tar.gz
build-arm:
machine:
image: ubuntu-2004:202101-01
resource_class: arm.medium
steps:
- checkout
- run:
name: "Installing Go"
command: |
sudo apt-get update
sudo rm -rf /usr/local/go
wget https://dl.google.com/go/go1.17.7.linux-arm64.tar.gz
sudo tar -xvf go1.17.7.linux-arm64.tar.gz
sudo mv go /usr/local
- run:
name: "Check Version"
command: |
go version
node -v
- run:
name: "Installing abigen"
command: |
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update -y
sudo apt-get install ethereum -y
- run:
name: "Start building"
command: |
npm i
npm run build-noargs
- run:
name: "Creating Zip"
command: |
cd build/bin
tar -czvf razor_go.linux-arm64.tar.gz razor
mv razor_go.linux-arm64.tar.gz ../../
- persist_to_workspace:
root: .
paths:
- razor_go.linux-arm64.tar.gz

publish-github-release:
docker:
- image: cimg/go:1.17
steps:
- checkout
- attach_workspace:
at: razor_go.linux-amd64.tar.gz
- attach_workspace:
at: razor_go.linux-arm64.tar.gz
- run:
name: "Publish Release on GitHub"
command: |
go get -u github.com/tcnksm/ghr
VERSION=$(git describe --tags --abbrev=0)
mv razor_go.linux-amd64.tar.gz razor_go.${VERSION}.linux-amd64.tar.gz && mv razor_go.linux-arm64.tar.gz razor_go.${VERSION}.linux-arm64.tar.gz
echo "Pushing artifacts echo razor_go.${VERSION}.linux-amd64.tar.gz and razor_go.${VERSION}.linux-arm64.tar.gz"
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${VERSION} razor_go.${VERSION}.linux-amd64.tar.gz
workflows:
tests:
jobs:
- test
publish-github:
jobs:
- build-amd:
filters:
branches:
ignore: /.*/
tags:
only: /^v.*/
- build-arm:
filters:
branches:
ignore: /.*/
tags:
only: /^v.*/
- publish-github-release:
filters:
branches:
ignore: /.*/
tags:
only: /^v.*/
requires:
- build-arm
- build-amd
publish:
jobs:
- push-docker-build:
Expand Down
18 changes: 18 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
version="${VERSION:-v1.0.0}"
bin_dir="${BIN_DIR:-/usr/local/bin}"
platform="${PLATFORM:-amd64}"

wget "https://github.com/razor-network/razor-go/releases/download/$version/razor_go.linux-$platform.tar.gz" \
-O /tmp/razor_go.tar.gz

mkdir -p /tmp/razor_go

cd /tmp || { echo "ERROR! No /tmp found.."; exit 1; }

tar xfz /tmp/razor_go.tar.gz -C /tmp/razor_go || { echo "ERROR! Extracting the razor_go tar"; exit 1; }

cp "/tmp/razor_go/razor" "$bin_dir"
chown root:staff "$bin_dir/razor"

echo "SUCCESS! Installation succeeded!"

0 comments on commit b6e01b2

Please sign in to comment.