Indexing via discrimination tree #598
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Main workflow | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
name: Build and test elpi | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- macos-latest | |
- ubuntu-latest | |
- windows-latest | |
ocaml-compiler: | |
- 4.14.x | |
- 4.08.x | |
profile: | |
- dev | |
parser: | |
- menhir | |
include: | |
- os: ubuntu-latest | |
ocaml-compiler: 5.1.x | |
profile: fatalwarnings | |
parser: menhir | |
- os: ubuntu-latest | |
ocaml-compiler: 4.11.x | |
profile: dev | |
parser: menhir-camlp5 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Set git to use LF | |
run: | | |
git config --global core.autocrlf false | |
git config --global core.eol lf | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
# Environment setup ########################################################### | |
# | |
# We install missing bits and we mae ${{ env.workspace }} points to the current | |
# working directory in a system agnostic way | |
# | |
# Note "opam exec -- stuff" executes stuff in a "system independent way" inside | |
# the opam root *but* the way "stuff" is parsed is not system independent. | |
# Hence we use GH's ${{ expressions }} rather than the ones from the shell. | |
- name: Use OCaml ${{ matrix.ocaml-compiler }} | |
uses: avsm/setup-ocaml@v2 | |
with: | |
ocaml-compiler: ${{ matrix.ocaml-compiler }} | |
opam-local-packages: | |
# dune-cache: true # does not seem to work | |
- name: Install opam-depext | |
run: opam install opam-depext || true # in opam 2.1 there is no depext to install | |
- name: Extra setup on Linux | |
if: runner.os == 'Linux' | |
run: | | |
opam exec -- echo "workspace=${{ github.workspace }}" >> $GITHUB_ENV | |
sudo apt-get install wdiff | |
- name: Extra setup on macOS | |
if: runner.os == 'macOS' | |
run: | | |
brew install gnu-time | |
brew install wdiff | |
opam exec -- echo "workspace=${{ github.workspace }}" >> $GITHUB_ENV | |
- name: Extra setup on Windows | |
if: runner.os == 'Windows' | |
run: | | |
opam exec -- cygpath -m ${{ github.workspace }} | % {$_ -replace "^","workspace=" } | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
opam exec -- cygpath -m "$Env:CYGWIN_ROOT" | % {$_ -replace "^","cygwin_root=" } | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
opam exec -- sed -i ' ' tests/sources/*.elpi | |
& "$Env:CYGWIN_ROOT/setup-x86_64.exe" -q -P time | |
& "$Env:CYGWIN_ROOT/setup-x86_64.exe" -q -P which | |
& "$Env:CYGWIN_ROOT/setup-x86_64.exe" -q -P wdiff | |
opam exec -- which which | |
opam exec -- time which | |
opam exec -- which time | |
opam exec -- which wdiff | |
# Build ###################################################################### | |
# | |
# We generate binaries like elpi-4.07.1-Linux.exe in the working directory | |
- name: Install real dependencies | |
run: | | |
opam install ./elpi.opam --deps-only --with-doc --with-test | |
- name: Install optional dependencies for menhir-camlp5 parser | |
if: matrix.parser == 'menhir-camlp5' | |
run: | | |
opam depext camlp5 || true # no depext on opam 2.1 | |
sudo apt-get install libstring-shellquote-perl | |
sudo apt-get install libipc-system-simple-perl | |
opam install ./elpi-option-legacy-parser.opam | |
opam exec -- make config LEGACY_PARSER=1 | |
- name: Build elpi with dune profile ${{ matrix.profile }} | |
run: | | |
opam exec -- dune subst | |
opam exec -- make build DUNE_OPTS='--profile ${{ matrix.profile }}' | |
opam exec -- cp _build/install/default/bin/elpi elpi-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }}.exe | |
opam exec -- cp _build/install/default/bin/elpi-trace-elaborator elpi-trace-elaborator-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }}.exe | |
- name: Strip binary | |
run: | | |
opam exec -- chmod u+w ${{ env.workspace }}/elpi-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }}.exe | |
opam exec -- chmod u+w ${{ env.workspace }}/elpi-trace-elaborator-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }}.exe | |
opam exec -- strip ${{ env.workspace }}/elpi-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }}.exe | |
opam exec -- strip ${{ env.workspace }}/elpi-trace-elaborator-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }}.exe | |
# Artifacts 1 ################################################################ | |
- name: Save binary | |
uses: actions/upload-artifact@v2 | |
with: | |
name: elpi-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }} | |
path: elpi*-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }}.exe | |
# Test ###################################################################### | |
# | |
# We run the test suite which also produces data.csf containing benchmarks | |
- name: Test elpi on Unix | |
if: runner.os != 'Windows' | |
run: opam exec -- make tests RUNNERS='dune ${{ env.workspace }}/elpi-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }}.exe ${{ env.workspace }}/elpi-trace-elaborator-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }}.exe' | |
- name: Test elpi on Windows | |
if: runner.os == 'Windows' | |
run: | | |
opam exec -- ls -l tests/sources/*.elpi | |
opam exec -- make tests PWD=${{ env.workspace }} RUNNERS='dune ${{ env.workspace }}/elpi-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }}.exe ${{ env.workspace }}/elpi-trace-elaborator-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }}.exe' TIME=--time=${{ env.cygwin_root }}/bin/time.exe | |
# Artifacts 2 ################################################################ | |
- name: Save logs | |
uses: actions/upload-artifact@v2 | |
if: always() | |
with: | |
name: .logs-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }} | |
path: _log | |
retention-days: 1 | |
- name: Save benchmarking data | |
uses: actions/upload-artifact@v2 | |
if: always() | |
with: | |
name: .benchmark-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }} | |
path: data.csv | |
retention-days: 1 | |
aggregate: | |
name: Aggregate and plot benchmarking data | |
runs-on: ubuntu-latest | |
needs: build | |
if: always() | |
strategy: | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install extra stuff | |
run: | | |
sudo apt-get update | |
sudo apt-get install lua5.1 gnuplot | |
- name: Download all artifacts | |
uses: actions/download-artifact@v2 | |
- name: Plotting aggregated data | |
run: | | |
cat .benchmark-*/data.csv > data.csv | |
tests/plot data.csv | |
gnuplot data.csv.plot | |
- name: Save benchmarking plot | |
uses: actions/upload-artifact@v2 | |
with: | |
name: benchmark-plot | |
path: data.csv.svg |