Files
rustunnel/.github/workflows/ci.yml
T
c4ch3c4d3 03dab7c2c8 fix: add shell: bash to negative smoke checks for cross-platform portability
The 'Invalid command fails' and 'Invalid port fails' smoke test steps use
bash if/then/fi syntax that fails on Windows runners (default pwsh shell).
Explicitly setting shell: bash makes these steps portable across the
Windows/Linux/macOS CI matrix.
2026-06-03 17:59:53 -06:00

120 lines
3.3 KiB
YAML

name: CI
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
env:
CARGO_TERM_COLOR: always
jobs:
fmt:
name: cargo fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --check
clippy:
name: cargo clippy (${{ matrix.os }})
needs: [fmt]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- run: cargo clippy --all-targets -- -D warnings
test:
name: cargo test (${{ matrix.os }})
needs: [fmt]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo test --all-targets
build:
name: cargo build (${{ matrix.os }})
needs: [fmt]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo build
release-build:
name: cargo build --release (${{ matrix.os }})
needs: [test]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo build --release
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: rustunnel-${{ matrix.os }}
path: target/release/rustunnel${{ matrix.os == 'windows-latest' && '.exe' || '' }}
retention-days: 7
smoke:
name: CLI smoke (${{ matrix.os }})
needs: [release-build]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo build --release
# OS-neutral cargo-based smoke tests avoid path issues on Windows (.exe vs no extension)
- name: rustunnel --help
run: cargo run --release -- --help
- name: rustunnel version
run: cargo run --release -- version
- name: rustunnel listen --help
run: cargo run --release -- listen --help
- name: rustunnel connect --help
run: cargo run --release -- connect --help
- name: rustunnel generate --help
run: cargo run --release -- generate --help
- name: Invalid command fails
shell: bash
run: |
if cargo run --release -- invalid-cmd 2>&1; then
echo "ERROR: invalid command should have failed"
exit 1
fi
- name: Invalid port fails
shell: bash
run: |
if cargo run --release -- listen --listen localhost:bad --cert x --key x --ca-cert x --auth-token x 2>&1; then
echo "ERROR: invalid port should have failed"
exit 1
fi