Allow sharing traces with -share flag #933
This file contains hidden or 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@v4 | |
| - uses: actions/cache@v4 | |
| 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 apt packages" | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install bubblewrap musl-tools libucl1 | |
| - 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: Build zlib with musl | |
| run: | | |
| mkdir musl-zlib | |
| curl -L https://zlib.net/zlib-1.3.1.tar.gz | tar -xz -C musl-zlib --strip-components=1 | |
| cd musl-zlib | |
| CC=musl-gcc ./configure --libdir=/usr/lib/x86_64-linux-musl --includedir=/usr/include/x86_64-linux-musl | |
| make -j$(nproc) | |
| sudo make install | |
| - name: Build zstd with musl | |
| run: | | |
| mkdir musl-zstd | |
| curl -L https://github.com/facebook/zstd/releases/download/v1.5.5/zstd-1.5.5.tar.gz | \ | |
| tar -xz -C musl-zstd --strip-components=1 | |
| cd musl-zstd | |
| CC=musl-gcc make -j$(nproc) | |
| sudo make INCLUDEDIR=/usr/include/x86_64-linux-musl LIBDIR=/usr/lib/x86_64-linux-musl install | |
| - name: Use OCaml ${{ matrix.ocaml-version }} | |
| run: | | |
| 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.0.26.2 | |
| - 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@v4 | |
| 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 |