name: Test
on:
  pull_request:
  schedule:
    - cron: "30 2 * * *"
jobs:
  tests:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest]
    runs-on: ${{ matrix.os }}
    steps:
    - uses: actions/checkout@v4
    - uses: cachix/install-nix-action@v30
      with:
        nix_path: nixpkgs=channel:nixos-unstable
    - run: |
        if grep -R --exclude stdlib-extended.nix literalExample modules ; then
          echo "Error: literalExample should be replaced by literalExpression" > /dev/stderr
          exit 1
        fi
    - run: nix-build --show-trace -A docs.jsonModuleMaintainers
    - run: ./format -c
    - run: nix-shell --show-trace . -A install
    - run: yes | home-manager -I home-manager=. uninstall
    - run: nix-shell --show-trace --arg enableBig false --pure tests -A run.all
      # Somebody please help us fix the macos tests.
      if: matrix.os != 'macos-latest'