name: b3bp CI
on:
  push:
    branches:
      - main
  pull_request:
    types:
      - opened
      - synchronize
jobs:
  ci:
    strategy:
      matrix:
        os:
          - ubuntu-latest
          - macos-latest
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 1
      - uses: actions/setup-node@v4
        with:
          node-version: 18.x
      - name: Install macOS test dependencies
        if: runner.os == 'macOS'
        run: |
          brew install gnu-sed coreutils
      - name: Install
        run: |
          corepack enable
          corepack yarn install --immutable
      - name: Lint
        if: runner.os == 'Linux'
        env:
          SHELLCHECK_SEVERITY: warning
        run: |
          corepack yarn lint
      - name: Test
        run: |
          corepack yarn test

  ci-bash3-docker:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 1
      - name: Test In Docker (Bash 3.2.57)
        run: |
          test/bash3-docker.sh
