-
Notifications
You must be signed in to change notification settings - Fork 85
87 lines (71 loc) · 2.74 KB
/
build.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
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-v5
- 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