86 lines
2.7 KiB
YAML
86 lines
2.7 KiB
YAML
name: build
|
|
|
|
on:
|
|
- push
|
|
- pull_request
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
matrix:
|
|
os:
|
|
- ubuntu_x64_8_cores
|
|
ocaml-version:
|
|
- '5.2.0+ox'
|
|
oxcaml-opam-commit:
|
|
- '231c88c2e564fdca40e15e750aacad5fb0887435'
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
container:
|
|
image: alpine:latest
|
|
steps:
|
|
# This has to come first because the `actions/*` GitHub Actions require `node`,
|
|
# which isn't installed by default on this container image.
|
|
- name: "Install apk packages"
|
|
run: |
|
|
apk add autoconf bash bubblewrap build-base clang coreutils git libstdc++ \
|
|
libstdc++-dev libunwind-static linux-headers lld llvm20 llvm20-dev llvm20-static \
|
|
nodejs opam rsync upx zlib-static zstd-static
|
|
echo "PATH=/usr/lib/llvm20/bin:$PATH" >> "$GITHUB_ENV"
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
|
|
# This is necessary to avoid an error of the form 'fatal: detected dubious ownership in repository ...'
|
|
- run: git config --global --add safe.directory $(pwd)
|
|
|
|
- uses: actions/cache@v5
|
|
with:
|
|
path: ~/.opam
|
|
key: ${{ matrix.os }}-opam-${{ matrix.ocaml-version }}-${{ matrix.oxcaml-opam-commit }}-2
|
|
|
|
- name: Use OCaml ${{ matrix.ocaml-version }}
|
|
run: |
|
|
export OPAMYES=1
|
|
export OPAMJOBS=$(($(nproc) + 2))
|
|
export OPAMROOTISOK=1
|
|
echo "OPAMYES=1" >> "$GITHUB_ENV"
|
|
echo "OPAMJOBS=$OPAMJOBS" >> "$GITHUB_ENV"
|
|
echo "OPAMROOTISOK=$OPAMROOTISOK" >> "$GITHUB_ENV"
|
|
|
|
opam init --bare -yav https://github.com/ocaml/opam-repository.git
|
|
opam switch set ${{ matrix.ocaml-version }} 2>/dev/null || \
|
|
opam switch create ${{ matrix.ocaml-version }} --repos "ox=git+https://github.com/oxcaml/opam-repository.git#${{ matrix.oxcaml-opam-commit }},default"
|
|
|
|
- run: opam install . --deps-only --locked --with-test
|
|
|
|
- run: opam exec -- dune build @fmt
|
|
|
|
- run: opam exec -- make PROFILE=static
|
|
|
|
- run: opam exec -- dune runtest --profile=static
|
|
|
|
- name: Compress magic-trace executable
|
|
run: |
|
|
cp _build/install/default/bin/magic-trace .
|
|
chmod u+w magic-trace
|
|
ls -l magic-trace
|
|
strip magic-trace
|
|
upx -9 magic-trace
|
|
|
|
- uses: actions/upload-artifact@v6
|
|
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
|