Merge core
and src
directories
#843
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: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
ocaml-version: | |
- 4.14.0 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- uses: actions/cache@v2 | |
with: | |
path: ~/.opam | |
key: ${{ matrix.os }}-opam-${{ matrix.ocaml-version }}-flambda-musl-v6 | |
- name: Install musl-compatible kernel headers | |
run: | | |
mkdir musl-kernel | |
curl -L https://github.com/sabotage-linux/kernel-headers/archive/refs/tags/v4.19.88-1.tar.gz | \ | |
tar -xz -C musl-kernel --strip-components=1 | |
echo "C_INCLUDE_PATH=$(pwd)/musl-kernel/x86/include" >> "$GITHUB_ENV" | |
- name: Install upx | |
run: | | |
# The version that comes with focal is broken for musl binaries, so we have to download | |
# from another location. | |
wget http://ftp.debian.org/debian/pool/main/u/upx-ucl/upx-ucl_3.96-2_amd64.deb | |
sudo dpkg -i upx-ucl_3.96-2_amd64.deb | |
- name: Use OCaml ${{ matrix.ocaml-version }} | |
run: | | |
sudo apt-get update | |
sudo apt-get install bubblewrap musl-tools | |
sudo wget -O /usr/local/bin/opam https://github.com/ocaml/opam/releases/download/2.1.2/opam-2.1.2-x86_64-linux | |
sudo chmod a+x /usr/local/bin/opam | |
export OPAMYES=1 | |
export OPAMJOBS=$(($(nproc) + 2)) | |
echo "OPAMYES=1" >> "$GITHUB_ENV" | |
echo "OPAMJOBS=$OPAMJOBS" >> "$GITHUB_ENV" | |
opam init --bare -yav https://github.com/ocaml/opam-repository.git | |
opam switch set ${{ matrix.ocaml-version }}-flambda-musl 2>/dev/null || \ | |
opam switch create ${{ matrix.ocaml-version }}-flambda-musl \ | |
--packages=ocaml-variants.${{ matrix.ocaml-version }}+options,ocaml-option-flambda,ocaml-option-musl | |
- run: opam install ./magic-trace.opam --deps-only | |
- run: opam install ocamlformat | |
- run: opam exec -- dune build @fmt | |
- run: opam exec -- make PROFILE=static | |
- run: opam exec -- dune runtest | |
- name: Compress magic-trace executable | |
run: | | |
cp _build/install/default/bin/magic-trace . | |
ls -l magic-trace | |
strip magic-trace | |
upx -9 magic-trace | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: magic-trace | |
path: magic-trace | |
if-no-files-found: error | |
- name: Upload to GitHub releases | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: magic-trace | |
asset_name: magic-trace | |
tag: ${{ github.ref }} | |
overwrite: true |