Merge pull request #6 from openrelayxyz/github-releases

circleci: Adding ability to push releases to github.
This commit is contained in:
philip-morlier 2021-10-18 14:54:49 -07:00 committed by GitHub
commit 99fedadd4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,16 +1,40 @@
# orbs:
# aws-cli: circleci/aws-cli@1.0.0 #See: https://circleci.com/orbs/registry/orb/circleci/aws-cli
version: 2.1 version: 2.1
jobs: jobs:
test: test:
docker: docker:
- image: cimg/go:1.16 - image: cimg/go:1.17.2
steps: steps:
- checkout - checkout
- run:
name: Prep env
command: |
mkdir -p /home/circleci/go/src
mkdir artifacts
go mod tidy
- run:
name: test rpc
command: go test ./rpc/
- run:
name: test eth
command: go test ./eth/
- run:
name: test eth/tracers
command: go test ./eth/tracers/
- run:
name: test core
command: go test ./core/
- run:
name: test core/vm
command: go test ./core/vm/
- run:
name: test core/state
command: go test ./core/state/
- run:
name: test core/rawdb
command: go test ./core/rawdb/
build_geth_push: build_geth_push:
docker: # run the steps with Docker docker: # run the steps with Docker
- image: cimg/go:1.16 # ...with this image as the primary container - image: cimg/go:1.17.2 # ...with this image as the primary container
# this is where all `steps` will run # this is where all `steps` will run
steps: steps:
- checkout - checkout
@ -19,79 +43,45 @@ jobs:
name: Prep env name: Prep env
command: | command: |
mkdir -p /home/circleci/go/src mkdir -p /home/circleci/go/src
go get mkdir artifacts
go mod tidy
- run: - run:
name: build geth binaries name: build geth binaries
command: | command: |
sudo apt update sudo apt update
sudo apt install gcc-aarch64-linux-gnu libc6-dev-arm64-cross wget -y sudo apt install gcc-aarch64-linux-gnu libc6-dev-arm64-cross wget -y
PLUGETH_UTILS_VERSION=$(grep "github.com/openrelayxyz/plugeth-utils v" go.mod | cut -d ' ' -f 2)
export GOPATH=$HOME/go export GOPATH=$HOME/go
export GOARCH=amd64 export GOARCH=amd64
go build -o geth-amd64 ./cmd/geth export PLUGETH_UTILS_VERSION=$(grep "github.com/openrelayxyz/plugeth-utils v" go.mod | cut -d ' ' -f 2)
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOARCH=arm64 go build -o geth-arm64 ./cmd/geth go build -o ./artifacts/geth-linux-amd64-$PLUGETH_UTILS_VERSION-${CIRCLE_TAG} ./cmd/geth
# - run: CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOARCH=arm64 go build -o ./artifacts/geth-linux-arm64-$PLUGETH_UTILS_VERSION-${CIRCLE_TAG} ./cmd/geth
# name: build image
# command: |
# export GOPATH=$HOME/go
# make geth-linux-amd64
# - aws-cli/setup: #See: https://circleci.com/orbs/registry/orb/circleci/aws-cli
# aws-access-key-id: ACCESS_KEY_ID
# aws-secret-access-key: SECRET_ACCESS_KEY
# aws-region: AWS_REGION
# - run:
# name: push to s3
# command: aws s3 cp ./geth-amd64 s3://ethercattle-binaries/$CIRCLE_TAG/geth-linux-amd64 --acl=public-read
# - run:
# name: push to s3
# command: aws s3 cp ./geth-arm64 s3://ethercattle-binaries/$CIRCLE_TAG/geth-linux-arm64 --acl=public-read
# - run:
# name: Message Slack
# command: |
# ./slack-post.sh -w $SlackWebhook -m "*go-ethereum*:\nTag: $CIRCLE_TAG \n $(jq -r '.builds[0].artifact_id' ./manifest.json)"
build_plugins:
docker: # run the steps with Docker
- image: cimg/go:1.16 # ...with this image as the primary container
# this is where all `steps` will run
steps:
- checkout
- setup_remote_docker
- run: - run:
name: Prep env name: "Publish Release on GitHub"
command: | command: |
mkdir -p /home/circleci/go/src go get github.com/tcnksm/ghr
go get PLUGETH_UTILS_VERSION=$(grep "github.com/openrelayxyz/plugeth-utils v" go.mod | cut -d ' ' -f 2)
- run: NAME=plugeth-$PLUGETH_UTILS_VERSION-${CIRCLE_TAG}
name: build plugins VERSION=${CIRCLE_TAG}
command: | ghr -draft -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -name $NAME -delete ${VERSION} ./artifacts/
sudo apt update
sudo apt install gcc-aarch64-linux-gnu libc6-dev-arm64-cross wget -y
export GOPATH=$HOME/go
export GOARCH=amd64
mkdir plugin-artifacts
for x in $($(which ls) -1 plugins/packages); do go build -buildmode=plugin -o plugin-artifacts/$x.so ./plugins/packages/$x ; done
workflows: workflows:
version: 2 version: 2
test:
jobs:
- test:
filters:
tags:
ignore: /^v.*/
build_and_test: build_and_test:
jobs: jobs:
# - test: - test:
# filters: # required since `deploy` has tag filters AND requires `build`
# tags:
# only: /.*/
- build_plugins:
# requires:
# - test
filters: filters:
tags: tags:
only: /^v.*/ only: /^v.*/
branches: branches:
ignore: /.*/ ignore: /.*/
- build_geth_push: - build_geth_push:
# requires: requires:
# - test - test
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/