forked from ocaml-sf/learn-ocaml
73 lines (73 loc) · 2.12 KB
/
static-builds.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
name: Generate static binaries
on:
push:
branches:
- master
tags:
- '*'
pull_request:
branches:
- '**'
jobs:
static-bin-linux:
name: Builds static Linux binaries
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Build the binaries
run: |
./scripts/static-build.sh
- name: Test the binaries
run: |
bin=(./learn-ocaml-client ./learn-ocaml-server ./learn-ocaml)
file "${bin[@]}"
ldd "${bin[@]}"
for b in "${bin[@]}"; do ( set -x; "$b" --version ); done
- name: Archive static binaries
uses: actions/upload-artifact@v2
with:
name: static-binaries-linux
path: |
learn-ocaml
learn-ocaml-server
learn-ocaml-client
static-bin-macos:
name: Builds static Macos binaries
runs-on: macos-latest
env:
OPAMYES: 1
OPAMDEPEXTYES: 1
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Show OS version
run: |
sw_vers
system_profiler SPSoftwareDataType
uname -a
- name: Retrieve opam
run: |
mkdir "$HOME/bin"
wget https://github.com/ocaml/opam/releases/download/2.1.0/opam-2.1.0-x86_64-macos -O $HOME/bin/opam
chmod a+x $HOME/bin/opam
echo "$HOME/bin" >> $GITHUB_PATH
- name: Prepare build environment
run: |
opam init -a --bare
opam switch create . ocaml-base-compiler --deps-only
- name: Build the binaries
run: |
opam exec -- make LINKING_MODE=static
- name: Test the binaries
run: |
bin=(./learn-ocaml-client ./learn-ocaml-server ./learn-ocaml)
dir="_build/install/default/bin"
file "$dir"/*
otool -L "$dir"/*
for b in "${bin[@]}"; do ( set -x; "$dir/$b" --version ); done
- name: Archive static binaries
uses: actions/upload-artifact@v2
with:
name: static-binaries-macos
path: _build/install/default/bin/*