Skip to content

Changed environment URLs and added new faucet #971

Changed environment URLs and added new faucet

Changed environment URLs and added new faucet #971

Workflow file for this run

name: Main
on:
push:
branches:
- main
pull_request: ~
jobs:
build:
name: Build, lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
node: ['18.x']
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Use Node ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Install deps
run: yarn
- name: Lint
run: yarn lint
- name: Unit tests
run: yarn test:unit --ci --coverage
integration:
name: Integration tests on self-hosted
runs-on: ${{ matrix.os }}
strategy:
matrix:
node: ['18.x']
os: [ci1]
steps:
# TODO: somehow reuse artifact from ubuntu-latest 'build' job?
# instead of building from scratch on self-hosted
- name: Checkout repo
uses: actions/checkout@v3
- name: Use Node ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
# self-hosted runners do not have yarn installed 😕
- name: Install yarn
run: npm i -g yarn
- name: Install deps
run: yarn
- name: Set env vars for all the following steps
run: |
cat << EOF >> $GITHUB_ENV
COMPOSE_PROJECT_NAME=ci_${{ github.run_id }}
BLINDCSP_PRIVKEY=f6e530882cde11e2050989d04c3fc523412b2fc2723c0a6155932a62ffafc2b6
BLINDCSP_PUBKEY=039d3ea0d911f4497903e3701b19b9c2efa2b7c3c646f3fc63d46d0a684b781b82
FAUCET_TOKEN_LIMIT=100
EOF
# that BLINDCSP_PRIVKEY is hardcoded in docker-compose.yml and corresponds to:
# address 0xc3E925C7D971601c85eB042032F415852E56A038
# CSP root key 039d3ea0d911f4497903e3701b19b9c2efa2b7c3c646f3fc63d46d0a684b781b82
- name: Start voconed, blind-csp, vocfaucet
run: |
docker-compose -f test/integration/util/docker-compose.yml pull -q
docker-compose -f test/integration/util/docker-compose.yml up -d --build
docker-compose -f test/integration/util/docker-compose.yml images # check logs to see version used
voconed_hostport=$(docker-compose -f test/integration/util/docker-compose.yml port voconed 9095)
blindcsp_hostport=$(docker-compose -f test/integration/util/docker-compose.yml port blind-csp 5000)
vocfaucet_hostport=$(docker-compose -f test/integration/util/docker-compose.yml port vocfaucet 8080)
cat << EOF >> $GITHUB_ENV
API_URL=http://$voconed_hostport/v2
BLINDCSP_URL=http://$blindcsp_hostport/v1
FAUCET_URL=http://$vocfaucet_hostport/v2/faucet/
EOF
- name: Wait until voconed is ready
run: |
for i in {1..20}; do
date
curl -s --fail ${{ env.API_URL }}/chain/info 2>/dev/null && break || sleep 1
done
- name: Integration tests
run: yarn test:integration --ci --coverage --maxWorkers=2
- name: Service tests
run: yarn test:service --ci --coverage --maxWorkers=2
- name: Anonymous integration tests
run: yarn test:integration:zk --ci --coverage
- name: Debug voconed logs on failure
if: failure()
run: docker-compose -f test/integration/util/docker-compose.yml logs
- name: Stop voconed (ephemeral vochain for integration test)
if: always()
run: docker-compose -f test/integration/util/docker-compose.yml down -v