mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
* build universe docker image * build universe docker image * build universe docker image --------- Co-authored-by: Liam Lai <liam.lai@datameshgroup.com.au>
168 lines
6.1 KiB
YAML
168 lines
6.1 KiB
YAML
sudo: required
|
|
language: go
|
|
go_import_path: github.com/XinFinOrg/XDPoSChain
|
|
|
|
on:
|
|
branches:
|
|
- master
|
|
- dev-upgrade
|
|
tags: true
|
|
|
|
env:
|
|
global:
|
|
- GOPROXY=https://proxy.golang.org
|
|
- GO111MODULE=on
|
|
# Terraform env
|
|
- tf_version=1.3.0
|
|
# Setting terraform init CLI options - https://www.terraform.io/docs/commands/init.html
|
|
- tf_init_cli_options=" -input=false"
|
|
# Set terraform validation CLI options - https://www.terraform.io/docs/commands/validate.html
|
|
- tf_validation_cli_options=""
|
|
# Set terraform plan CLI options - https://www.terraform.io/docs/commands/plan.html
|
|
- tf_plan_cli_options=" -lock=false -input=false"
|
|
# Set terraform apply CLI options - https://www.terraform.io/docs/commands/apply.html
|
|
- tf_apply_cli_options=" -auto-approve -input=false"
|
|
|
|
|
|
jobs:
|
|
include:
|
|
- stage: Tests
|
|
os: linux
|
|
dist: bionic
|
|
go: 1.14.x
|
|
env:
|
|
- GO111MODULE=auto
|
|
name: A-B tests
|
|
script: travis_retry go run build/ci.go test -coverage $(go list ./... | grep "github.com\/XinFinOrg\/XDPoSChain\/[a-b].*")
|
|
- script: travis_retry go run build/ci.go test -coverage $(go list ./... | grep "github.com\/XinFinOrg\/XDPoSChain\/c[a-m].*")
|
|
os: linux
|
|
dist: bionic
|
|
go: 1.14.x
|
|
env:
|
|
- GO111MODULE=auto
|
|
name: C-[a-m] tests
|
|
- script: travis_retry go run build/ci.go test -coverage $(go list ./... | grep "github.com\/XinFinOrg\/XDPoSChain\/c[n-o].*")
|
|
os: linux
|
|
dist: bionic
|
|
go: 1.14.x
|
|
env:
|
|
- GO111MODULE=auto
|
|
name: C-[n-o] tests
|
|
- script: travis_retry go run build/ci.go test -coverage $(go list ./... | grep "github.com\/XinFinOrg\/XDPoSChain\/c[p-z].*")
|
|
os: linux
|
|
dist: bionic
|
|
go: 1.14.x
|
|
env:
|
|
- GO111MODULE=auto
|
|
name: C-[p-z] tests
|
|
- script: travis_retry go run build/ci.go test -coverage $(go list ./... | grep "github.com\/XinFinOrg\/XDPoSChain\/[d-i].*")
|
|
os: linux
|
|
dist: bionic
|
|
go: 1.14.x
|
|
env:
|
|
- GO111MODULE=auto
|
|
name: D-I tests
|
|
- script: travis_retry go run build/ci.go test -coverage $(go list ./... | grep "github.com\/XinFinOrg\/XDPoSChain\/[j-n].*")
|
|
os: linux
|
|
dist: bionic
|
|
go: 1.14.x
|
|
env:
|
|
- GO111MODULE=auto
|
|
name: J-N tests
|
|
- script: travis_retry go run build/ci.go test -coverage $(go list ./... | grep "github.com\/XinFinOrg\/XDPoSChain\/[o-r].*")
|
|
os: linux
|
|
dist: bionic
|
|
go: 1.14.x
|
|
env:
|
|
- GO111MODULE=auto
|
|
name: O-R tests
|
|
- script: travis_retry go run build/ci.go test -coverage $(go list ./... | grep "github.com\/XinFinOrg\/XDPoSChain\/s.*")
|
|
os: linux
|
|
dist: bionic
|
|
go: 1.14.x
|
|
env:
|
|
- GO111MODULE=auto
|
|
name: S tests
|
|
- script: travis_retry go run build/ci.go test -coverage $(go list ./... | grep "github.com\/XinFinOrg\/XDPoSChain\/[t-z].*")
|
|
os: linux
|
|
dist: bionic
|
|
go: 1.14.x
|
|
env:
|
|
- GO111MODULE=auto
|
|
name: T-Z tests
|
|
|
|
- stage: TAG Build
|
|
if: tag IS present
|
|
services:
|
|
- docker
|
|
install: skip
|
|
before_script:
|
|
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
|
- docker --version # document the version travis is using
|
|
- docker build -t xinfinorg/xdposchain:$TRAVIS_TAG -f cicd/Dockerfile .
|
|
script:
|
|
- docker push xinfinorg/xdposchain:$TRAVIS_TAG
|
|
|
|
- stage: (Devnet) Build, and push images
|
|
if: branch = dev-upgrade AND type = push AND tag IS blank
|
|
services:
|
|
- docker
|
|
install: skip
|
|
before_script:
|
|
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
|
- docker --version # document the version travis is using
|
|
- docker build -t xinfinorg/devnet:latest -f cicd/Dockerfile .
|
|
script:
|
|
- docker push xinfinorg/devnet:latest
|
|
|
|
- stage: (Devnet)Terraform plan
|
|
if: branch = dev-upgrade AND type = pull_request
|
|
dist: xenial
|
|
language: bash
|
|
install:
|
|
- wget https://releases.hashicorp.com/terraform/"$tf_version"/terraform_"$tf_version"_linux_amd64.zip
|
|
- unzip terraform_"$tf_version"_linux_amd64.zip
|
|
- sudo mv terraform /usr/local/bin/
|
|
- rm terraform_"$tf_version"_linux_amd64.zip
|
|
script:
|
|
- echo "Pull request detected, creating change plan(Devnet)"
|
|
- cd cicd/devnet/terraform
|
|
# Terraform init, validate, then create change plan. If any fail, fail validation
|
|
- terraform init $tf_init_cli_options
|
|
- terraform validate $tf_validation_cli_options
|
|
- terraform plan $tf_plan_cli_options
|
|
|
|
- stage: (Devnet) Terraform apply
|
|
if: branch = dev-upgrade AND type = push AND tag IS blank
|
|
dist: xenial
|
|
language: bash
|
|
install:
|
|
# Download and install terraform before each run
|
|
- wget https://releases.hashicorp.com/terraform/"$tf_version"/terraform_"$tf_version"_linux_amd64.zip
|
|
- unzip terraform_"$tf_version"_linux_amd64.zip
|
|
- sudo mv terraform /usr/local/bin/
|
|
- rm terraform_"$tf_version"_linux_amd64.zip
|
|
- pip install --user awscli # install aws cli w/o sudo
|
|
- export PATH=$PATH:$HOME/.local/bin # put aws in the path
|
|
script:
|
|
- echo "Merge detected, executing changes(Devnet)"
|
|
- cd cicd/devnet/terraform
|
|
# Terraform init and then apply changes to environment
|
|
- terraform init $tf_init_cli_options
|
|
- terraform apply $tf_apply_cli_options
|
|
- sleep 20
|
|
- |
|
|
source .env
|
|
for ((i=$us_east_2_start;i<$us_east_2_end;i++)); do
|
|
echo "Force deploy xdc-$i"
|
|
sleep 5 && aws ecs update-service --region us-east-2 --cluster devnet-xdcnode-cluster --service ecs-service-xdc$i --force-new-deployment;
|
|
done
|
|
for ((i=$eu_west_1_start;i<$eu_west_1_end;i++)); do
|
|
echo "Force deploy xdc-$i"
|
|
sleep 5 && aws ecs update-service --region eu-west-1 --cluster devnet-xdcnode-cluster --service ecs-service-xdc$i --force-new-deployment;
|
|
done
|
|
for ((i=$ap_southeast_2_start;i<$ap_southeast_2_end;i++)); do
|
|
echo "Force deploy xdc-$i"
|
|
sleep 5 && aws ecs update-service --region ap-southeast-2 --cluster devnet-xdcnode-cluster --service ecs-service-xdc$i --force-new-deployment;
|
|
done
|
|
|