name: CL-host

on: [push]

jobs:

  ecl:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1
    - uses: actions/cache@v1
      id: ecl-cache
      with:
        path: /tmp/ecl
        key: ecl-cache

    - name: build host ecl
      if: steps.ecl-cache.outputs.cache-hit != 'true'
      run: |
        wget -q https://github.com/sbcl/sbcl/releases/download/sbcl-1.4.14/ecl.tgz
        tar xf ecl.tgz
        cd ecl
        ./configure --prefix=/usr/
        make
      working-directory: /tmp

    - name: install ecl
      run: |
        sudo make install
        echo '(setf *debugger-hook* (lambda (c fun) (princ c) (si::tpl-backtrace) (quit 1)))' > ~/.eclrc
      working-directory: /tmp/ecl

    - name: build
      env:  
        SBCL_MAKE_TARGET_2_OPTIONS: --disable-ldb --disable-debugger
      run: ./make.sh --xc-host='ecl'

  clisp:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1
    - name: instal host clisp
      run: |
        sudo apt-get update
        sudo apt-get install clisp
    - name: build
      env:  
        SBCL_MAKE_TARGET_2_OPTIONS: --disable-ldb --disable-debugger
      run: ./make.sh --xc-host='clisp -on-error exit'

  abcl:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1
    - name: instal host abcl
      run: |
        wget -q https://github.com/sbcl/sbcl/releases/download/sbcl-1.4.14/abcl.jar
        echo '(setf system::*invoke-debugger-hook* (lambda (c fun) (princ c) (top-level::backtrace-command 100) (exit :status 1)))' > ~/.abclrc
    - name: build
      env:  
        SBCL_MAKE_TARGET_2_OPTIONS: --disable-ldb --disable-debugger
      run: ./make.sh --xc-host='java -jar abcl.jar'
    
  ccl:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1
    - name: instal host ccl
      run: |
        wget -q https://github.com/sbcl/sbcl/releases/download/sbcl-1.4.14/ccl-host.tgz
        tar xf ccl-host.tgz
    - name: build
      env:  
        SBCL_MAKE_TARGET_2_OPTIONS: --disable-ldb --disable-debugger
      run: ./make.sh --xc-host='ccl-host/lx86cl64 --batch'
