name: test

# On every pull request, but only on push to master
on:
  push:
    branches:
    - master
  pull_request:

jobs:
  test-node:
    runs-on: ubuntu-22.04

    env:
      VITE_MAPBOX_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN_CI }}

    steps:
      - uses: actions/checkout@v2.1.1

      - name: Use Node.js
        uses: actions/setup-node@v1
        with:
          node-version: '16.x'

      - name: Install dependencies
        run: |
          yarn bootstrap

      - name: Run tests
        run: |
          yarn test ci

      - name: Coveralls
        uses: coverallsapp/github-action@master
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
