name: Automatic tests

on: [push, pull_request]

jobs:
  make_test:
    name: make test
    runs-on: ubuntu-latest

    strategy:
      matrix:
        swipl: ["8.0", "stable", "devel"]

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Install swivm and SWI-Prolog
        uses: fnogatz/swivm/actions/load@main
        with:
          swi-prolog-version: ${{ matrix.swipl }}

      - name: Install SWI-Prolog pack dependencies
        run: |
          source ~/.swivm/swivm.sh
          make install-dev

      - name: Run tests
        run: |
          source ~/.swivm/swivm.sh
          make test
