Skip to content

Commit 01d33a9

Browse files
authored
Merge pull request #38 from jonhoo/ci
Move CI to GitHub Actions
2 parents 11751f0 + 3fa0fef commit 01d33a9

File tree

10 files changed

+259
-176
lines changed

10 files changed

+259
-176
lines changed

.github/workflows/coverage.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
on:
2+
push:
3+
branches: [master]
4+
pull_request:
5+
name: coverage
6+
jobs:
7+
test:
8+
runs-on: ubuntu-latest
9+
container:
10+
image: xd009642/tarpaulin
11+
options: --security-opt seccomp=unconfined
12+
steps:
13+
- uses: actions/checkout@v2
14+
- run: |
15+
chmod 600 .test-key
16+
ssh -i .test-key -v -p 2222 -l test-user openssh -o StrictHostKeyChecking=accept-new whoami
17+
name: Test ssh connectivity
18+
- run: |
19+
eval $(ssh-agent)
20+
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> $GITHUB_ENV
21+
echo "SSH_AGENT_PID=$SSH_AGENT_PID" >> $GITHUB_ENV
22+
cat .test-key | ssh-add -
23+
name: Set up ssh-agent
24+
- name: Generate code coverage
25+
run: |
26+
cargo tarpaulin --verbose --timeout 300 --out Xml --forward --all-features
27+
env:
28+
# makes all the ignored tests not ignored
29+
RUSTFLAGS: --cfg=ci
30+
# we cannot use 127.0.0.1 (the default here)
31+
# since we are running from a different container
32+
TEST_HOST: ssh://test-user@openssh:2222
33+
- name: Upload to codecov.io
34+
uses: codecov/codecov-action@v2
35+
with:
36+
fail_ci_if_error: true
37+
services:
38+
openssh:
39+
image: linuxserver/openssh-server:amd64-latest
40+
ports:
41+
- 2222:2222
42+
env:
43+
USER_NAME: test-user
44+
PUBLIC_KEY: |-
45+
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGzHvK2pKtSlZXP9tPYOOBb/xn0IiC9iLMS355AYUPC7
46+
DOCKER_MODS: linuxserver/mods:openssh-server-ssh-tunnel

.github/workflows/features.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
on:
2+
push:
3+
branches: [master]
4+
pull_request:
5+
name: cargo hack
6+
jobs:
7+
check:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions-rs/toolchain@v1
11+
with:
12+
profile: minimal
13+
toolchain: stable
14+
- uses: actions/checkout@v2
15+
- name: Install cargo-hack
16+
uses: actions-rs/install@v0.1
17+
with:
18+
crate: cargo-hack
19+
version: latest
20+
use-tool-cache: true
21+
- name: cargo hack
22+
uses: actions-rs/cargo@v1
23+
with:
24+
command: hack
25+
args: --feature-powerset check --all-targets

.github/workflows/minimal.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
on:
2+
push:
3+
branches: [master]
4+
pull_request:
5+
name: With dependencies at minimal versions
6+
jobs:
7+
test:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions-rs/toolchain@v1
11+
with:
12+
profile: minimal
13+
toolchain: nightly
14+
- uses: actions-rs/toolchain@v1
15+
with:
16+
profile: minimal
17+
toolchain: stable
18+
- uses: actions/checkout@v2
19+
- run: |
20+
chmod 600 .test-key
21+
ssh -i .test-key -v -p 2222 -l test-user 127.0.0.1 -o StrictHostKeyChecking=accept-new whoami
22+
name: Test ssh connectivity
23+
- run: |
24+
eval $(ssh-agent)
25+
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> $GITHUB_ENV
26+
echo "SSH_AGENT_PID=$SSH_AGENT_PID" >> $GITHUB_ENV
27+
cat .test-key | ssh-add -
28+
name: Set up ssh-agent
29+
- name: cargo update -Zminimal-versions
30+
uses: actions-rs/cargo@v1
31+
with:
32+
command: update
33+
toolchain: nightly
34+
args: -Zminimal-versions
35+
- name: cargo test
36+
uses: actions-rs/cargo@v1
37+
with:
38+
command: test
39+
args: --all-features
40+
env:
41+
# makes all the ignored tests not ignored
42+
RUSTFLAGS: --cfg=ci
43+
services:
44+
openssh:
45+
image: linuxserver/openssh-server:amd64-latest
46+
ports:
47+
- 2222:2222
48+
env:
49+
USER_NAME: test-user
50+
PUBLIC_KEY: |-
51+
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGzHvK2pKtSlZXP9tPYOOBb/xn0IiC9iLMS355AYUPC7
52+
DOCKER_MODS: linuxserver/mods:openssh-server-ssh-tunnel

.github/workflows/msrv.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
on:
2+
push:
3+
branches: [master]
4+
pull_request:
5+
name: Minimum Supported Rust Version
6+
jobs:
7+
check:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions-rs/toolchain@v1
11+
with:
12+
profile: minimal
13+
toolchain: 1.56.1
14+
override: true
15+
- uses: actions/checkout@v2
16+
- name: cargo +1.56.1 check
17+
uses: actions-rs/cargo@v1
18+
with:
19+
command: check

