Skip to content

Update binary-releases.yml #3

Update binary-releases.yml

Update binary-releases.yml #3

name: binary-releases
on:
push:
branches: [master]
jobs:
create-release:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create-new-release.outputs.upload_url }}
steps:
- name: Create GitHub release
id: create-new-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.run_number }}
release_name: Release ${{ github.run_number }}
macos-build:
runs-on: macos-latest
needs: create-release
steps:
- uses: actions/checkout@v2
- name: Opam modules cache
uses: actions/cache@v1
env:
cache-name: cache-opam-modules
with:
path: ~/.opam
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('mlang.opam', 'Makefile') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Set up OCaml
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: 4.11.2
- name: Install dependencies
run: |
brew install gmp mpfr
opam update
make init-without-switch
- name: Make mlang binary
run: |
eval $(opam env)
make build
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./_build/default/src/main.exe
asset_name: mlang-macos-v${{ github.run_number }}.exe
asset_content_type: application/octet-stream
linux-build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
needs: create-release
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Opam modules cache
uses: actions/cache@v1
env:
cache-name: cache-opam-modules
with:
# OCaml cache files are stored in `~/.opam` on Linux/macOS
path: ~/.opam
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('mlang.opam', 'Makefile') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
# TODO : Cache gmp and mpfr builds
- name: Set up OCaml
uses: ocaml/setup-ocaml@v2
with:
# Version of the OCaml compiler to initialise
ocaml-compiler: ocaml-variants.4.12.0+options,ocaml-option-flambda,ocaml-option-musl,ocaml-option-static
- name: Install dependencies
run: |
sudo apt update
sudo apt install m4 perl python3 clang git build-essential lzip libgmp-dev libmpfr-dev
wget https://ftp.gnu.org/gnu/gmp/gmp-6.2.1.tar.lz && tar xaf gmp-6.2.1.tar.lz
( cd gmp-6.2.1; CC=musl-gcc ./configure --prefix /tmp/gmp-prefix && make && make install )
wget https://www.mpfr.org/mpfr-4.1.0/mpfr-4.1.0.tar.xz && tar xaf mpfr-4.1.0.tar.xz
( cd mpfr-4.1.0; CC=musl-gcc ./configure --prefix /tmp/gmp-prefix -with-gmp=/tmp/gmp-prefix && make && make install )
eval $(opam env)
opam update
MPFR_PREFIX=/tmp/gmp-prefix GMP_PREFIX=/tmp/gmp-prefix make init-without-switch
- name: Make mlang binary
run: |
eval $(opam env)
make build-static
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./_build/default/src/main.exe
asset_name: mlang-linux-v${{ github.run_number }}.exe
asset_content_type: application/octet-stream