forked from immunant/c2rust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
159 lines (145 loc) · 5.5 KB
/
azure-pipelines.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
trigger:
branches:
include:
- master
- feature/ci-dev
paths:
exclude:
- README.md
- LICENSE
- .travis.yml
- book.toml
- docker/*
- manual/*
- docs/*
jobs:
- job: Linux
timeoutInMinutes: 120
pool:
vmImage: 'ubuntu-latest'
strategy:
matrix:
arch:
containerImage: immunant/c2rust:archlinux-base-latest
debian10:
containerImage: immunant/c2rust:debian-buster-latest
debian11:
containerImage: immunant/c2rust:debian-bullseye-latest
fedora34:
containerImage: immunant/c2rust:fedora-34-latest
ubuntu20:
containerImage: immunant/c2rust:ubuntu-focal-latest
ubuntu18:
containerImage: immunant/c2rust:ubuntu-bionic-latest
container: $[ variables['containerImage'] ]
steps:
# rust was installed for the `docker` user, not the user azure creates
# but cargo and rustup can be controlled via $CARGO_HOME and $RUSTUP_HOME.
# NOTE: $HOME is not set correctly for the azure user; don't rely on it.
- script: |
export PATH="/home/docker/.cargo/bin:$PATH"
export RUSTUP_HOME=/home/docker/.rustup
export CARGO_HOME=$AGENT_TEMPDIRECTORY/.cargo
export RUSTFLAGS="-D warnings"
export RUSTDOCFLAGS="-D warnings"
cargo fmt --check
displayName: 'cargo fmt --check'
- script: |
export PATH="/home/docker/.cargo/bin:$PATH"
export RUSTUP_HOME=/home/docker/.rustup
export CARGO_HOME=$AGENT_TEMPDIRECTORY/.cargo
export RUSTFLAGS="-D warnings"
export RUSTDOCFLAGS="-D warnings"
# Differs from `cargo build` since we can use `--all-features` here.
# We plan to eventually replace `cargo check` with `cargo clippy`.
cargo check --tests --all-features
displayName: 'cargo check'
- script: |
export PATH="/home/docker/.cargo/bin:$PATH"
export RUSTUP_HOME=/home/docker/.rustup
export CARGO_HOME=$AGENT_TEMPDIRECTORY/.cargo
export RUSTFLAGS="-D warnings"
export RUSTDOCFLAGS="-D warnings"
cargo doc --all-features --document-private-items --no-deps
displayName: 'cargo doc'
- script: |
export PATH="/home/docker/.cargo/bin:$PATH"
export RUSTUP_HOME=/home/docker/.rustup
export CARGO_HOME=$AGENT_TEMPDIRECTORY/.cargo
export RUSTFLAGS="-D warnings"
export RUSTDOCFLAGS="-D warnings"
# Don't build with `--all-features` as `--all-features` includes `--features llvm-static`,
# which we don't want to test here (it doesn't work out of the box on Arch and Fedora;
# see https://github.com/immunant/c2rust/issues/500).
cargo build --release
displayName: 'cargo build against host clang/LLVM (fast build)'
- script: |
export PATH="/home/docker/.cargo/bin:$PATH"
export RUSTUP_HOME=/home/docker/.rustup
export CARGO_HOME=$AGENT_TEMPDIRECTORY/.cargo
export RUSTFLAGS="-D warnings"
export RUSTDOCFLAGS="-D warnings"
cargo test --release --workspace
displayName: 'cargo test'
- script: |
export PATH="/home/docker/.cargo/bin:$PATH"
export RUSTUP_HOME=/home/docker/.rustup
export CARGO_HOME=$AGENT_TEMPDIRECTORY/.cargo
# `test_translator.py` compiles translated code,
# which has tons of warnings.
# `RUSTFLAGS="-D warnings"` would be inherited by that,
# causing tons of errors, so don't set that.
# `test_translator.py` does not rebuild,
# so changing `RUSTFLAGS` will not trigger a full rebuild.
./scripts/test_translator.py tests/
displayName: 'Test translator (fast build)'
- job: Darwin
timeoutInMinutes: 180
pool:
vmImage: 'macOS-latest'
steps:
- script: |
./scripts/provision_mac.sh
# speeds up provisioning
export HOMEBREW_NO_AUTO_UPDATE=1
# helps the `curl-sys` create determine how to link in libcurl.
brew install pkg-config
# we want to use the host curl because it has the `HTTP2` feature
# whereas the brew version does not, this causes curl-sys to
# build its own curl which then fails to link on Azure Devops.
brew remove curl
# prepare environment for the following steps
source $HOME/.cargo/env
brew info llvm
displayName: 'Provision macOS'
- script: |
export LLVM_CONFIG_PATH=$(brew --prefix llvm)/bin/llvm-config
export RUSTFLAGS="-D warnings"
export RUSTDOCFLAGS="-D warnings"
# Differs from `cargo build` since we can use `--all-features` here.
# We plan to eventually replace `cargo check` with `cargo clippy`.
cargo check --tests --all-features
displayName: 'cargo check'
- script: |
export LLVM_CONFIG_PATH=$(brew --prefix llvm)/bin/llvm-config
export RUSTFLAGS="-D warnings"
export RUSTDOCFLAGS="-D warnings"
cargo doc --all-features --document-private-items --no-deps
displayName: 'cargo doc'
- script: |
export LLVM_CONFIG_PATH=$(brew --prefix llvm)/bin/llvm-config
export RUSTFLAGS="-D warnings"
export RUSTDOCFLAGS="-D warnings"
# Don't build with `--all-features` (see analogous step for Linux).
cargo build --release
displayName: 'cargo build against host clang/LLVM (fast build)'
- script: |
export LLVM_CONFIG_PATH=$(brew --prefix llvm)/bin/llvm-config
export RUSTFLAGS="-D warnings"
export RUSTDOCFLAGS="-D warnings"
cargo test --release --workspace
displayName: 'cargo test'
- script: |
# `RUSTFLAGS` not set (see analogous step for Linux).
./scripts/test_translator.py tests/
displayName: 'Test translator (fast build)'