-
-
Notifications
You must be signed in to change notification settings - Fork 53
200 lines (165 loc) · 5.21 KB
/
build.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
name: Build
on:
push:
paths:
- "crates/*"
- "Cargo.*"
- ".github/workflows/build.yml"
branches:
- master
- dev
pull_request:
paths:
- "crates/*"
- "Cargo.*"
- ".github/workflows/build.yml"
branches:
- master
jobs:
build-macos:
name: Build for macos
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/cache@v4
id: cargo-cache
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
# - name: Setup nightly rust
# run: rustup default nightly
- name: Install rust target
run: |
rustup target add x86_64-apple-darwin
rustup target add aarch64-apple-darwin
- name: Build x86-64
run: |
cargo build --target=x86_64-apple-darwin
cargo build --target=x86_64-apple-darwin --package cloudmusic-macmedia
- uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-x86_64
path: crates/native/index.node
- uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-media-x86_64
path: crates/macmedia/media
- name: Build aarch64
run: |
cargo build --target=aarch64-apple-darwin
cargo build --target=aarch64-apple-darwin --package cloudmusic-macmedia
- uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-aarch64
path: crates/native/index.node
- uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-media-aarch64
path: crates/macmedia/media
build-linux:
name: Build for linux
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Installing needed Ubuntu dependencies
run: |
sudo apt-get update
sudo apt-get install -y libasound2-dev \
libdbus-1-dev \
# sudo apt-get install -y libx11-dev
- uses: actions/cache@v4
id: cargo-cache
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
# - name: Setup nightly rust
# run: rustup default nightly
- name: Install rust target
run: |
rustup target add x86_64-unknown-linux-gnu
# rustup target add aarch64-unknown-linux-gnu
# rustup target add armv7-unknown-linux-gnueabihf
- name: Build x86-64
run: cargo build --target x86_64-unknown-linux-gnu
- uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-x86_64
path: crates/native/index.node
- name: Build image
run: |
docker build -t cross/aarch64:v1 -f docker/Dockerfile.aarch64-unknown-linux-gnu .
docker build -t cross/armv7:v1 -f docker/Dockerfile.armv7-unknown-linux-gnueabihf .
- run: cargo clean
- name: Build aarch64
uses: actions-rs/cargo@v1
with:
command: build
use-cross: true
args: --target aarch64-unknown-linux-gnu
- uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-aarch64
path: crates/native/index.node
- run: cargo clean
- name: Build armv7
uses: actions-rs/cargo@v1
with:
command: build
use-cross: true
args: --target armv7-unknown-linux-gnueabihf
- uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-armv7
path: crates/native/index.node
build-windows:
name: Build for windows
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v2
with:
version: "17"
directory: ${{ runner.temp }}/llvm
- uses: actions/cache@v4
id: cargo-cache
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
# - name: Setup nightly rust
# run: rustup default nightly
- name: Install rust target
run: |
rustup target add x86_64-pc-windows-msvc
rustup target add aarch64-pc-windows-msvc
- name: Build x86-64
run: cargo build --target x86_64-pc-windows-msvc
env:
LIBCLANG_PATH: ${{ runner.temp }}/llvm/bin
- uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-x86_64
path: crates/native/index.node
- name: Build aarch64
run: cargo build --target aarch64-pc-windows-msvc
env:
LIBCLANG_PATH: ${{ runner.temp }}/llvm/bin
- uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-aarch64
path: crates/native/index.node