name: Tests

on:
  push:
  pull_request:

jobs:
  lint:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - name: Install swipl
        run: |
          sudo apt-add-repository "ppa:swi-prolog/stable"
          sudo apt-get update
          sudo apt-get install swi-prolog-nox
        # Can be found on: https://github.com/terminusdb-labs/swipl-lint/
      - name: Download script
        run: curl -L 'https://raw.githubusercontent.com/terminusdb-labs/swipl-lint/v0.7/pl_lint.pl' > /tmp/pl_lint.pl
      - name: Run linter
        run: swipl /tmp/pl_lint.pl
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Run tests in the swipl docker
        run: sudo docker run -v $(pwd):/app/tus terminusdb/swipl:latest swipl -g run_tests -g halt /app/tus/prolog/tus.pl
