
name: Test
on: [push, pull_request]
jobs:
  test:
    # matrix strategy from: https://github.com/mvdan/github-actions-golang/blob/master/.github/workflows/test.yml
    strategy:
      matrix:
        go-version: [1.13.x, 1.14.x]
        platform: [ubuntu-latest]
    runs-on: ${{ matrix.platform }}
    steps:
    - name: Install Go
      uses: actions/setup-go@v1
      with:
        go-version: ${{ matrix.go-version }}
    - name: Install Nodejs
      uses: actions/setup-node@v1
      with:
        go-version: 10.x
    - name: Install circom
      run: npm install -g circom
    - name: Install snarkjs
      run: npm install -g snarkjs
    - name: Checkout code
      uses: actions/checkout@v2
    - name: Compile circuits and execute Go tests
      run: |
        cd testdata && sh ./compile-circuits.sh && cd ..
        go run cli/cli.go -prove -provingkey=testdata/circuit1k/proving_key.json -witness=testdata/circuit1k/witness.json -proof=testdata/circuit1k/proof.json -public=testdata/circuit1k/public.json
        go run cli/cli.go -prove -provingkey=testdata/circuit5k/proving_key.json -witness=testdata/circuit5k/witness.json -proof=testdata/circuit5k/proof.json -public=testdata/circuit5k/public.json
        go test ./...
