|
| 1 | +name: $(Build.SourceBranch)-$(date:yyyy-MM-dd)$(rev:.r) |
| 2 | +trigger: |
| 3 | + branches: |
| 4 | + include: |
| 5 | + - 'master' |
| 6 | + tags: |
| 7 | + include: |
| 8 | + - '*' |
| 9 | + exclude: |
| 10 | + - 'dev' |
| 11 | + |
| 12 | +jobs: |
| 13 | +- job: rustfmt |
| 14 | + pool: |
| 15 | + vmImage: 'macos-10.14' |
| 16 | + steps: |
| 17 | + - checkout: self |
| 18 | + submodules: true |
| 19 | + - template: ci/azure-install-rust.yml |
| 20 | + - script: rustup component add rustfmt |
| 21 | + displayName: Add rustfmt |
| 22 | + - script: cargo fmt --all -- --check |
| 23 | + displayName: Check formatting |
| 24 | + variables: |
| 25 | + toolchain: stable |
| 26 | + |
| 27 | +# Smoke test to build docs on one builder, using OSX for now since it's the |
| 28 | +# fastest |
| 29 | +- job: docs |
| 30 | + pool: |
| 31 | + vmImage: 'macos-10.14' |
| 32 | + steps: |
| 33 | + - checkout: self |
| 34 | + submodules: true |
| 35 | + - template: ci/azure-install-rust.yml |
| 36 | + - script: cargo doc |
| 37 | + displayName: Build documentation |
| 38 | + - script: cargo install cargo-deadlinks |
| 39 | + displayName: Install cargo-deadlinks |
| 40 | + - bash: | |
| 41 | + find ./target/doc -maxdepth 1 -type d -name "cranelift*" | xargs -I{} cargo deadlinks --dir {} |
| 42 | + displayName: Run cargo-deadlinks |
| 43 | + variables: |
| 44 | + toolchain: nightly |
| 45 | + |
| 46 | +- job: Test |
| 47 | + strategy: |
| 48 | + matrix: |
| 49 | + windows-earliest: |
| 50 | + imageName: 'vs2017-win2016' |
| 51 | + toolchain: '1.37.0' |
| 52 | + linux-earliest: |
| 53 | + imageName: 'ubuntu-16.04' |
| 54 | + toolchain: '1.37.0' |
| 55 | + mac-earliest: |
| 56 | + imageName: 'macos-10.14' |
| 57 | + toolchain: '1.37.0' |
| 58 | + mac-stable: |
| 59 | + imageName: 'macos-10.14' |
| 60 | + toolchain: stable |
| 61 | + mac-beta: |
| 62 | + imageName: 'macos-10.14' |
| 63 | + toolchain: beta |
| 64 | + mac-nightly: |
| 65 | + imageName: 'macos-10.14' |
| 66 | + toolchain: nightly |
| 67 | + |
| 68 | + pool: |
| 69 | + vmImage: $(imageName) |
| 70 | + |
| 71 | + steps: |
| 72 | + - checkout: self |
| 73 | + submodules: true |
| 74 | + - template: ci/azure-install-rust.yml |
| 75 | + |
| 76 | + - script: cargo fetch |
| 77 | + displayName: Fetch cargo dependencies |
| 78 | + |
| 79 | + - script: cargo build |
| 80 | + displayName: Cargo build |
| 81 | + |
| 82 | + - bash: cargo test --all |
| 83 | + displayName: Cargo test |
| 84 | + env: |
| 85 | + RUST_BACKTRACE: 1 |
| 86 | + |
| 87 | + # Ensure fuzzer works by running it with a single input |
| 88 | + - bash: cargo install cargo-fuzz |
| 89 | + displayName: Install cargo-fuzz |
| 90 | + condition: and(succeeded(), eq(variables['toolchain'], 'nightly')) |
| 91 | + - bash: | |
| 92 | + fuzz_module="ffaefab69523eb11935a9b420d58826c8ea65c4c" |
| 93 | + cargo fuzz run fuzz_translate_module \ |
| 94 | + "fuzz/corpus/fuzz_translate_module/$fuzz_module" |
| 95 | + displayName: Run cargo-fuzz |
| 96 | + env: |
| 97 | + RUST_BACKTRACE: 1 |
| 98 | + condition: and(succeeded(), eq(variables['toolchain'], 'nightly')) |
| 99 | +
|
| 100 | +- job: Build |
| 101 | + strategy: |
| 102 | + matrix: |
| 103 | + windows: |
| 104 | + imageName: 'vs2017-win2016' |
| 105 | + # Statically link against msvcrt to produce slightly more portable |
| 106 | + # binaries on Windows by reducing our binary compatibility requirements. |
| 107 | + RUSTFLAGS: -Ctarget-feature=+crt-static |
| 108 | + mac: |
| 109 | + imageName: 'macos-10.14' |
| 110 | + # Lower the deployment target from our build image in an attempt to |
| 111 | + # build more portable binaries that run on older releases. Note that |
| 112 | + # 10.9 here is arbitrarily chosen and just happens to be the lowest that |
| 113 | + # works at this time. Raising this is probably fine. |
| 114 | + MACOSX_DEPLOYMENT_TARGET: 10.9 |
| 115 | + variables: |
| 116 | + toolchain: '1.37.0' |
| 117 | + pool: |
| 118 | + vmImage: $(imageName) |
| 119 | + # We try to be compatible with beta and nightly, but they occasionally |
| 120 | + # fail, so we don't allow them to hold up people using stable. |
| 121 | + continueOnError: $[ne(variables['toolchain'], 'stable')] |
| 122 | + steps: |
| 123 | + - template: ci/azure-build-release.yml |
| 124 | + |
| 125 | +# Build the Linux release binary in an older Linux container (in this case |
| 126 | +# Centos 6) |
| 127 | +- job: Build_linux |
| 128 | + variables: |
| 129 | + toolchain: '1.37.0' |
| 130 | + container: |
| 131 | + image: centos:6 |
| 132 | + options: "--name ci-container -v /usr/bin/docker:/tmp/docker:ro" |
| 133 | + steps: |
| 134 | + # We're executing in the container as non-root but `yum` requires root. We |
| 135 | + # need to install `sudo` but to do that we need `sudo`. Do a bit of a weird |
| 136 | + # hack where we use the host `docker` executable to re-execute in our own |
| 137 | + # container with the root user to install `sudo` |
| 138 | + - bash: /tmp/docker exec -t -u 0 ci-container sh -c "yum install -y sudo" |
| 139 | + displayName: Configure sudo |
| 140 | + |
| 141 | + # See https://edwards.sdsu.edu/research/c11-on-centos-6/ for where these |
| 142 | + # various commands came from. |
| 143 | + - bash: | |
| 144 | + set -e |
| 145 | + sudo yum install -y centos-release-scl cmake xz |
| 146 | + sudo yum install -y devtoolset-8-gcc devtoolset-8-binutils devtoolset-8-gcc-c++ |
| 147 | + echo "##vso[task.prependpath]/opt/rh/devtoolset-8/root/usr/bin" |
| 148 | + displayName: Install system dependencies |
| 149 | +
|
| 150 | + # Delete `libstdc++.so` to force gcc to link against `libstdc++.a` instead. |
| 151 | + # This is a hack and not the right way to do this, but it ends up doing the |
| 152 | + # right thing for now. |
| 153 | + - bash: sudo rm -f /opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8/libstdc++.so |
| 154 | + displayName: Force a static libstdc++ |
| 155 | + |
| 156 | + - template: ci/azure-build-release.yml |
0 commit comments