-
Notifications
You must be signed in to change notification settings - Fork 33
125 lines (95 loc) · 3.68 KB
/
build_static.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: Build statically linked binaries
on:
workflow_dispatch:
pull_request:
push:
tags:
- "v*.*.*"
branches:
- next
- main
jobs:
build-macos-static:
name: Build statically linked macOS binaries
# Only do this when explicitly requested since it takes a long time to
# build on macOS; no need to waste resources
if: ${{ github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/') }}
strategy:
matrix:
include:
- arch: x86_64
os: macos-12
- arch: aarch64
os: macos-14
permissions:
contents: write
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Retrieve annotated tags (https://github.com/actions/checkout/issues/290)
run: git fetch --tags --force
- uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: 4.14.1
dune-cache: true
- run: opam install . --locked --deps-only --ignore-constraints-on alt-ergo-lib,alt-ergo-parsers
- run: opam exec -- dune subst
- run: opam exec -- dune build --release @install --promote-install-files false
env:
LINK_MODE: mixed
- run: opam exec -- dune install -p alt-ergo --create-install-files --prefix opt/alt-ergo --relocatable
- uses: actions/upload-artifact@v4
with:
name: alt-ergo-${{ matrix.arch }}-macos
path: _destdir/opt/alt-ergo/bin/alt-ergo
- name: Release
uses: svenstaro/upload-release-action@v2
if: startsWith(github.ref, 'refs/tags/')
with:
asset_name: alt-ergo-$tag-${{ matrix.arch }}-macos
file: _destdir/opt/alt-ergo/bin/alt-ergo
build-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
permissions:
contents: write
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: Retrieve annotated tags (https://github.com/actions/checkout/issues/290)
run: git fetch --tags --force
- 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: opam exec -- dune build --release @install --promote-install-files false
env:
LINK_MODE: static
- run: opam exec -- dune install -p alt-ergo --create-install-files --prefix opt/alt-ergo --relocatable
- name: Upload musl artifact
uses: actions/upload-artifact@v4
with:
name: alt-ergo-x86_64-linux-musl
path: _destdir/opt/alt-ergo/bin/alt-ergo
- name: Release
uses: svenstaro/upload-release-action@v2
if: startsWith(github.ref, 'refs/tags/')
with:
asset_name: alt-ergo-$tag-x86_64-linux-musl
file: _destdir/opt/alt-ergo/bin/alt-ergo