Skip to content

Build binaries

Build binaries #22

Workflow file for this run

# Authors:
#
# Sam Gold <https://github.com/goldsam>
# Sebastian Stehle <https://github.com/SebastianStehle>
# Lucas Viana <https://github.com/LSViana>
name: Build binaries
on:
workflow_dispatch:
env:
YRS_REPO: https://github.com/y-crdt/y-crdt
YRS_BRANCH: release-v0.19.1
CARGO_TERM_COLOR: always
jobs:
# Based on https://www.rohanjain.in/cargo-cross/
build-native-binaries:
runs-on: ${{matrix.os}}
strategy:
matrix:
include:
# Windows
- build: win-x64
os: windows-latest
rust: stable
target: x86_64-pc-windows-msvc
linker: mingw-w64
cross: false
# Linux
- build: linux-x64
os: ubuntu-20.04
rust: stable
target: x86_64-unknown-linux-gnu
cross: false
- build: linux-x64-musl
os: ubuntu-20.04
rust: stable
target: x86_64-unknown-linux-musl
cross: false
- build: linux-armv7
os: ubuntu-20.04
rust: stable
target: armv7-unknown-linux-gnueabihf
linker: gcc-arm-linux-gnueabihf
cross: true
- build: linux-armv7-musl
os: ubuntu-20.04
rust: stable
target: armv7-unknown-linux-musleabihf
linker: gcc-arm-linux-gnueabihf
cross: true
- build: linux-arm64
os: ubuntu-20.04
rust: stable
target: aarch64-unknown-linux-gnu
linker: gcc-aarch64-linux-gnu
cross: true
- build: linux-arm64-musl
os: ubuntu-20.04
rust: stable
target: aarch64-unknown-linux-musl
linker: gcc-aarch64-linux-gnu
cross: true
# macOS
- build: macos-x86_64
os: macos-latest
rust: stable
target: x86_64-apple-darwin
cross: false
- build: macos-aarch64
os: macos-latest
rust: stable
target: aarch64-apple-darwin
cross: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Cross
if: matrix.cross
uses: taiki-e/install-action@v2
with:
tool: cross
- name: Install musl tools
run: sudo apt install -y musl musl-dev musl-tools
if: endsWith(matrix.build, '-musl')
- name: Install Linker
if: matrix.cross
run: |
sudo apt update
sudo apt install ${{ matrix.linker }}
cat .cargo/config.github >> .cargo/config
- name: Install Rust
run: |
rustup install ${{ matrix.rust }}
rustup target add ${{ matrix.target }}
rustup show
- name: Clone Yrs
run: |
git clone ${YRS_REPO} --branch ${YRS_BRANCH} --single-branch yrs
shell: bash
- name: Patch build (Git)
if: ${{ false }}
run: |
cd yrs
git apply ../native/build.patch
shell: bash
- name: Build (Cargo)
if: "!matrix.cross"
run: |
cd yrs
RUSTFLAGS="-C target-feature=-crt-static" cargo build --release --target ${{ matrix.target }}
shell: bash
- name: Build (Cross)
if: matrix.cross
run: |
cd yrs
RUSTFLAGS="-C target-feature=-crt-static" cross build --release --target ${{ matrix.target }}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.build }}
path: |
yrs/target/${{ matrix.target }}/release/*yrs.dll
yrs/target/${{ matrix.target }}/release/*yrs.so
yrs/target/${{ matrix.target }}/release/*yrs.dylib