Skip to content

Added min/max number of choices in multichoice election #1353

Added min/max number of choices in multichoice election

Added min/max number of choices in multichoice election #1353

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: [self-hosted]
env:
COMPOSE_PROJECT_NAME: ci_${{ github.run_id }}
COMPOSE_FILE: ./test/integration/util/docker-compose.yml
COMPOSE_ENV: ./test/integration/util/.env
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: Start docker containers (voconed, blind-csp, vocfaucet)
run: |
docker-compose pull -q
docker-compose up -d
docker-compose images # check logs to see version used
voconed_hostport=$(docker-compose port voconed 9095)
blindcsp_hostport=$(docker-compose port blind-csp 5000)
vocfaucet_hostport=$(docker-compose 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
EOF
# source all env vars in ${{ env.COMPOSE_ENV }}
# and merge them into GHA environment, some are needed in the following steps
env -i sh -o allexport -c '. ${{ env.COMPOSE_ENV }} ; env' >> $GITHUB_ENV
- name: Wait until voconed is ready
run: |
for i in {1..20}; do
if curl -s --fail ${{ env.API_URL }}/chain/info 2>/dev/null ; then
exit 0
fi
date
sleep 1
done
echo "timed out waiting"
exit 1
- name: Integration tests
run: yarn test:integration --ci --coverage --maxWorkers=2
- name: Service tests
run: yarn test:service --ci --coverage --maxWorkers=2
- name: API tests
run: yarn test:api --ci --coverage --maxWorkers=2
- name: Anonymous integration tests
run: yarn test:integration:zk --ci --coverage
- name: Debug docker logs in case of failure
if: failure()
run: docker-compose logs
- name: Stop and cleanup docker containers
if: always()
run: docker-compose down -v