forked from Boddlnagg/midir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines-template.yml
124 lines (124 loc) · 5.6 KB
/
azure-pipelines-template.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
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')), not(endsWith(parameters.name, 'ARM'))) }}:
# Linux on x86_64 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 endsWith(parameters.name, 'ARM') }}:
# Linux on ARM only
- script: |
grep "^deb http://azure.archive" /etc/apt/sources.list | sed 's/deb\ http:\/\/azure.archive.ubuntu.com\/ubuntu/deb\ [arch=arm64]\ http:\/\/ports.ubuntu.com\/ubuntu-ports/' > $HOME/arm-sources.list
sudo sed -i 's/deb\ /deb\ \[arch=amd64\]\ /' /etc/apt/sources.list
sudo sh -c "cat $HOME/arm-sources.list >> /etc/apt/sources.list"
rm $HOME/arm-sources.list
sudo dpkg --add-architecture arm64
sudo apt-get update
sudo apt-get install -y libc6-arm64-cross libc6-dev-arm64-cross gcc-aarch64-linux-gnu
displayName: Set up ARM cross-compilation environment
- script: |
rustup target add aarch64-unknown-linux-gnu
echo -e "[build]\ntarget = \"aarch64-unknown-linux-gnu\"\n[target.aarch64-unknown-linux-gnu]\nlinker = \"aarch64-linux-gnu-gcc\"\n[env]\nPKG_CONFIG_PATH=\"/usr/lib/aarch64-linux-gnu/pkgconfig\"\nPKG_CONFIG_ALLOW_CROSS=\"true\"">$HOME/.cargo/config
displayName: Add aarch64-unknown-linux-gnu target
- script: |
sudo apt-get install -y libasound2-dev:arm64 libjack-jackd2-dev:arm64
displayName: Install ALSA and Jack dependencies
- ${{ 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