-
Notifications
You must be signed in to change notification settings - Fork 8
145 lines (123 loc) · 3.76 KB
/
build-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
136
137
138
139
140
141
142
143
144
145
# 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: main
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