feat: Statically linked binary releases #6
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 statically linked binaries | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- next | |
- main | |
jobs: | |
musl: | |
name: Build statically linked binary with musl | |
runs-on: ubuntu-latest | |
# Retrieve and use a light docker container on which ocaml 4.14 is installed | |
# as a system compiler. This container also contains opam 2.1. | |
container: | |
image: ocamlpro/ocaml:4.14-flambda | |
options: --user root | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Switch to ocaml user | |
run: su ocaml | |
# This line is needed to acces and use opam. We are unable to set the user | |
# to `ocaml` with the container parameters | |
- run: sudo chmod a+wx . | |
# This line is needed to allow the working directory to be used even | |
# the ocaml user do not have rights on it. | |
- run: CURRENTDIR=$(basename $(pwd)); git config --global --add safe.directory /__w/$CURRENTDIR/$CURRENTDIR | |
- name: Install static dependencies | |
run: sudo apk add zlib-static | |
- run: opam switch create . ocaml-system --locked --deps-only --ignore-constraints-on alt-ergo-lib,alt-ergo-parsers | |
- run: opam exec -- dune subst | |
- name: Build statically linked binary | |
run: LINK_MODE=static opam exec -- dune build --release src/bin/text/Main_text.exe | |
- run: cp src/bin/text/Main_text.exe src/bin/text/alt-ergo | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: alt-ergo-x86_64-linux-musl | |
path: src/bin/text/alt-ergo |