name: CI

on:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]

  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        version: [27.2, 28.1, 28.2, 29.1, master]
    container: silex/emacs:${{ matrix.version }}-ci

    steps:
      - uses: actions/checkout@v4

      - name: Clean
        run: make clean

      - name: Compile
        run: |
          make bin 2>&1 | tee MAKE_BIN_OUTPUT
          echo "Number of warnings: $(grep "Warning:" MAKE_BIN_OUTPUT | wc -l)" >> $GITHUB_STEP_SUMMARY
          echo '```' >> $GITHUB_STEP_SUMMARY
          grep "Warning:" MAKE_BIN_OUTPUT >> $GITHUB_STEP_SUMMARY
          echo '```' >> $GITHUB_STEP_SUMMARY

      - name: Test
        run: make test
