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
|
jobs:
- job: ${{ parameters.name }}
pool:
vmImage: ${{ parameters.vmImage }}
strategy:
matrix:
stable:
rustup_toolchain: stable-${{ parameters.target }}
features: ""
${{ if eq(variables['Build.SourceBranch'], 'refs/heads/master') }}:
beta:
rustup_toolchain: beta-${{ parameters.target }}
features: ""
nightly:
rustup_toolchain: nightly-${{ parameters.target }}
features: ""
${{ if startsWith(parameters.name, 'Windows') }}:
stable-winrt:
rustup_toolchain: stable-${{ parameters.target }}
features: "winrt"
${{ if eq(variables['Build.SourceBranch'], 'refs/heads/master') }}:
beta-winrt:
rustup_toolchain: beta-${{ parameters.target }}
features: "winrt"
nightly-winrt:
rustup_toolchain: nightly-${{ parameters.target }}
features: "winrt"
${{ if and(not(startsWith(parameters.name, 'Windows')), not(endsWith(parameters.name, 'WASM'))) }}:
stable-jack:
rustup_toolchain: stable-${{ parameters.target }}
features: "jack"
${{ if eq(variables['Build.SourceBranch'], 'refs/heads/master') }}:
beta-jack:
rustup_toolchain: beta-${{ parameters.target }}
features: "jack"
nightly-jack:
rustup_toolchain: nightly-${{ parameters.target }}
features: "jack"
steps:
- ${{ if not(startsWith(parameters.name, 'Windows')) }}:
# Linux and macOS
- script: |
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN
export PATH="$HOME/.cargo/bin:$PATH"
echo "##vso[task.setvariable variable=PATH;]$PATH"
displayName: Install Rust
- ${{ if and(startsWith(parameters.name, 'Linux'), not(endsWith(parameters.name, 'WASM'))) }}:
# Linux only
- script: |
sudo apt-get update && sudo apt-get install -y libasound2-dev libjack-jackd2-dev
displayName: Install ALSA and Jack dependencies
- ${{ if startsWith(parameters.name, 'macOS') }}:
# macOS only
- script: |
if [ "$FEATURES" = "jack" ]; then
curl -LOS https://github.com/jackaudio/jackaudio.github.com/releases/download/1.9.11/JackOSX.0.92_b3.zip && unzip JackOSX.0.92_b3.zip && sudo installer -pkg JackOSX.0.92_b3.pkg -target /
fi
displayName: Install Jack dependencies
- ${{ if endsWith(parameters.name, 'WASM') }}:
# WASM only
- script: |
rustup target add wasm32-unknown-unknown
displayName: Add wasm32-unknown-unknown target
- ${{ if startsWith(parameters.name, 'Windows') }}:
# Windows
- script: |
curl -sSf -o rustup-init.exe https://win.rustup.rs
rustup-init.exe -y --default-toolchain %RUSTUP_TOOLCHAIN%
set PATH=%PATH%;%USERPROFILE%\.cargo\bin
echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin"
displayName: Install Rust (Windows)
# All platforms
- script: |
rustc -Vv
cargo -V
displayName: Query installed versions
- ${{ if not(endsWith(parameters.name, 'WASM')) }}:
# Use bash for cross-platform env variable syntax
- bash: cargo build --verbose --features "$FEATURES"
displayName: Build
- bash: cargo build --features "$FEATURES" --example test_list_ports
displayName: Build example program
- ${{ if not(startsWith(parameters.name, 'Linux')) }}:
# Tests cannot run on Linux (missing ALSA driver) or with Jack (Jack not running)
- bash: |
if [[ "$FEATURES" != *"jack"* ]]; then
cargo test --verbose --features "$FEATURES"
fi
displayName: Run unit tests
- bash: |
if [[ "$FEATURES" != *"jack"* ]]; then
cargo run --features "$FEATURES" --example test_list_ports
fi
displayName: Run example program
- ${{ if endsWith(parameters.name, 'WASM') }}:
# WebAssembly
- script: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f
displayName: Install wasm-pack
#- bash: cargo build --verbose --target wasm32-unknown-unknown --features "$FEATURES"
# displayName: Build
- bash: |
cd examples/browser
wasm-pack build --target=no-modules --dev
displayName: Build WASM example program
- bash: wasm-pack test --chrome
displayName: Run WASM tests
|