-
-
Notifications
You must be signed in to change notification settings - Fork 105
78 lines (78 loc) · 2.3 KB
/
test.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
name: Run cargo tests
on:
workflow_dispatch:
push:
branches:
- 'main'
paths:
- '.github/workflows/test.yml'
- 'src/**/*.rs'
- 'build.rs'
- 'Cargo.toml'
- '.cargo/**/*'
- 'tests/**/*'
pull_request:
paths:
- '.github/workflows/test.yml'
- 'src/**/*.rs'
- 'build.rs'
- 'Cargo.toml'
- '.cargo/**/*'
- 'tests/**/*'
env:
RUST_BACKTRACE: 1
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_DEBUG: 0
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install stable Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Run tests
# do not run doctests until rust-lang/cargo#10469 is merged
run: |
cargo test --verbose --lib --features fetch-models
cross-compile:
name: Cross-platform compile
runs-on: ${{ matrix.platform.os }}
needs: [test]
strategy:
matrix:
platform:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
command: test
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
command: test
- target: x86_64-apple-darwin
os: macos-latest
command: test
steps:
- uses: actions/checkout@v4
- name: Fix ring dependency for Windows ARM64
if: matrix.platform.target == 'aarch64-pc-windows-msvc'
shell: pwsh
run: |
@('', '[patch.crates-io]',
'ring = { git = "https://github.com/awakecoding/ring", branch = "0.16.20_alpha" }') | % {
Add-Content -Path "Cargo.toml" -Value $_
}
$VSINSTALLDIR = $(vswhere.exe -latest -requires Microsoft.VisualStudio.Component.VC.Llvm.Clang -property installationPath)
$VCINSTALLDIR = Join-Path $VSINSTALLDIR "VC"
$LLVM_ROOT = Join-Path $VCINSTALLDIR "Tools\Llvm\x64"
echo "PATH=$Env:PATH;${LLVM_ROOT}\bin" >> $Env:GITHUB_ENV
- name: Build/test
uses: houseabsolute/actions-rust-cross@v0
with:
command: ${{ matrix.platform.command }}
target: ${{ matrix.platform.target }}
args: "--features fetch-models"
env:
LC_ALL: C