🏡 index : quine-global/ava.git

name: Install and test AVA
on:
  push:
    branches:
      - main
  pull_request:
    paths-ignore:
      - "*.md"
      - "docs/**"
      - "media/**"
jobs:
  nodejs:
    name: Node.js
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        node-version: [^18.18, ^20.8, ^22, ^23]
        os: [ubuntu-latest, windows-latest, macos-latest]
    steps:
      - uses: actions/checkout@v4
      - name: Enable symlinks
        if: matrix.os == 'windows-latest'
        run: |
          git config core.symlinks true
          git reset --hard
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node-version }}
          cache: npm
      - run: npm install --no-audit
      - run: ./scripts/ci.sh
        shell: bash
      - uses: codecov/codecov-action@v4
        with:
          files: coverage/lcov.info
          name: ${{ matrix.os }}/${{ matrix.node-version }}
          token: ${{ secrets.CODECOV_TOKEN }}

  typescript:
    name: TypeScript compatibility
    runs-on: ubuntu-latest
    strategy:
      matrix:
        ts-version: [~5.2, ~5.3, ~5.4, ~5.5, ~5.6, ~5.7, ~5.8]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version-file: package.json
          cache: npm
      - run: npm install --no-audit
      - run: npm i typescript@${TS_VERSION}
        env:
          TS_VERSION: ${{ matrix.ts-version }}
      - run: ./node_modules/typescript/bin/tsc --version
      - run: ./node_modules/typescript/bin/tsc --noEmit

  lockfile_churn:
    name: Test package-lock for unexpected modifications
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version-file: package.json
          cache: npm
      - run: npm install --no-audit
      - name: Test package-lock for unexpected modifications
        run: |
          npm -v
          checksum=$(sha512sum package-lock.json)
          npm install --package-lock-only --no-audit
          if ! echo ${checksum} | sha512sum --quiet -c -; then
            echo "package-lock.json was modified unexpectedly. Please rebuild it using npm@$(npm -v) and commit the changes."
            exit 1
          fi

  without_lockfile:
    name: Install dependencies without using a lockfile
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version-file: package.json
      - run: npm install --no-package-lock --no-audit
      - run: ./scripts/ci.sh
        shell: bash

  xo:
    name: Lint source files
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version-file: package.json
          cache: npm
      - run: npm install --no-audit
      - run: npx xo