fix test suite on 32 bit architectures #932
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 | |
profile: | |
- dev | |
include: | |
- os: ubuntu-latest | |
ocaml-compiler: 5.2.x | |
profile: fatalwarnings | |
- os: macos-latest | |
ocaml-compiler: 5.2.x | |
profile: dev | |
- os: windows-latest | |
ocaml-compiler: 5.2.x | |
profile: dev | |
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@v4 | |
# 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: ocaml/setup-ocaml@v3 | |
with: | |
ocaml-compiler: ${{ matrix.ocaml-compiler }} | |
opam-local-packages: | |
- 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 -- sed -i ' ' tests/sources/*.elpi | |
& "setup-x86_64.exe" -v -q -P time,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: 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 }}-${{ runner.os }}.exe | |
opam exec -- cp _build/install/default/bin/elpi-trace-elaborator elpi-trace-elaborator-${{ matrix.ocaml-compiler }}-${{ runner.os }}.exe | |
- name: Strip binary | |
run: | | |
opam exec -- chmod u+w ${{ env.workspace }}/elpi-${{ matrix.ocaml-compiler }}-${{ runner.os }}.exe | |
opam exec -- chmod u+w ${{ env.workspace }}/elpi-trace-elaborator-${{ matrix.ocaml-compiler }}-${{ runner.os }}.exe | |
opam exec -- strip ${{ env.workspace }}/elpi-${{ matrix.ocaml-compiler }}-${{ runner.os }}.exe | |
opam exec -- strip ${{ env.workspace }}/elpi-trace-elaborator-${{ matrix.ocaml-compiler }}-${{ runner.os }}.exe | |
# Artifacts 1 ################################################################ | |
- name: Save binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: elpi-${{ matrix.ocaml-compiler }}-${{ runner.os }} | |
path: elpi*-${{ matrix.ocaml-compiler }}-${{ 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 }}-${{ runner.os }}.exe ${{ env.workspace }}/elpi-trace-elaborator-${{ matrix.ocaml-compiler }}-${{ 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 }}-${{ runner.os }}.exe ${{ env.workspace }}/elpi-trace-elaborator-${{ matrix.ocaml-compiler }}-${{ runner.os }}.exe' TIME=--time=D:/cygwin/bin/time.exe | |
# Artifacts 2 ################################################################ | |
- name: Save logs | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: .logs-${{ matrix.ocaml-compiler }}-${{ runner.os }} | |
path: _log | |
retention-days: 1 | |
- name: Save benchmarking data | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: .benchmark-${{ matrix.ocaml-compiler }}-${{ 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@v4 | |
- name: Install extra stuff | |
run: | | |
sudo apt-get update | |
sudo apt-get install lua5.1 gnuplot | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
- 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@v4 | |
with: | |
name: benchmark-plot | |
path: data.csv.svg |