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

env-tests github action #8057

Merged
merged 15 commits into from
Jul 9, 2021
Merged
100 changes: 100 additions & 0 deletions .github/workflows/env_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: env-tests

# Run this workflow manually
on:
workflow_dispatch:
inputs:
network:
description: 'Network to run env-tests against. Possible values are (staging|baklava|alfajores|mainnet)'
required: true

jobs:
env-tests:
runs-on: ubuntu-latest
environment: env-tests-environment
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Cloud SDK
if: ${{ github.event.inputs.network == 'staging' }}
uses: google-github-actions/setup-gcloud@master
with:
project_id: 'celo-testnet'
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true

- name: Setup port-forward
if: ${{ github.event.inputs.network == 'staging' }}
run: |
gcloud container clusters get-credentials celo-networks-dev --project celo-testnet --zone us-west1-a
kubectl config set-context --current --namespace default
kubectl port-forward --namespace=staging staging-validators-0 8545:8545 &
sleep 10

- name: Setup lightest node
if: ${{ github.event.inputs.network != 'staging' }}
run: |
export CELO_IMAGE=us.gcr.io/celo-org/geth:${{ github.event.inputs.network }}
docker pull $CELO_IMAGE
mkdir celo-data-dir
cd celo-data-dir
if [ ${{ github.event.inputs.network }} == 'mainnet' ]
then
export NETWORK_OPTION=""
else
export NETWORK_OPTION="--${{ github.event.inputs.network }}"
fi
docker run --name celo-lightestnode -d --restart unless-stopped --stop-timeout 300 -p 127.0.0.1:8545:8545 -p 127.0.0.1:8546:8546 -p 30303:30303 -p 30303:30303/udp -v $PWD:/root/.celo $CELO_IMAGE --verbosity 3 --syncmode lightest --rpc --rpcaddr 0.0.0.0 --rpcapi eth,net,web3,debug,admin,personal --light.serve 90 --light.maxpeers 1000 --maxpeers 1100 --nousb $NETWORK_OPTION --datadir /root/.celo
cd ..

- name: Checking if node is synced
if: ${{ github.event.inputs.network != 'staging' }}
run: |
while true; do output=$(docker exec -i celo-lightestnode geth attach --exec "eth.syncing" | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g"); echo $output; sleep 1; if [ $output == 'false' ]; then break; fi; done

- name: Setup node
uses: actions/setup-node@v2
with:
node-version: '12'

- name: Setup yarn
run: |
npm install --global yarn
yarn
yarn lerna bootstrap

- name: Build packages
run: yarn lerna run build --ignore docs

- name: Run the env tests
run: |
cd packages/env-tests/
export TWILIO_ACCOUNT_AUTH_TOKEN=${{ secrets.TWILIO_ACCOUNT_AUTH_TOKEN }}
export TWILIO_ACCOUNT_SID=${{ secrets.TWILIO_ACCOUNT_SID }}
case ${{ github.event.inputs.network }} in
'staging')
export TWILIO_ADDRESS_SID=${{ secrets.STAGING_TWILIO_ADDRESS_SID }}
export MNEMONIC="${{ secrets.STAGING_MNEMONIC }}"
export RESERVE_SPENDER_MULTISIG_ADDRESS=0x64a7C6C6Ab63fb2b617849B579e555033BC551cb
env CELO_PROVIDER=http://127.0.0.1:8545 ./node_modules/.bin/jest --runInBand
;;
'alfajores')
export TWILIO_ADDRESS_SID=${{ secrets.ALFAJORES_TWILIO_ADDRESS_SID }}
export MNEMONIC="${{ secrets.ALFAJORES_MNEMONIC }}"
export RESERVE_SPENDER_MULTISIG_ADDRESS=0x64a7C6C6Ab63fb2b617849B579e555033BC551cb
env CELO_PROVIDER=http://127.0.0.1:8545 ./node_modules/.bin/jest --runInBand --testNamePattern='^(?!.*((report a rate)|(move funds from the Reserve to a custodian and back))).*$'
;;
'baklava')
export TWILIO_ADDRESS_SID=${{ secrets.BAKLAVA_TWILIO_ADDRESS_SID }}
export MNEMONIC="${{ secrets.BAKLAVA_MNEMONIC }}"
export RESERVE_SPENDER_MULTISIG_ADDRESS=0x57d0A6Ce0478074Fe577259D8cb07AfFb6D408f5
env CELO_PROVIDER=http://127.0.0.1:8545 ./node_modules/.bin/jest --runInBand --testNamePattern='^(?!.*((report a rate)|(move funds from the Reserve to a custodian and back))).*$'
;;
'mainnet')
export TWILIO_ADDRESS_SID=${{ secrets.MAINNET_TWILIO_ADDRESS_SID }}
export MNEMONIC="${{ secrets.MAINNET_MNEMONIC }}"
export RESERVE_SPENDER_MULTISIG_ADDRESS=0x554Fca0f7c465cd2F8C305a10bF907A2034d2a19
env CELO_PROVIDER=http://127.0.0.1:8545 ./node_modules/.bin/jest --runInBand --testNamePattern='^(?!.*((report a rate)|(move funds from the Reserve to a custodian and back))).*$'
;;
esac