name: Build

on: [push]

permissions:
  contents: read

jobs:
  build:
    strategy:
      matrix:
        os: [macos-latest, ubuntu-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: actions/setup-node@v4
        with:
          node-version: "20"
      - name: Install dependencies
        run: npm install --no-optional
      - run: xvfb-run -a npm test
        if: runner.os == 'Linux'
      - run: npm test
        if: runner.os != 'Linux'
      - name: Adjust coverage results
        run: npm run sed
        if: runner.os == 'Linux'
      - name: Coveralls
        uses: coverallsapp/github-action@v2.3.0
        with:
          github-token: ${{ github.token }}
          file: ./out/coverage/lcov.info
