Skip to content

Build binaries

Build binaries #17

Workflow file for this run

name: Build binaries
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to use for building binaries'
required: true
default: 'master'
jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- macos
- ubuntu
ocaml-compiler:
- 4.12.0
runs-on: ${{ matrix.os }}-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Download older SDK
if: matrix.os == 'macos'
run: |
wget https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX10.11.sdk.tar.xz
tar -xvf MacOSX10.11.sdk.tar.xz
sudo mv MacOSX10.11.sdk /Library/Developer/CommandLineTools/SDKs
echo "MACOSX_DEPLOYMENT_TARGET=10.11" >> $GITHUB_ENV
echo "SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX10.11.sdk/" >> $GITHUB_ENV
- name: Use OCaml ${{ matrix.ocaml-compiler }}
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
cache-prefix: v3
- run: bash -x scripts/install_build_deps.sh
- name: Build
run: |
opam exec -- dune subst
opam exec -- dune build @install --profile static
- run: mv _build/default/src/stanc/stanc.exe ${{ matrix.os }}-stanc
- name: Upload ${{ matrix.os }} stanc
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-stanc
path: ${{ matrix.os }}-stanc
build-cross:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install cross-compiler
run: sudo apt-get update; sudo apt-get install -y gcc-mingw-w64-x86-64
- name: Use OCaml 4.12.0
uses: ocaml/setup-ocaml@v2
with:
cache-prefix: v1-windows
ocaml-compiler: ocaml-windows64.4.12.0
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@v3
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@v3
with:
name: stanc.js
path: stanc.js