name: 'Nix build'
on:
  push:
    branches:
      - main
    paths-ignore:
      - web/**
      - doc/**
  pull_request:
    branches:
      - main
    paths-ignore:
      - web/**
      - doc/**
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
jobs:
  build-and-check:
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - name: Install Nix
        uses: DeterminateSystems/nix-installer-action@v6
      - name: Setup Nix Cache
        uses: DeterminateSystems/magic-nix-cache-action@v2
      - run: nix build
      - run: nix flake check
