name: CI

on: push

jobs:
  ci:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Install SWI-Prolog
        run: |
          sudo apt-add-repository ppa:swi-prolog/devel
          sudo apt-get update
          sudo apt-get install swi-prolog

      - name: Check installation
        run: swipl -g check_installation -t halt

      - name: Test coverage
        env:
          GHAPI_ACCESS_TOKEN: ${{secrets.GHAPI_ACCESS_TOKEN}}
          CANNY_COV_GIST_ID: ${{secrets.CANNY_COV_GIST_ID}}
        run: swipl -g "attach_packs(..)" -g "[library(canny/cov)]" -t halt
