Add OCaml 4 feature macros #6766
Workflow file for this run
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: build | |
on: [push, pull_request] | |
jobs: | |
build: | |
name: ${{ matrix.name }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: closure | |
config: --enable-middle-end=closure | |
os: ubuntu-latest | |
build_ocamlparam: '' | |
check_arch: true | |
use_runtime: d | |
ocamlrunparam: "v=0,V=1" | |
- name: closure_cfg | |
config: --enable-middle-end=closure --enable-poll-insertion | |
os: ubuntu-latest | |
build_ocamlparam: _,ocamlcfg=1 | |
- name: flambda1 | |
config: --enable-middle-end=flambda | |
os: ubuntu-latest | |
build_ocamlparam: '' | |
- name: flambda1_frame_pointers | |
config: --enable-middle-end=flambda --enable-frame-pointers --enable-poll-insertion | |
os: ubuntu-latest | |
build_ocamlparam: '' | |
- name: flambda1_cfg | |
config: --enable-middle-end=flambda --enable-poll-insertion | |
os: ubuntu-latest | |
build_ocamlparam: _,ocamlcfg=1 | |
- name: flambda2_debug_runtime | |
config: --enable-middle-end=flambda2 | |
os: ubuntu-latest | |
build_ocamlparam: '' | |
use_runtime: d | |
ocamlrunparam: "v=0,V=1" | |
- name: flambda2_debug_runtime_nnp | |
config: --enable-middle-end=flambda2 --disable-naked-pointers | |
os: ubuntu-latest | |
build_ocamlparam: '' | |
use_runtime: d | |
ocamlrunparam: "v=0,V=1" | |
- name: flambda2_nnp_o3 | |
config: --enable-middle-end=flambda2 --disable-naked-pointers | |
os: ubuntu-latest | |
build_ocamlparam: '' | |
ocamlparam: '_,O3=1' | |
- name: flambda2_frame_pointers_oclassic | |
config: --enable-middle-end=flambda2 --enable-frame-pointers --enable-poll-insertion | |
os: ubuntu-latest | |
build_ocamlparam: '' | |
ocamlparam: '_,Oclassic=1' | |
disable_testcases: 'ocaml/testsuite/tests/typing-local/regression_cmm_unboxing.ml ocaml/testsuite/tests/int64-unboxing/test.ml' | |
- name: flambda2_cfg | |
config: --enable-middle-end=flambda2 | |
os: ubuntu-latest | |
build_ocamlparam: _,ocamlcfg=1 | |
- name: flambda2_macos | |
config: --enable-middle-end=flambda2 | |
os: macos-latest | |
- name: irc | |
config: --enable-middle-end=flambda2 | |
os: ubuntu-latest | |
build_ocamlparam: '_,w=-46,regalloc=irc,regalloc-param=SPLIT_LIVE_RANGES:on,regalloc-param=IRC_SPILLING_HEURISTICS:flat-uses,regalloc-validate=1' | |
check_arch: true | |
- name: irc_frame_pointers | |
config: --enable-middle-end=flambda2 --enable-frame-pointers | |
os: ubuntu-latest | |
build_ocamlparam: '_,w=-46,regalloc=irc,regalloc-param=SPLIT_LIVE_RANGES:on,regalloc-param=IRC_SPILLING_HEURISTICS:flat-uses,regalloc-validate=1' | |
check_arch: true | |
- name: ls | |
config: --enable-middle-end=flambda2 | |
os: ubuntu-latest | |
build_ocamlparam: '_,w=-46,regalloc=ls,regalloc-param=SPLIT_LIVE_RANGES:on,regalloc-param=LS_ORDER:layout,regalloc-validate=1' | |
check_arch: true | |
- name: build_upstream_closure | |
config: --enable-middle-end=closure | |
os: ubuntu-20.04 | |
env: | |
J: "3" | |
# On macOS, the testsuite is slow, so run only on push to main (#507) | |
run_testsuite: "${{matrix.os != 'macos-latest' || (github.event_name == 'push' && github.event.ref == 'refs/heads/main')}}" | |
build_upstream: "${{matrix.name == 'build_upstream_closure'}}" | |
steps: | |
- name: Checkout the Flambda backend repo | |
uses: actions/checkout@master | |
with: | |
path: 'flambda_backend' | |
- name: Install AFL (for Linux workers) | |
if: matrix.os == 'ubuntu-latest' | |
run: sudo apt-get install afl++ | |
- name: Install AFL (for macOS workers) | |
if: matrix.os == 'macos-latest' | |
run: HOMEBREW_NO_INSTALL_CLEANUP=TRUE brew install afl-fuzz | |
- name: Cache OCaml 4.14, dune and menhir | |
uses: actions/cache@v2 | |
id: cache | |
with: | |
path: ${{ github.workspace }}/ocaml-414/_install | |
key: ${{ matrix.os }}-cache-ocaml-414-dune-361-menhir-20210419 | |
- name: Checkout OCaml 4.14 | |
uses: actions/checkout@master | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
repository: 'ocaml/ocaml' | |
path: 'ocaml-414' | |
ref: '4.14' | |
- name: Build OCaml 4.14 | |
if: steps.cache.outputs.cache-hit != 'true' | |
working-directory: ocaml-414 | |
run: | | |
./configure --prefix=$GITHUB_WORKSPACE/ocaml-414/_install | |
make -j $J world.opt | |
make install | |
# Remove unneeded parts to shrink cache file | |
rm -rf $GITHUB_WORKSPACE/ocaml-414/_install/{lib/ocaml/expunge,bin/*.byte} | |
- name: Checkout dune github repo | |
uses: actions/checkout@master | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
repository: 'ocaml/dune' | |
ref: '3.6.1' | |
path: 'dune' | |
- name: Build dune | |
working-directory: dune | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
PATH=$GITHUB_WORKSPACE/ocaml-414/_install/bin:$PATH make release | |
cp _boot/dune.exe $GITHUB_WORKSPACE/ocaml-414/_install/bin/dune | |
# CR mshinwell: This should use git@gitlab.inria.fr:fpottier/menhir.git | |
- name: Checkout menhir github repo | |
uses: actions/checkout@master | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
repository: 'LexiFi/menhir' | |
ref: '20210419' | |
path: 'menhir' | |
- name: Build menhir | |
working-directory: menhir | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
PATH=$GITHUB_WORKSPACE/ocaml-414/_install/bin:$PATH dune build | |
cp _build/install/default/bin/menhir $GITHUB_WORKSPACE/ocaml-414/_install/bin/menhir | |
# Our dune rule uses `menhirLib.mli`, which we can't simply `cp` | |
# because it's a symbolic link to a relative path. | |
export SOURCE_DIR=_build/install/default/lib/menhirLib | |
export TARGET_DIR=$GITHUB_WORKSPACE/ocaml-414/_install/lib/menhirLib | |
mkdir -p $TARGET_DIR | |
cat $SOURCE_DIR/menhirLib.mli > $TARGET_DIR/menhirLib.mli | |
cat $SOURCE_DIR/menhirLib.ml > $TARGET_DIR/menhirLib.ml | |
- name: Install GNU parallel | |
if: matrix.os == 'macos-latest' | |
run: HOMEBREW_NO_INSTALL_CLEANUP=TRUE brew install parallel | |
- name: Disable any testcases | |
working-directory: flambda_backend | |
run: | | |
disable_testcases="${{matrix.disable_testcases}}" | |
if [ -n "$disable_testcases" ]; then | |
rm -fv $disable_testcases | |
fi | |
- name: Configure Flambda backend | |
working-directory: flambda_backend | |
run: | | |
autoconf | |
./configure \ | |
--prefix=$GITHUB_WORKSPACE/_install \ | |
--with-dune=$GITHUB_WORKSPACE/ocaml-414/_install/bin/dune \ | |
${{ matrix.config }} | |
- name: Build, install and test Flambda backend | |
working-directory: flambda_backend | |
run: | | |
if [ $run_testsuite = true ]; then target=ci; else target=compiler; fi | |
export PATH=$GITHUB_WORKSPACE/ocaml-414/_install/bin:$PATH | |
if [ $build_upstream = true ]; then make -j$J build_and_test_upstream; else make $target; fi | |
env: | |
BUILD_OCAMLPARAM: ${{ matrix.build_ocamlparam }} | |
OCAMLPARAM: ${{ matrix.ocamlparam }} | |
OCAMLRUNPARAM: ${{ matrix.ocamlrunparam }} | |
USE_RUNTIME: ${{ matrix.use_runtime }} | |
- name: Check other architectures | |
working-directory: flambda_backend | |
if: matrix.check_arch == true | |
run: | | |
PATH=$GITHUB_WORKSPACE/ocaml-414/_install/bin:$PATH make check_all_arches |