name: CI

on:
  push:
    branches:
      - main
      - 'v*.[0-9]'
  pull_request:

permissions:  # added using https://github.com/step-security/secure-workflows
  contents: read

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Harden Runner
      uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
      with:
        disable-sudo: true
        egress-policy: block
        allowed-endpoints: >
          coveralls.io:443
          github.com:443
          registry.yarnpkg.com:443
          objects.githubusercontent.com:443

    - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
    - name: Install modules
      run: yarn
    - name: Run tests
      run: yarn test --coverage
    - name: Coveralls
      uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949 # v2.2.3
      with:
        github-token: ${{ secrets.GITHUB_TOKEN }}
