forked from openssh-rust/openssh
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathazure-pipelines.yml
More file actions
152 lines (151 loc) · 4.85 KB
/
azure-pipelines.yml
File metadata and controls
152 lines (151 loc) · 4.85 KB
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
jobs:
- job: style
displayName: Style linting
strategy:
matrix:
stable:
rust: stable
beta:
rust: beta
pool:
vmImage: ubuntu-latest
continueOnError: $[eq(variables.rust, 'beta')]
steps:
- template: install-rust.yml@templates
parameters:
rust: $(rust)
components:
- rustfmt
- clippy
- script: cargo fmt -- --check
displayName: cargo fmt --check
- script: cargo clippy -- -D warnings -A unknown-lints
displayName: cargo clippy -- -D warnings
- job: main
# here, we do not run the tests that require an SSH server, since that
# requires docker, which is only available with Linux.
displayName: Compile and test
dependsOn: []
strategy:
matrix:
Linux:
vmImage: ubuntu-latest
rust: stable
"Linux (beta)":
vmImage: ubuntu-latest
rust: beta
"Linux (nightly)":
vmImage: ubuntu-latest
rust: nightly
MacOS:
vmImage: macOS-10.15
rust: stable
# Windows:
# vmImage: windows-2019
# rust: stable
pool:
vmImage: $(vmImage)
continueOnError: $[eq(variables.rust, 'nightly')]
steps:
- template: install-rust.yml@templates
parameters:
rust: $(rust)
- script: cargo check
displayName: cargo check
- script: cargo check --no-default-features
displayName: cargo check --no-default-features
- script: cargo check --all-features
displayName: cargo check --all-features
- script: cargo test --all-features
displayName: cargo test
- script: cargo doc --no-deps
displayName: cargo doc
# This represents the minimum Rust version supported.
# Tests are not run as tests may require newer versions of rust.
- job: msrv
displayName: "Minimum supported Rust version: 1.40.0"
dependsOn: []
pool:
vmImage: ubuntu-latest
steps:
- template: install-rust.yml@templates
parameters:
rust: 1.40.0 # bytes requires 1.39, mem::take requires 1.40
- script: cargo check
displayName: cargo check
- script: cargo check --no-default-features
displayName: cargo check --no-default-features
- script: cargo check --all-features
displayName: cargo check --all-features
- job: integration
# now run the tests that require access to an SSH server.
displayName: Run integration tests
dependsOn: main
pool:
vmImage: ubuntu-latest
services:
opensshtest: openssh
steps:
- bash: |
chmod 600 .test-key
ssh -i .test-key -v -p 2222 -l test-user 127.0.0.1 -o StrictHostKeyChecking=accept-new whoami
displayName: Test ssh connectivity
continueOnError: true
- bash: |
eval $(ssh-agent)
echo '##vso[task.setvariable variable=SSH_AUTH_SOCK]'$SSH_AUTH_SOCK
echo '##vso[task.setvariable variable=SSH_AGENT_PID]'$SSH_AGENT_PID
cat .test-key | ssh-add -
displayName: Set up ssh-agent
- template: install-rust.yml@templates
- script: cargo test --test openssh
displayName: cargo test --cfg=ci
env:
# makes all the ignored tests not ignored
RUSTFLAGS: --cfg=ci
- bash: docker logs $(docker ps | grep openssh-server | awk '{print $1}')
displayName: ssh container log
condition: failed()
- bash: docker exec $(docker ps | grep openssh-server | awk '{print $1}') cat /config/logs/openssh/openssh.log
displayName: ssh server log
condition: failed()
- template: coverage.yml@templates
parameters:
token: $(CODECOV_TOKEN_SECRET)
args: "--forward"
services:
opensshtest: openssh
setup:
- bash: |
chmod 600 .test-key
ssh -i .test-key -v -p 2222 -l test-user opensshtest -o StrictHostKeyChecking=accept-new whoami
displayName: Test ssh connectivity
continueOnError: true
- bash: |
eval $(ssh-agent)
echo '##vso[task.setvariable variable=SSH_AUTH_SOCK]'$SSH_AUTH_SOCK
echo '##vso[task.setvariable variable=SSH_AGENT_PID]'$SSH_AGENT_PID
cat .test-key | ssh-add -
displayName: Set up ssh-agent
env:
# makes all the ignored tests not ignored
RUSTFLAGS: --cfg=ci
# we cannot use 127.0.0.1 (the default here)
# since we are running from a different container
TEST_HOST: ssh://test-user@opensshtest:2222
resources:
repositories:
- repository: templates
type: github
name: crate-ci/azure-pipelines
ref: refs/heads/v0.4
endpoint: jonhoo
containers:
- container: openssh
image: linuxserver/openssh-server:amd64-latest
ports:
- 2222:2222
env:
USER_NAME: test-user
PUBLIC_KEY: |-
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGzHvK2pKtSlZXP9tPYOOBb/xn0IiC9iLMS355AYUPC7