-
Notifications
You must be signed in to change notification settings - Fork 28
103 lines (94 loc) · 3.93 KB
/
build.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
name: Build
on:
push:
branches: [ "*" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
cargo_fmt:
name: Check cargo formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run cargo fmt
run: cargo fmt --all -- --check
cargo_clippy:
name: Check cargo clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Clippy
run: rustup component add clippy
- name: Clippy (no features enabled)
run: cargo clippy -- -D warnings
- name: Clippy (all features enabled)
run: cargo clippy --all-features -- -D warnings
build-linux:
name: Build check on linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build Linux (no features enabled)
run: cargo build --verbose
- name: Build Linux (all features enabled)
run: cargo build --verbose --all-features
build-wasm32:
name: Build check for wasm32
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Add wasm32
run: rustup target add wasm32-unknown-unknown
- name: Build wasm32 (no features enabled)
run: cargo build --target wasm32-unknown-unknown --verbose
- name: Build wasm32 (all features enabled)
run: cargo build --target wasm32-unknown-unknown --verbose --all-features
build-windows:
name: Build check on windows
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
- name: Build Windows (no features enabled)
run: cargo build --verbose
- name: Build Windows (all features enabled)
run: cargo build --verbose --all-features
cargo-test:
name: Check Cargo test
runs-on: ubuntu-latest
container:
image: alpine:latest
env:
SSH_RS_TEST_SERVER: localhost:8888
SSH_RS_TEST_USER: ubuntu
SSH_RS_TEST_PASSWD: password
SSH_RS_TEST_PEM_RSA: /root/rsa_old
SSH_RS_TEST_OPENSSH_RSA: /root/rsa_new
SSH_RS_TEST_ED25519: /root/ed25519
steps:
- uses: actions/checkout@v3
- name: set timezone
run: echo 'Europe/London' > /etc/timezone
- name: install ssh
run: apk add --no-cache --update sudo openssh bash openssh-keygen gcc musl-dev rust cargo
- name: add user
run: addgroup ubuntu && adduser --shell /bin/ash --disabled-password --home /home/ubuntu --ingroup ubuntu ubuntu && echo "ubuntu:password" | chpasswd
- name: config ssh
run: ssh-keygen -A && sed -i -E "s|(AuthorizedKeysFile).*|\1 %h/.ssh/authorized_keys|g" /etc/ssh/sshd_config && echo "HostKeyAlgorithms=+ssh-rsa" >> /etc/ssh/sshd_config && echo "PubkeyAcceptedAlgorithms=+ssh-rsa" >> /etc/ssh/sshd_config && echo "KexAlgorithms=+diffie-hellman-group14-sha1,diffie-hellman-group1-sha1" >> /etc/ssh/sshd_config && echo "Ciphers=+aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc" >> /etc/ssh/sshd_config && sed -i -E "s/#?(ChallengeResponseAuthentication|PasswordAuthentication).*/\1 yes/g" /etc/ssh/sshd_config
- name: create .ssh
run: mkdir -p /home/ubuntu/.ssh && umask 066; touch /home/ubuntu/.ssh/authorized_keys
- name: generate rsa files
run: ssh-keygen -t rsa -b 4096 -m pem -N '' -f /root/rsa_old && cat /root/rsa_old.pub >> /home/ubuntu/.ssh/authorized_keys
- name: generate openssh-rsa files
run: ssh-keygen -t rsa -b 4096 -N '' -f /root/rsa_new && cat /root/rsa_new.pub >> /home/ubuntu/.ssh/authorized_keys
- name: generate ed25519 files
run: ssh-keygen -t ed25519 -N '' -f /root/ed25519 && cat /root/ed25519.pub >> /home/ubuntu/.ssh/authorized_keys
- name: change owner
run: chown -R ubuntu /home/ubuntu/.ssh
- name: run ssh
run: mkdir /run/sshd && /usr/sbin/sshd -T &&/usr/sbin/sshd -D -p 8888 &
- name: Test
run: cargo test --all-features -- --test-threads 1
- name: Doc test
run: cargo test --doc --all-features