.github/workflows/os-check.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
on:
2+
push:
3+
branches: [master]
4+
pull_request:
5+
name: cargo check
6+
jobs:
7+
os-check:
8+
runs-on: ${{ matrix.os }}
9+
name: ${{ matrix.os }}
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
os: [macos-latest]
14+
steps:
15+
- uses: actions-rs/toolchain@v1
16+
with:
17+
profile: minimal
18+
toolchain: stable
19+
- uses: actions/checkout@v2
20+
- name: cargo check
21+
uses: actions-rs/cargo@v1
22+
with:
23+
command: check
24+
args: --all-features --all-targets

.github/workflows/style.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
on:
2+
push:
3+
branches: [master]
4+
pull_request:
5+
name: lint
6+
jobs:
7+
style:
8+
runs-on: ubuntu-latest
9+
name: ${{ matrix.toolchain }}
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
toolchain: [stable, beta]
14+
steps:
15+
- uses: actions-rs/toolchain@v1
16+
with:
17+
profile: minimal
18+
toolchain: ${{ matrix.toolchain }}
19+
components: rustfmt, clippy
20+
- uses: actions/checkout@v2
21+
- name: cargo fmt --check
22+
uses: actions-rs/cargo@v1
23+
with:
24+
command: fmt
25+
args: --check
26+
- name: cargo doc
27+
uses: actions-rs/cargo@v1
28+
if: always()
29+
with:
30+
command: doc
31+
args: --no-deps --all-features
32+
- name: cargo clippy
33+
uses: actions-rs/clippy-check@v1
34+
if: always()
35+
with:
36+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
on:
2+
push:
3+
branches: [master]
4+
pull_request:
5+
name: cargo test
6+
jobs:
7+
test:
8+
runs-on: ubuntu-latest
9+
name: ${{ matrix.toolchain }}
10+
strategy:
11+
matrix:
12+
toolchain: [stable, beta, nightly]
13+
steps:
14+
- uses: actions-rs/toolchain@v1
15+
with:
16+
profile: minimal
17+
toolchain: ${{ matrix.toolchain }}
18+
- uses: actions/checkout@v2
19+
- run: |
20+
chmod 600 .test-key
21+
ssh -i .test-key -v -p 2222 -l test-user 127.0.0.1 -o StrictHostKeyChecking=accept-new whoami
22+
name: Test ssh connectivity
23+
- run: |
24+
eval $(ssh-agent)
25+
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> $GITHUB_ENV
26+
echo "SSH_AGENT_PID=$SSH_AGENT_PID" >> $GITHUB_ENV
27+
cat .test-key | ssh-add -
28+
name: Set up ssh-agent
29+
- name: cargo test
30+
uses: actions-rs/cargo@v1
31+
with:
32+
command: test
33+
args: --all-features
34+
env:
35+
# makes all the ignored tests not ignored
36+
RUSTFLAGS: --cfg=ci
37+
- run: docker logs $(docker ps | grep openssh-server | awk '{print $1}')
38+
name: ssh container log
39+
if: ${{ failure() }}
40+
- run: docker exec $(docker ps | grep openssh-server | awk '{print $1}') ls -R /config/logs/
41+
if: ${{ failure() }}
42+
- run: docker exec $(docker ps | grep openssh-server | awk '{print $1}') cat /config/logs/openssh/current
43+
name: ssh server log
44+
if: ${{ failure() }}
45+
services:
46+
openssh:
47+
image: linuxserver/openssh-server:amd64-latest
48+
ports:
49+
- 2222:2222
50+
env:
51+
USER_NAME: test-user
52+
PUBLIC_KEY: |-
53+
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGzHvK2pKtSlZXP9tPYOOBb/xn0IiC9iLMS355AYUPC7
54+
DOCKER_MODS: linuxserver/mods:openssh-server-ssh-tunnel

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ native-mux = ["openssh-mux-client"]
3535

3636
[dependencies]
3737
tempfile = "3.1.0"
38-
shell-escape = "0.1"
38+
shell-escape = "0.1.5"
3939
tokio = { version = "1", features = [ "process", "io-util", "macros" ] }
4040
tokio-pipe = "0.2.8"
4141

@@ -46,6 +46,8 @@ once_cell = "1.8.0"
4646
dirs = "4.0.0"
4747

4848
openssh-mux-client = { version = "0.14.0", optional = true }
49+
# needed to make openssh-mux-client compile with -Zminimal-versions
50+
serde = "1.0.103"
4951

5052
[dev-dependencies]
5153
lazy_static = "1.4.0"

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[![Crates.io](https://img.shields.io/crates/v/openssh.svg)](https://crates.io/crates/openssh)
22
[![Documentation](https://docs.rs/openssh/badge.svg)](https://docs.rs/openssh/)
3-
[![Build Status](https://dev.azure.com/jonhoo/jonhoo/_apis/build/status/openssh?branchName=master)](https://dev.azure.com/jonhoo/jonhoo/_build/latest?definitionId=23&branchName=master)
43
[![Codecov](https://codecov.io/github/jonhoo/openssh-rs/coverage.svg?branch=master)](https://codecov.io/gh/jonhoo/openssh-rs)
54

65
Scriptable SSH through OpenSSH.

0 commit comments

Comments
 (0)