forked from aldanor/hdf5-rust
-
Notifications
You must be signed in to change notification settings - Fork 4
326 lines (311 loc) · 12.5 KB
/
ci.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
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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: '0 18 * * *'
concurrency:
group: ${{ github.workflow }}-@{{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
typos:
name: Spell checking (typos)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check spelling
uses: crate-ci/typos@6802cc60d4e7f78b9d5454f6cf3935c042d5e1e3 # v1.26.0
lint:
name: lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- {command: fmt, rust: nightly}
- {command: clippy, rust: stable}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust (${{matrix.rust}})
uses: dtolnay/rust-toolchain@stable
with: {toolchain: '${{matrix.rust}}', components: 'rustfmt, clippy'}
- name: Install HDF5
run: sudo apt-get update && sudo apt-get install libhdf5-dev
- name: Run cargo ${{matrix.command}}
run: cargo ${{matrix.command}} ${{matrix.command == 'fmt' && '--all -- --check' || '--workspace --exclude hdf5-metno-src -- -D warnings -D clippy::cargo -A clippy::multiple-crate-versions'}}
doc: # This task should mirror the procedure on docs.rs
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with: {submodules: true}
- name: Install Rust (${{matrix.rust}})
uses: dtolnay/rust-toolchain@stable
with: {toolchain: nightly}
- name: Document workspace
env:
RUSTDOCFLAGS: "--cfg docsrs"
run: cargo doc --features static,zlib,blosc,lzf,f16,complex
brew:
name: brew
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
include:
- {version: [email protected]}
- {version: [email protected]}
- {version: hdf5-mpi, mpi: true}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with: {submodules: true}
- name: Install Rust (${{matrix.rust}})
uses: dtolnay/rust-toolchain@stable
with: {toolchain: stable}
- name: Install HDF5 (${{matrix.version}})
run: brew install ${{matrix.version}}
- name: Build and test all crates
run: |
[ "${{matrix.mpi}}" != "" ] && FEATURES=mpio
cargo test -vv --features="$FEATURES"
conda:
name: conda
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
include:
- {os: ubuntu-latest, version: 1.8.16, channel: conda-forge, rust: stable}
- {os: windows-latest, version: 1.8.17, channel: conda-forge, rust: stable}
- {os: macos-13, version: 1.8.18, channel: anaconda, rust: stable}
- {os: ubuntu-latest, version: 1.8.20, channel: anaconda, rust: beta}
- {os: ubuntu-latest, version: 1.10.1, channel: anaconda, rust: nightly}
- {os: windows-latest, version: 1.10.2, channel: anaconda, rust: beta}
- {os: ubuntu-latest, version: 1.10.3, channel: conda-forge, rust: nightly}
- {os: windows-latest, version: 1.10.4, channel: anaconda, rust: nightly}
- {os: ubuntu-latest, version: 1.10.4, mpi: openmpi, channel: conda-forge, rust: stable}
- {os: ubuntu-latest, version: 1.10.5, channel: conda-forge, rust: beta}
- {os: macos-13, version: 1.10.5, mpi: openmpi, channel: conda-forge, rust: beta}
- {os: ubuntu-latest, version: 1.10.6, channel: anaconda, rust: stable}
- {os: ubuntu-latest, version: 1.10.6, mpi: mpich, channel: conda-forge, rust: nightly}
# - {os: ubuntu, version: 1.10.8, channel: conda-forge, rust: stable}
- {os: ubuntu-latest, version: 1.12.0, mpi: openmpi, channel: conda-forge, rust: stable}
- {os: macos-latest, version: 1.12.0, channel: conda-forge, rust: stable}
- {os: windows-latest, version: 1.12.0, channel: conda-forge, rust: stable}
- {os: ubuntu-latest, version: 1.12.1, channel: conda-forge, rust: stable}
- {os: macos-latest, version: 1.14.0, channel: conda-forge, rust: stable}
- {os: windows-latest, version: 1.14.0, channel: conda-forge, rust: stable}
- {os: ubuntu-latest, version: 1.14.0, channel: conda-forge, rust: stable}
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with: {submodules: true}
- name: Install Rust (${{matrix.rust}})
uses: dtolnay/rust-toolchain@stable
with: {toolchain: '${{matrix.rust}}'}
- name: Install conda
uses: conda-incubator/setup-miniconda@v3
with: {auto-update-conda: false, activate-environment: testenv, miniconda-version: latest}
- name: Set conda for Arm64
if: runner.arch == 'arm64' && runner.os == 'macOS'
run: conda config --env --set subdir osx-arm64
- name: Install HDF5 (${{matrix.version}}${{matrix.mpi && '-' || ''}}${{matrix.mpi}})
run: |
[ "${{matrix.mpi}}" != "" ] && MPICC_PKG=${{matrix.mpi}}-mpicc
conda install -y -c ${{matrix.channel}} 'hdf5=${{matrix.version}}=*${{matrix.mpi}}*' $MPICC_PKG
- name: Build and test all crates
run: |
export HDF5_DIR="$CONDA_PREFIX"
[ "${{matrix.mpi}}" != "" ] && FEATURES=mpio
[ "${{runner.os}}" != "Windows" ] && export RUSTFLAGS="-C link-args=-Wl,-rpath,$CONDA_PREFIX/lib"
[ "${{matrix.mpi}}" == "mpich" ] && [ "${{runner.os}}" == "Linux" ] && export MPICH_CC=$(which gcc)
[ "${{matrix.mpi}}" == "openmpi" ] && [ "${{runner.os}}" == "Linux" ] && export OMPI_CC=$(which gcc)
cargo test -vv --features="$FEATURES"
static:
name: static
runs-on: ${{matrix.os}}-latest
strategy:
fail-fast: false
matrix:
include:
- {os: ubuntu, rust: stable}
- {os: windows, rust: stable-msvc}
# - {os: windows, rust: stable-gnu}
- {os: macos, rust: stable}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with: {submodules: true}
- name: Install Rust (${{matrix.rust}})
uses: dtolnay/rust-toolchain@stable
with: {toolchain: '${{matrix.rust}}'}
- name: Build and test all crates
run: cargo test --workspace -vvv --features hdf5-sys/static,hdf5-sys/zlib --exclude hdf5-metno-derive
- name: Build and test with filters and other features
run: cargo test --workspace -v --features hdf5-sys/static,hdf5-sys/zlib,lzf,blosc,f16,complex --exclude hdf5-metno-derive
if: matrix.rust != 'stable-gnu'
- name: Run examples
run: |
cargo r --example simple --features hdf5-sys/static,hdf5-sys/zlib,lzf,blosc
cargo r --example chunking --features hdf5-sys/static,hdf5-sys/zlib,lzf,blosc
if: matrix.rust != 'stable-gnu'
apt:
name: apt
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- {mpi: mpich, rust: beta}
- {mpi: openmpi, rust: stable}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with: {submodules: true}
- name: Install Rust (${{matrix.rust}})
uses: dtolnay/rust-toolchain@stable
with: {toolchain: '${{matrix.rust}}'}
- name: Install HDF5 (${{matrix.mpi}})
run: |
[ "${{matrix.mpi}}" == "mpich" ] && PACKAGES="libhdf5-mpich-dev mpich"
[ "${{matrix.mpi}}" == "openmpi" ] && PACKAGES="libhdf5-openmpi-dev openmpi-bin"
[ "${{matrix.mpi}}" == "serial" ] && PACKAGES="libhdf5-dev"
sudo apt-get install $PACKAGES
- name: Build and test all crates
run: |
[ "${{matrix.mpi}}" != "serial" ] && FEATURES=mpio
cargo test -vv --features="$FEATURES"
- name: Test crate for locking on synchronisation
run: |
[ "${{matrix.mpi}}" != "serial" ] && FEATURES=mpio
cargo test -vv --features="$FEATURES" -- lock_part
cargo test -vv --features="$FEATURES" -- lock_part
cargo test -vv --features="$FEATURES" -- lock_part
msi:
name: msi
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
rust: [stable]
version: ["1.8", "1.10", "1.12", "1.14"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with: {submodules: true}
- name: Install Rust (${{matrix.rust}})
uses: dtolnay/rust-toolchain@stable
with: {toolchain: '${{matrix.rust}}'}
- name: Configure environment
shell: bash
run: |
if [[ "${{matrix.version}}" == "1.8" ]]; then
VERSION=1.8.21
DL_PATH=hdf5-1.8.21-Std-win7_64-vs14.zip
echo "MSI_PATH=hdf\\HDF5-1.8.21-win64.msi" >> $GITHUB_ENV
elif [[ "${{matrix.version}}" == "1.10" ]]; then
VERSION=1.10.0
DL_PATH=windows/extra/hdf5-1.10.0-win64-VS2015-shared.zip
echo "MSI_PATH=hdf5\\HDF5-1.10.0-win64.msi" >> $GITHUB_ENV
elif [[ "${{matrix.version}}" == "1.12" ]]; then
VERSION=1.12.0
DL_PATH=hdf5-1.12.0-Std-win10_64-vs16.zip
echo "MSI_PATH=hdf\\HDF5-1.12.0-win64.msi" >> $GITHUB_ENV
else
VERSION=1.14.0
DL_PATH=windows/hdf5-1.14.0-Std-win10_64-vs16.zip
echo "MSI_PATH=hdf\\HDF5-1.14.0-win64.msi" >> $GITHUB_ENV
fi
BASE_URL=https://support.hdfgroup.org/ftp/HDF5/releases
echo "DL_URL=$BASE_URL/hdf5-${{matrix.version}}/hdf5-$VERSION/bin/$DL_PATH" >> $GITHUB_ENV
echo "C:\\Program Files\\HDF_Group\\HDF5\\$VERSION\\bin" >> $GITHUB_PATH
- name: Install HDF5 (${{matrix.version}})
shell: pwsh
run: |
C:\msys64\usr\bin\wget.exe -q -O hdf5.zip ${{env.DL_URL}}
7z x hdf5.zip -y
msiexec /i ${{env.MSI_PATH}} /quiet /qn /norestart
- name: Build and test all crates
run: cargo test -vv
# mingw:
# name: mingw
# runs-on: windows-latest
# strategy:
# fail-fast: false
# matrix:
# rust: [stable]
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# with: {submodules: true}
# - name: Install Rust (${{matrix.rust}})
# uses: dtolnay/rust-toolchain@stable
# with: {toolchain: '${{matrix.rust}}', targets: x86_64-pc-windows-gnu}
# - name: Install HDF5
# shell: pwsh
# run: |
# $env:PATH="$env:PATH;C:\msys64\mingw64\bin;C:\msys64\usr\bin;"
# C:\msys64\usr\bin\pacman.exe -Syu --noconfirm
# C:\msys64\usr\bin\pacman.exe -S --noconfirm mingw-w64-x86_64-hdf5 mingw-w64-x86_64-pkgconf
# - name: Build and test all crates
# shell: pwsh
# run: |
# $env:PATH="$env:PATH;C:\msys64\mingw64\bin;"
# cargo test -vv --target=x86_64-pc-windows-gnu
msrv:
name: Minimal Supported Rust Version
runs-on: ubuntu-20.04
strategy:
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
with: {submodules: true}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with: {toolchain: "1.80"}
- name: Build and test all crates
run:
cargo test --workspace -vv --features=hdf5-sys/static,hdf5-sys/zlib --exclude=hdf5-metno-derive
# wine:
# name: wine
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# with: {submodules: true}
# - name: Install Rust
# uses: dtolnay/rust-toolchain@stable
# with: {toolchain: stable, targets: x86_64-pc-windows-gnu}
# - name: Install dependencies
# run: sudo apt-get update && sudo apt install wine64 mingw-w64
# - name: Build and test
# env:
# CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUNNER: wine64
# run: cargo test --workspace --features hdf5-sys/static --target x86_64-pc-windows-gnu --exclude=hdf5-metno-derive
addr_san:
name: Address sanitizer
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with: {submodules: true}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with: {toolchain: nightly, profile: minimal, override: true}
- name: Run test with sanitizer
env:
RUSTFLAGS: "-Z sanitizer=address"
run: cargo test --features hdf5-sys/static --target x86_64-unknown-linux-gnu --workspace --exclude hdf5-metno-derive