Skip to content

Commit

Permalink
Build universal binary in github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
WardBrian committed Jan 2, 2025
1 parent 0419d50 commit 2883bbd
Showing 1 changed file with 42 additions and 13 deletions.
55 changes: 42 additions & 13 deletions .github/workflows/binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ jobs:
matrix:
include:
- os: ubuntu-latest
sdk: ""
name: ubuntu
- os: macos-13
name: macos
sdk: "10.11"
name: macos-x86_64
- os: macos-latest
sdk: "11.0"
name: macos-arm64

runs-on: ${{ matrix.os }}

Expand All @@ -24,27 +29,28 @@ jobs:
uses: actions/checkout@v4

- name: Download older SDK
if: matrix.name == 'macos'
if: matrix.sdk != ''
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
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=10.11" >> $GITHUB_ENV
echo "SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX10.11.sdk/" >> $GITHUB_ENV
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@v2
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ env.OCAML_VERSION }}
dune-cache: ${{ matrix.name != 'macos-x86_64' }}

- if: matrix.name == 'macos'
- 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 == 'macos'
if: matrix.name != 'ubuntu'
run: opam exec -- dune subst; opam exec -- dune build

- name: Build ubuntu
Expand All @@ -59,6 +65,28 @@ jobs:
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

Expand All @@ -70,13 +98,14 @@ jobs:
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@v2
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
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

Expand Down

0 comments on commit 2883bbd

Please sign in to comment.