-
-
Notifications
You must be signed in to change notification settings - Fork 47
135 lines (105 loc) · 3.65 KB
/
binaries.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
126
127
128
129
130
131
132
133
134
135
name: Build binaries
on:
workflow_dispatch: {}
env:
OCAML_VERSION: 4.14.1
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
sdk: ""
name: ubuntu
- os: macos-13
sdk: "10.11"
name: macos-x86_64
- os: macos-latest
sdk: "11.0"
name: macos-arm64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download older SDK
if: matrix.sdk != ''
run: |
wget /~https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX${{matrix.sdk}}.sdk.tar.xz
tar -xvf MacOSX${{matrix.sdk}}.sdk.tar.xz
sudo mv MacOSX${{matrix.sdk}}.sdk /Library/Developer/CommandLineTools/SDKs
echo "MACOSX_DEPLOYMENT_TARGET=${{matrix.sdk}}" >> $GITHUB_ENV
echo "SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX${{matrix.sdk}}.sdk/" >> $GITHUB_ENV
- name: Use OCaml ${{ env.OCAML_VERSION }}
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ env.OCAML_VERSION }}
dune-cache: ${{ matrix.name != 'macos-x86_64' }}
- if: matrix.name == 'macos-x86_64'
run: opam pin -y dune 3.6.0 --no-action
- run: bash -x scripts/install_build_deps.sh
- name: Build macos
if: matrix.name != 'ubuntu'
run: opam exec -- dune subst; opam exec -- dune build
- name: Build ubuntu
if: matrix.name == 'ubuntu'
run: opam exec -- dune subst; opam exec -- dune build --profile static
- run: mv _build/default/src/stanc/stanc.exe ${{ matrix.name }}-stanc
- name: Upload ${{ matrix.name }} stanc
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}-stanc
path: ${{ matrix.name }}-stanc
build-universal:
needs: build
runs-on: macos-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Run lipo
run: |
ls
lipo -create -output macos-stanc macos-*-stanc
lipo -archs macos-stanc
- name: Upload macos-stanc
uses: actions/upload-artifact@v4
with:
name: macos-stanc
path: macos-stanc
build-cross:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install cross-compiler
run: sudo apt-get update; sudo apt-get install -y gcc-mingw-w64-x86-64
- name: Use OCaml ${{ env.OCAML_VERSION }}
uses: ocaml/setup-ocaml@v3
with:
cache-prefix: v1-windows
dune-cache: true
ocaml-compiler: ocaml-windows64.${{ env.OCAML_VERSION }}
opam-repositories: |
windows: http://github.com/ocaml-cross/opam-cross-windows.git
default: /~https://github.com/ocaml/opam-repository.git
- run: bash -x scripts/install_build_deps_windows.sh
- name: Build
run: |
opam exec -- dune subst
opam exec -- dune build -x windows
- run: mv _build/default.windows/src/stanc/stanc.exe windows-stanc
- name: Upload Windows stanc
uses: actions/upload-artifact@v4
with:
name: windows-stanc
path: windows-stanc
- run: bash -x scripts/install_js_deps.sh
- run: opam exec -- dune build --profile release src/stancjs
- run: mv _build/default/src/stancjs/stancjs.bc.js stanc.js
- name: Upload stanc.js
uses: actions/upload-artifact@v4
with:
name: stanc.js
path: stanc.js