name: Test Vno  

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  test:
    runs-on: ubuntu-20.04

    strategy:
      matrix:
        deno-version: ['v1.11.2']

    steps:
      - name: Git Checkout Deno Mod
        uses: actions/checkout@v2
      - name: Use Deno Version ${{ matrix.deno-version }}
        uses: denolib/setup-deno@v2.3.0
        with:
          deno-version: ${{ matrix.deno-version }}
      - name: Build Vno Mod
        run: deno run --reload --unstable --allow-read --allow-write dist/mod.ts
      - name: Build Vno CLI
        run: deno run --reload --unstable --allow-read --allow-write install/vno.ts
      - name: Run Vno Tests
        run: |
          deno test --allow-read --allow-write --allow-net --unstable core/__tests__/test_utils.ts
          deno test --allow-read --allow-write --allow-net --unstable core/__tests__/test_lib.ts
          deno test --allow-read --allow-write --allow-net --unstable core/__tests__/test_parser.ts
          deno test --allow-read --allow-write --allow-net --unstable core/__tests__/test_http.ts
      - name: Test vno commands
        run: |
          deno run --allow-read --allow-write --allow-net --unstable install/vno.ts create --spa cli-test yes 3 TestApp 8080 TestOne TestTwo TestThree
          deno run --allow-read --allow-write --allow-net --unstable install/vno.ts build cli-test
          deno test --allow-read --allow-write --allow-net --unstable core/__tests__/test_commands.ts
