Install a fixed version of rust for CI integration tests (#39)

This commit is contained in:
Matan Kushner 2019-05-01 11:12:02 -04:00 committed by GitHub
parent 0b9334f438
commit d945b03093
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 18 deletions

20
.build/install-rust.yml Normal file
View File

@ -0,0 +1,20 @@
parameters:
versionSpec: ""
steps:
# Install Rust at a fixed version for integration tests to pass
- script: |
curl -sSf -o rustup-init.exe https://win.rustup.rs
rustup-init.exe -y --default-toolchain ${{ parameters.versionSpec }}
echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin"
displayName: Windows install Rust
condition: eq( variables['Agent.OS'], 'Windows_NT' )
- script: |
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain ${{ parameters.versionSpec }}
echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin"
displayName: Install a fixed version of Rust
condition: ne( variables['Agent.OS'], 'Windows_NT' )
# Install the version of Rust used for testing with
- script: rustup install $RUSTUP_TOOLCHAIN
displayName: Install Rust used for CI

View File

@ -1,4 +1,5 @@
jobs: jobs:
# Run the Rust linter
- job: "Clippy" - job: "Clippy"
pool: pool:
vmImage: "ubuntu-16.04" vmImage: "ubuntu-16.04"
@ -9,6 +10,7 @@ jobs:
- script: cargo clippy --all - script: cargo clippy --all
displayName: Run clippy displayName: Run clippy
# Run the Rust formatter
- job: "Rustfmt" - job: "Rustfmt"
pool: pool:
vmImage: "ubuntu-16.04" vmImage: "ubuntu-16.04"
@ -20,6 +22,15 @@ jobs:
- script: cargo fmt --all -- --check - script: cargo fmt --all -- --check
displayName: Run Rustfmt displayName: Run Rustfmt
# Run the integration tests in a Docker container
- job: "Docker"
pool:
vmImage: "ubuntu-16.04"
steps:
- script: ./integration_test
displayName: Dockerized tests
# Run the integration tests on virtual machines
- job: "Test" - job: "Test"
strategy: strategy:
matrix: matrix:
@ -41,21 +52,17 @@ jobs:
pool: pool:
vmImage: "ubuntu-16.04" vmImage: "ubuntu-16.04"
steps: steps:
- task: NodeTool@0 # Install Node.js
- task: NodeTool@0
inputs: inputs:
versionSpec: '12.0.0' versionSpec: "12.0.0"
- script: | # Install Rust at a fixed version for integration tests
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN - template: ".build/install-rust.yml"
echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin" parameters:
displayName: Install rust versionSpec: "1.34.0"
condition: ne( variables['Agent.OS'], 'Windows_NT' )
- script: | # Because integration tests rely on a fixed Rust version, we must use rustup to run with the intended toolkit
curl -sSf -o rustup-init.exe https://win.rustup.rs - script: rustup run $RUSTUP_TOOLCHAIN cargo build --all
rustup-init.exe -y --default-toolchain %RUSTUP_TOOLCHAIN%
echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin"
displayName: Windows install rust
condition: eq( variables['Agent.OS'], 'Windows_NT' )
- script: cargo build --all
displayName: Cargo build displayName: Cargo build
- script: cargo test -- --ignored - script: rustup run $RUSTUP_TOOLCHAIN cargo test -- --ignored
displayName: Cargo test displayName: Cargo test

View File

@ -1,4 +1,4 @@
FROM rust:latest FROM rust:1.34.0
# Install Node.js # Install Node.js
ENV NODE_VERSION 12.0.0 ENV NODE_VERSION 12.0.0
@ -24,7 +24,8 @@ RUN mkdir benches
RUN touch benches/my_benchmark.rs RUN touch benches/my_benchmark.rs
# This is a dummy build to get dependencies cached # This is a dummy build to get dependencies cached
RUN cargo build --release RUN rustup install stable
RUN rustup run stable cargo build --release
# Delete the dummy build # Delete the dummy build
RUN rm -rf /starship RUN rm -rf /starship
@ -33,4 +34,5 @@ RUN rm -rf /starship
RUN mkdir starship RUN mkdir starship
WORKDIR /starship WORKDIR /starship
CMD [ "cargo", "test", "--", "--ignored"] # Run with rustup to use stable instead of the Rust default
CMD [ "rustup", "run", "stable", "cargo", "test", "--", "--ignored"]