name: Tests
on: [push, pull_request]
jobs:
  test_linux:
    name: "Run Tests - Linux"
    runs-on: 'ubuntu-latest'
    steps:
      - name: Install dependencies
        run: |
          sudo apt-get install software-properties-common
          sudo apt-add-repository ppa:swi-prolog/devel
          sudo apt-get update
          sudo apt-get install swi-prolog
      - name: checkout code
        uses: actions/checkout@v4
      - name: Run test script
        run: ./run_tests.sh
  test_windows:
    name: "Run Tests - Windows"
    runs-on: 'windows-latest'
    steps:
      - name: checkout code
        uses: actions/checkout@v4
      - name: Download swipl
        shell: pwsh
        run: |
          Invoke-WebRequest https://www.swi-prolog.org/download/devel/bin/swipl-9.3.26-1.x64.exe -OutFile swipl_installer.exe
      - name: Extract swipl
        run: 7z x -y swipl_installer.exe -oswipl_win
      - name: Run test script
        shell: pwsh
        run: |
          & .\run_tests.ps1
