Skip to content

Use Swatinem/rust-cache@v2 for caching #779

Use Swatinem/rust-cache@v2 for caching

Use Swatinem/rust-cache@v2 for caching #779

Workflow file for this run

name: Rust
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env:
RUSTFLAGS: -Dwarnings
RUSTDOCFLAGS: -Dwarnings
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
on:
push:
branches:
- main
paths-ignore:
- 'README.md'
- 'LICENSE'
- '.gitignore'
pull_request:
paths-ignore:
- 'README.md'
- 'LICENSE'
- '.gitignore'
jobs:
os-check:
runs-on: ubuntu-latest
name: os check on ${{ matrix.target }}
strategy:
fail-fast: false
matrix:
include:
- { target: x86_64-pc-windows-msvc, args: "--exclude-features openssh" }
- { target: x86_64-apple-darwin }
- { target: x86_64-unknown-linux-gnu }
steps:
- uses: actions/checkout@v3
- name: Install toolchain
run: |
rustup toolchain install stable --no-self-update --profile minimal --target ${{ matrix.target }}
- uses: taiki-e/install-action@v2
with:
tool: cargo-hack
- name: Create Cargo.lock for caching
run: cargo update
- uses: Swatinem/rust-cache@v2
- run: |
cargo hack check --feature-powerset --target ${{ matrix.target }} ${{ matrix.args }}
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Install toolchain
run: |
rustup toolchain install stable --component rustfmt,clippy --no-self-update --profile minimal
rustup toolchain install nightly --no-self-update --profile minimal
- name: Create Cargo.lock for caching
run: cargo update
- uses: Swatinem/rust-cache@v2
- run: ./check.sh
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Install toolchain
run: rustup toolchain install stable --no-self-update --profile minimal
- name: Create Cargo.lock for caching
run: cargo update
- uses: Swatinem/rust-cache@v2
- name: Compile tests
run: cargo test --all-features --workspace --no-run
- name: Test ssh connectivity
run: |
# Wait for startup of openssh-server
timeout 15 ./wait_for_sshd_start_up.sh
chmod 600 .test-key
mkdir /tmp/openssh-rs
ssh -i .test-key -v -p 2222 -l test-user 127.0.0.1 -o StrictHostKeyChecking=accept-new -o UserKnownHostsFile=/tmp/openssh-rs/known_hosts whoami
- name: Set up ssh-agent
run: |
eval $(ssh-agent)
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> $GITHUB_ENV
echo "SSH_AGENT_PID=$SSH_AGENT_PID" >> $GITHUB_ENV
cat .test-key | ssh-add -
- name: Run tests
run: ./run_tests.sh
env:
XDG_RUNTIME_DIR: /tmp
- name: ssh container log
run: docker logs $(docker ps | grep openssh-server | awk '{print $1}')
if: ${{ failure() }}
- run: docker exec $(docker ps | grep openssh-server | awk '{print $1}') ls -R /config/logs/
if: ${{ failure() }}
- run: docker exec $(docker ps | grep openssh-server | awk '{print $1}') cat /config/logs/openssh/current
name: ssh server log
if: ${{ failure() }}
services:
openssh:
image: linuxserver/openssh-server:amd64-latest
ports:
- 2222:2222
env:
USER_NAME: test-user
PUBLIC_KEY: |-
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGzHvK2pKtSlZXP9tPYOOBb/xn0IiC9iLMS355AYUPC7
DOCKER_MODS: linuxserver/mods:openssh-server-ssh-tunnel