-
Notifications
You must be signed in to change notification settings - Fork 15
/
.travis.yml
95 lines (95 loc) · 5.94 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
dist: bionic
language: go
go:
- 1.11.x
service:
- docker
env:
global:
- GENESIS_REPO_BRANCH="master"
- INFRASTRUCTURE_REPO_BRANCH="v2.1.0"
- AWS_DEFAULT_REGION=us-east-1
- secure: yWcEeiAVQrQPELui/7nlbCFyqDSbSO2z7Fee9+kdlhH0Stn+kJD6Q3pt5vtYj4hwXuxQcCBeMQXypghKsJc3kCsDyz5N++JRW+5kTTUNV/wMVBXJ9Cs+15BNpUX0R4eBTtIp34cpMKi2ctiApjbqkpRopNVGmE1rP0QdJkQ3Qh+HdSSk5DL9Mtod3nIYGw3Ne+dhRTvrGYicwavxQDkRQv81vQ82/LsIai/TKuErftB+6r3TLWtGJvHN0YjhNWmvLbPN7twq63Gx3C4ChSAEbLntBASeWml0/Ii4DMQDSVHxPvlaBQzMeH7XbG4/pmx5LVrJG/+lwQAzKK3ueR4kc9jiIJelTywQpLJet8mnTvImm87L+T717SEt9mkWObciXANfz7nE6oEohkcsVGOrJnCGE9opecipsYTzxQkIgzyxC6dx8uv2QI43t/Ffvtv77VWoH/hUzkrhdVB/i1mwjMW7NlHs5lrCRvPjWds3l6D4TXyHsA+bUFpXYcC4ie05nEz0gd9cCQ/U6hUsMPWAERt9DG68i95oThHRCxULfGrTyWsztSB+Db66jrXXa6aG5QIT1VvTzifYfyZ05oKa8WyiS1YAORrh/Ft9OHC/Ja0Q+xPuxYPX2HSsvbAHYD/dK7kNaLSlKs/09QzHfqdmLNENhi7fL1PYaQGOd7ujly8=
- secure: SzF5+qspQTFpxnjm45SKNgS+mFbaZxrmONCN2OVcI1BuJgfilC9CWIaDHATQcV0BfxHxkCIfTzBwM28GEjNYhoGvEPxHnl1micxHQvm6RKgYa+aeK9MzV6feIayHj3AYdjb6VtBKcEFkP4v/gB3YroNzBoa2hxI2LKMkc/vbLbo3DLGRC7syWk5DOIOJRWkzMif0WkkZxojot69zM1YxsFa6vYDDNYS7A+BBzpfzNAdHpnGR0dplKIsQ7BMY6oshfyOapt0+/iSMTRXQYslkHrx9V06UkR1oEyM+he2V3ZmoLj8YFZPgZEeLF6QFjA3Qbjrx3oyWeXuGpIxewHRCQyE6MnuC1OuzGdM6XIZwYGuOQq0i2ux+axG8OUuI9q3r4SkZxLGExTV1EyY//zyM48/Gd18aBnwpEcHRsxRxXpkoImCrb82KugaQUyuJlw3d4JR+CmpOlJOFEzux+6JVNkS8GuFkLbFqA6g9ovDzRQPP3+zcebXy89xD8pu+3Qr1nnV4wOmj7ujDPTbzZn2pi6x6AQvDoKc+c0qTlCFiAyiZPMf+twx7hmZ8lEISzHxbPYBI76DocSdburJ7UoDT+WNL9W0XG6t/XqrioguQGSNB+2S++QYOGasAYJ6oQcdHkLloKNpBx1w664Ifzk3wTcDGvjkAu0lLLT3j+0fDBt0=
before_script:
- export OLDATA=$GOPATH/test
- export OLROOT=$GOPATH/src/github.com/Oneledger
- export OLSCRIPT=$OLROOT/protocol/scripts
- export OLSETUP=$OLROOT/protocol/setup
- export OLTEST=$OLROOT/protocol/tests
- export GO111MODULE="on"
- export PATH=$PATH:$GOPATH/bin
- export OLDEBUG=true
- sudo apt-get update -y && sudo apt-get install -y libleveldb-dev libsnappy-dev
script:
- cd $OLROOT/protocol && make update install utest
- cd $OLROOT/protocol && make alltest
- cd $OLROOT/protocol && make install_c
before_deploy:
- sudo apt-get update && sudo apt-get install unzip jq python3 python3-venv
- python3 -m venv env && source env/bin/activate
- pip3 install netaddr ipaddr ansible awscli --upgrade
- export GITHUB_TOKEN=$(aws secretsmanager get-secret-value --secret-id Travis_CI_Github_Token | jq -r ".SecretString | fromjson.Github_Token")
- cd $TRAVIS_BUILD_DIR &&
git clone https://$GITHUB_TOKEN:x-oauth-basic@github.com/Oneledger/infrastructure.git --branch
${INFRASTRUCTURE_REPO_BRANCH}
- ssh-keygen -C "$USER@ubuntu" -t rsa -N "" -f $TRAVIS_BUILD_DIR/id_rsa
- aws secretsmanager get-secret-value --secret-id Travis_CI_GCP_Credential | jq -r ".SecretString" >> $TRAVIS_BUILD_DIR/DevNet.json
- cd $TRAVIS_BUILD_DIR && chmod 600 id_rsa DevNet.json
- eval $(ssh-agent -s) && ssh-add $TRAVIS_BUILD_DIR/id_rsa
- cp $TRAVIS_BUILD_DIR/DevNet.json $TRAVIS_BUILD_DIR/infrastructure/gcp
- wget https://releases.hashicorp.com/terraform/0.11.13/terraform_0.11.13_linux_amd64.zip
- unzip terraform_0.11.13_linux_amd64.zip && sudo mv terraform /usr/local/bin/
- wget https://releases.hashicorp.com/packer/1.3.5/packer_1.3.5_linux_386.zip
- unzip packer_1.3.5_linux_386.zip && sudo mv packer /usr/local/bin/
- cp $TRAVIS_BUILD_DIR/DevNet.json $TRAVIS_BUILD_DIR/infrastructure/gcp
- aws secretsmanager get-secret-value --secret-id Travis_CI_GCP_Credential | jq -r ".SecretString" | docker login -u _json_key --password-stdin https://gcr.io
- CONTAINER_REGISTRY="gcr.io/atomic-land-223022/oneledger/chronos"
deploy:
- provider: releases
skip_cleanup: true
prerelease: true
draft: true
api_key: ${GITHUB_TOKEN}
file_glob: true
file: "$GOPATH/bin/*"
on:
repo: Oneledger/protocol
branch: master
- provider: script
skip_cleanup: true
script: cd $TRAVIS_BUILD_DIR/infrastructure/ansible && ansible-playbook main.yml
-v --extra-vars "reset_network=true remote_user=$USER
ssh_pub_key_file=$TRAVIS_BUILD_DIR/id_rsa.pub" &&
cd $TRAVIS_BUILD_DIR/infrastructure && packer build
-var "version=${TRAVIS_BRANCH}" -var "tag=${TRAVIS_BRANCH}"
-var "docker_registry=${CONTAINER_REGISTRY}" -only=docker-image packer.json &&
docker push ${CONTAINER_REGISTRY}:${TRAVIS_BRANCH}
on:
branch: develop
after_deploy:
- USER="TravisCI"
- EMAIL="operation@oneledger.io"
- REPO="Oneledger/chronos-genesis"
- GH_REPO="github.com/${REPO}.git"
- GENESIS_DIR=${OLDATA}/0-Node
- SRC_FILES="${GENESIS_DIR}/config.toml ${GENESIS_DIR}/consensus/config/genesis.json"
- GIT_COMMIT_PATH="${TRAVIS_BUILD_DIR}/chronos-genesis/${TRAVIS_BRANCH}"
- MESSAGE="Travis CI Commit"
- cd ${TRAVIS_BUILD_DIR} && git clone --single-branch --branch ${GENESIS_REPO_BRANCH} git://${GH_REPO}
- cd ${TRAVIS_BUILD_DIR}/chronos-genesis && git checkout ${GENESIS_REPO_BRANCH}
- mkdir -p ${GIT_COMMIT_PATH}
- mv -f ${SRC_FILES} ${GIT_COMMIT_PATH}
- git remote
- git config user.email ${EMAIL}
- git config user.name ${USER}
- cd ${GIT_COMMIT_PATH} && sed -i "s/pex.*/pex = true/" config.toml # tempopary fix, remove after next infrastructure release
- cd ${GIT_COMMIT_PATH} && git add config.toml genesis.json
- git commit -m "${MESSAGE}"
- git push "https://${GITHUB_TOKEN}@${GH_REPO}" ${GENESIS_REPO_BRANCH} > /dev/null 2>&1
notifications:
slack:
on_failure: change
on_success: change
rooms:
secure: aALLEM4/HVjUGsHukIR6zoypzPyRFvGp7cqHPy17GO9sOwyZxXLjbC/stdfjMC3H+04gkOJjAxlpr9bCchm1Belrat6tZMiE/MYXQC2ZDoIRXqWzUq+bf+zCfm0AxVSf7tU1ioqjGmDcnINZXr7AzPM1IFx48iVM6KUUVhExVPQAZE83JiyLB9EaFZLi6yxqIlxx8Lfug/YFl5WSOMU8ZQPr6UWDowuTZjYe1f2LktQ3O949GdqvkKWBF4KbRjKjBOCZmJAWb43oYehejGI0zuoU3mprOUbYMv/Ml8KNyQpu/wwdbzfp8JmOwOFLUq7pvs8yAez0YetTYVACrPj3oFsty3KwQH1t0CVYPD/5f5NkBPYF6HHK3r5aqM9yS8pn3jy/IAmrMV9993tqI+X7I3ty/DaKl+xz+G2V7bMojSYKFP9EzTfk9iDtEzDVSOvccTd+vbls5RI9eycNIYRp/rzQLuIdkmqBqVOaesprnp6EAK7AwH0Z9DskFttWkpBNjlIY55a4R/sYDemazRuD7Ibalmk1HyTEvBIvJgkD30Dn8RZ+ojmIQHs4GyV7ysH8xL3CPSnXEhlLPa6NbUNLPur9557JBvsgEcXeJ2+yJTCxnsNEvAmH+brTTWToY2kj/bmLoYWR2rWDoLHGtxwDlC8eeFevh5wZw5REcab6EQ0=