-
-
Notifications
You must be signed in to change notification settings - Fork 3
226 lines (186 loc) · 7.35 KB
/
Copy pathci.yml
File metadata and controls
226 lines (186 loc) · 7.35 KB
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
name: CI
on:
push:
branches:
- main
pull_request:
# Run daily to catch when Rust updates cause problems to happen.
schedule:
- cron: '00 01 * * *'
jobs:
rust:
name: Rust
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
toolchain: ["stable"]
runs-on: ${{ matrix.os }}
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: 1
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
submodules: recursive
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- name: Build (secure)
run: cargo build --features secure
- name: Test (secure)
run: cargo test --features secure
- name: Test libmimalloc-sys crate bindings (secure)
run: cargo run --features secure -p libmimalloc-sys-test
- name: Test libmimalloc-sys crate bindings (v3)
run: cargo run --features v3 -p libmimalloc-sys-test
- name: Build (no secure)
run: cargo build
- name: Test (no secure)
run: cargo test
- name: Test libmimalloc-sys crate bindings (no secure)
run: cargo run -p libmimalloc-sys-test
- name: Build (extended)
run: cargo build --features extended
- name: Test (extended)
run: cargo test --features extended
- name: Test (v3)
run: cargo test --features v3
- name: Test (extended, v3)
run: cargo test --features extended,v3
- name: Test libmimalloc-sys crate bindings (extended)
run: cargo run --features extended -p libmimalloc-sys-test
lint:
name: Rustfmt / Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Fmt
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --workspace -- -D warnings
# Detect cases where documentation links would be dead
doc:
name: Check documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@nightly
# Note: We need to use nightly rust, and `cargo rustdoc` (yes, not `cargo
# doc`) to actually get it to respect -D warnings... Using nightly also
# gets us the nicer syntax for linking to functions, and is in-line with
# what docs.rs uses.
- name: 'Check documentation links in `mimalloc`'
run: cargo rustdoc -- -D warnings
- name: 'Check documentation links in `libmimalloc-sys`'
run: cargo rustdoc -p libmimalloc-sys2 -- -D warnings
build-example:
name: Build example ${{ matrix.settings.target }}
strategy:
fail-fast: false
matrix:
settings:
- host: macos-latest
target: x86_64-apple-darwin
- host: windows-latest
target: x86_64-pc-windows-msvc
- host: windows-latest
target: i686-pc-windows-msvc
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
- host: ubuntu-latest
target: x86_64-unknown-linux-musl
- host: macos-latest
target: aarch64-apple-darwin
- host: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
- host: ubuntu-latest
target: armv7-unknown-linux-gnueabihf
- host: ubuntu-latest
target: aarch64-linux-android
- host: ubuntu-24.04-arm
target: aarch64-unknown-linux-musl
- host: windows-latest
target: aarch64-pc-windows-msvc
- host: ubuntu-latest
target: powerpc64le-unknown-linux-gnu
- host: ubuntu-latest
target: s390x-unknown-linux-gnu
- host: ubuntu-latest
target: wasm32-wasip1-threads
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- name: Install
run: rustup target add ${{ matrix.settings.target }}
- uses: goto-bus-stop/setup-zig@v2
if: ${{ contains(matrix.settings.target, 'musl') }}
with:
version: 0.15.2
- name: Install cargo-zigbuild
uses: taiki-e/install-action@v2
if: ${{ contains(matrix.settings.target, 'musl') }}
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tool: cargo-zigbuild
- uses: actions/setup-node@v6
with:
node-version: 24
- name: Install dependencies
working-directory: example
run: |
corepack enable
yarn install
- name: Install wasi-sdk
if: ${{ matrix.settings.target == 'wasm32-wasip1-threads' }}
run: |
mkdir -p $HOME/wasi-sdk
curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz | tar -xzf - -C $HOME/wasi-sdk --strip-components=1
echo "WASI_SDK_PATH=$HOME/wasi-sdk" >> $GITHUB_ENV
- name: Build
working-directory: example
shell: bash
run: |
if [[ "${{ matrix.settings.target }}" == *"musl"* ]]; then
yarn build --target ${{ matrix.settings.target }} -x
yarn build --target ${{ matrix.settings.target }} -x --release
yarn build --target ${{ matrix.settings.target }} -x --features v3
yarn build --target ${{ matrix.settings.target }} -x --features v3 --release
elif [[ "${{ matrix.settings.target }}" == *"gnu"* ]]; then
export TARGET_CFLAGS="-fuse-ld=lld"
export TARGET_CC=clang
yarn build --target ${{ matrix.settings.target }} --use-napi-cross
yarn build --target ${{ matrix.settings.target }} --use-napi-cross --release
yarn build --target ${{ matrix.settings.target }} --use-napi-cross --features v3
yarn build --target ${{ matrix.settings.target }} --use-napi-cross --features v3 --release
elif [[ "${{ matrix.settings.target }}" == *"msvc"* ]]; then
yarn build --target ${{ matrix.settings.target }}
yarn build --target ${{ matrix.settings.target }} --release
yarn build --target ${{ matrix.settings.target }} --features v3
yarn build --target ${{ matrix.settings.target }} --features v3 --release
mkdir -p .cargo
echo "[target.${{ matrix.settings.target }}]" >> .cargo/config.toml
echo "rustflags = [\"-C\", \"target-feature=+crt-static\"]" >> .cargo/config.toml
yarn build --target ${{ matrix.settings.target }} --release
yarn build --target ${{ matrix.settings.target }} --features v3 --release
elif [[ "${{ matrix.settings.target }}" == *"wasm"* ]]; then
yarn build --target ${{ matrix.settings.target }}
yarn build --target ${{ matrix.settings.target }} --release
else
yarn build --target ${{ matrix.settings.target }}
yarn build --target ${{ matrix.settings.target }} --release
yarn build --target ${{ matrix.settings.target }} --features v3
yarn build --target ${{ matrix.settings.target }} --features v3 --release
fi