name: Test and Deploy

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  # Test changes from PRs
  test:
    name: Run tests
    runs-on: ${{ matrix.os }}
    if: github.ref != 'refs/heads/master'
    strategy:
      matrix:
        os: [ubuntu-latest]
        node-version: [10.x, 12.x]
    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - name: install
        run:  |
              npm ci
      - name: compile the compiler
        run:  |
              npx qx deploy --target=build 
      - name: Run qx test for built-in compiler tests
        run:  ./bin/qx test --output-path-prefix=tmp
        env:
          CI: true

  deploy:
    name: Deploy API Viewer
    if: github.ref == 'refs/heads/master'
    runs-on: ubuntu-latest
    needs: [test]
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
      - name: install
        run:  |
              npm ci
      - name: Build API Viewer
        run:  npx qx compile --target=build -v --clean
      - name: Deploy API Viewer
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./compiled/browser/build

name: Test and Deploy

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  # Test changes from PRs
  test:
    name: Run tests
    runs-on: ${{ matrix.os }}
#    if: github.ref != 'refs/heads/master'
    strategy:
      matrix:
        os: [ubuntu-latest]
        node-version: [10.x, 12.x]
    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - name: install
        run:  |
              npm ci
      - name: compile the compiler
        run:  |
              npx qx deploy --target=build 
      - name: Run qx test for built-in compiler tests
        run:  ./bin/qx test --output-path-prefix=tmp
        env:
          CI: true

  deploy:
    name: Deploy API Viewer
    if: github.ref == 'refs/heads/master'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
      - name: install
        run:  |
              npm ci
      - name: Build API Viewer
        run:  npx qx compile --target=build -v --clean
      - name: Deploy API Viewer
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./compiled/browser/build

Revert deploy dep'cy, run tests on master (only tmp)
Revert deploy dep'cy, run tests on master (only tmp)