name: CI

on: [push, pull_request]

jobs:
  run:
    name: "Build using Racket '${{ matrix.racket-version }}' (${{ matrix.racket-variant }})"
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        racket-version: ["7.1", "7.2", "7.3", "7.4", "7.5", "7.6", "7.7", "7.8", "7.9", "current"]
        racket-variant: ["BC", "CS"]
        # CS builds are only provided for versions 7.4 and up so avoid
        # running the job for prior versions.
        exclude:
          - {racket-version: "7.1",    racket-variant: "CS"}
          - {racket-version: "7.2",    racket-variant: "CS"}
          - {racket-version: "7.3",    racket-variant: "CS"}

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

    - uses: Bogdanp/setup-racket@v0.11
      with:
        distribution: 'full'
        version: ${{ matrix.racket-version }}
        variant: ${{ matrix.racket-variant }}

    - name: Install package and its dependencies
      run: raco pkg install --auto --batch
      
    - name: Start virtual framebuffer
      run: Xvfb "$DISPLAY" -screen 0 1280x1024x24 &

    - name: Run the tests
      run: raco test -j 4 -p quad

    - name: Run the qtests
      run: racket -l qtest/all
