Skip to content

Commit e6c6aec

Browse files
author
Ivan Dubrov
authored
🛠Copying CI scripts from datatest (#18)
1 parent 8c80912 commit e6c6aec

6 files changed

+108
-48
lines changed

azure-pipelines.yaml

+10-47
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,14 @@ trigger:
44
tags:
55
include: ['*']
66

7-
resources:
8-
repositories:
9-
- repository: templates
10-
type: github
11-
name: xoac/rust-azure-pipelines
12-
ref: refs/tags/v0.0.3
13-
endpoint: PipelinesTemplates
14-
157
jobs:
16-
# Check formatting
17-
- template: ci/rustfmt.yml@templates
18-
parameters:
19-
name: rustfmt
20-
displayName: Check formatting
21-
22-
# Cargo check
23-
- template: ci/cargo-check.yml@templates
24-
parameters:
25-
name: cargo_check
26-
displayName: Cargo check
27-
28-
# This represents the minimum Rust version supported.
29-
# Tests are not run as tests may require newer versions of rust.
30-
- template: ci/cargo-check.yml@templates
31-
parameters:
32-
name: minrust
33-
rust_version: 1.31.0 # The 2018 edition
34-
displayName: Check rust min ver
35-
36-
################
37-
# Test stage #
38-
###############
39-
40-
# Test stable
41-
- template: ci/test.yml@templates
42-
parameters:
43-
dependsOn:
44-
- cargo_check
45-
name: cargo_test_stable
46-
displayName: Cargo test
47-
cross: true # Test on Windows and macOS
48-
49-
# Test nightly
50-
- template: ci/test.yml@templates
51-
parameters:
52-
name: cargo_test_nightly
53-
displayName: Cargo test
54-
rust_version: nightly
8+
- template: ci/job-rustfmt.yml
9+
- template: ci/job-check.yml
10+
- template: ci/job-test.yml
11+
parameters:
12+
name: test_stable
13+
toolchain: stable
14+
- template: ci/job-test.yml
15+
parameters:
16+
name: test_nightly
17+
toolchain: nightly

ci/job-check.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
parameters:
2+
toolchain: stable
3+
jobs:
4+
- job: check
5+
pool:
6+
vmImage: ubuntu-16.04
7+
steps:
8+
- template: steps-install-rust.yml
9+
parameters:
10+
toolchain: ${{ parameters.toolchain }}
11+
components:
12+
- clippy
13+
- script: |
14+
cargo check --all --all-targets
15+
displayName: cargo check
16+
- script: |
17+
cargo clippy --all
18+
displayName: cargo clippy --all
19+

ci/job-rustfmt.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
parameters:
2+
toolchain: stable
3+
jobs:
4+
- job: rustfmt
5+
pool:
6+
vmImage: ubuntu-16.04
7+
steps:
8+
- template: steps-install-rust.yml
9+
parameters:
10+
toolchain: ${{ parameters.toolchain }}
11+
components:
12+
- rustfmt
13+
- script: |
14+
cargo fmt -- --check
15+
displayName: cargo fmt -- --check
16+

ci/job-test.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
parameters:
2+
toolchain: stable
3+
name: test
4+
steps: []
5+
jobs:
6+
- job: ${{ parameters.name }}
7+
displayName: test (${{parameters.toolchain}})
8+
strategy:
9+
matrix:
10+
Linux:
11+
vmImage: ubuntu-16.04
12+
MacOS:
13+
vmImage: macOS-10.13
14+
Windows:
15+
vmImage: vs2017-win2016
16+
pool:
17+
vmImage: $(vmImage)
18+
19+
steps:
20+
- template: steps-install-rust.yml
21+
parameters:
22+
toolchain: ${{ parameters.toolchain }}
23+
- script: |
24+
cargo test --all --all-targets
25+
displayName: cargo test --all --all-targets
26+
- ${{ each step in parameters.steps }}:
27+
- ${{ each pair in step }}:
28+
${{ pair.key }}: ${{ pair.value }}

ci/steps-install-rust.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
parameters:
2+
toolchain: stable
3+
steps:
4+
# Linux and macOS
5+
- script: |
6+
set -e
7+
curl https://sh.rustup.rs -sSf | sh -s -- -y
8+
echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin"
9+
env:
10+
RUSTUP_TOOLCHAIN: ${{parameters.toolchain}}
11+
displayName: "Install rust (*nix)"
12+
condition: not(eq(variables['Agent.OS'], 'Windows_NT'))
13+
# Windows
14+
- script: |
15+
curl -sSf -o rustup-init.exe https://win.rustup.rs
16+
rustup-init.exe -y
17+
set PATH=%PATH%;%USERPROFILE%\.cargo\bin
18+
echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin"
19+
env:
20+
RUSTUP_TOOLCHAIN: ${{parameters.toolchain}}
21+
displayName: "Install rust (Windows)"
22+
condition: eq(variables['Agent.OS'], 'Windows_NT')
23+
- ${{ each component in parameters.components }}:
24+
- script: rustup component add ${{ component }}
25+
displayName: rustup component add ${{ component }}
26+
- script: |
27+
rustup toolchain install ${{parameters.toolchain}}
28+
rustup default ${{parameters.toolchain}}
29+
displayName: rustup default ${{parameters.toolchain}}
30+
- script: |
31+
rustup -V
32+
rustup component list --installed
33+
rustc -Vv
34+
cargo -V
35+
displayName: rust versions

rust-toolchain

-1
This file was deleted.

0 commit comments

Comments
 (0)