name: CI

on:
  push:
    branches:
      - master
  pull_request:
  workflow_dispatch:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  test:
    runs-on: ${{ matrix.os }}
    continue-on-error: ${{ matrix.experimental }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        emacs-version:
          - 28.2
          - 29.4
          - 30.2
        experimental: [false]
        include:
          - os: ubuntu-latest
            emacs-version: snapshot
            experimental: true
          - os: macos-latest
            emacs-version: snapshot
            experimental: true
          - os: windows-latest
            emacs-version: snapshot
            experimental: true

    steps:
    - uses: actions/checkout@v6

    - uses: jcs090218/setup-emacs@master
      with:
        version: ${{ matrix.emacs-version }}

    - uses: emacs-eask/setup-eask@master
      with:
        version: 'snapshot'

    - name: Run tests (Unix)
      if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
      run: |
        make init
        make format
        make specs

    - name: Run tests (Windows)
      if: matrix.os == 'windows-latest'
      run: |
        make init
        make format
        make compile
        make specs
