Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 75 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,79 @@
- name: Run doc tests
run: cargo test --doc --features ${{ matrix.features }}

# Gate major optional feature bundles to avoid regressions in less-used modules
feature_matrix:
name: Feature Bundle Gate (${{ matrix.bundle.name }})
needs: check
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
bundle:
- name: aws
features: aws
mode: test
- name: docker
features: docker
mode: test
- name: api
features: api
mode: test
- name: database
features: database
mode: test
- name: provisioning
features: provisioning
mode: test
- name: aggregate
features: full-provisioning,api,database
mode: compile

steps:
- name: Free disk space
run: |
# Remove unnecessary large directories to free up disk space (~15GB)
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/share/boost
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
# Additional cleanup for more space (~10GB more)
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo rm -rf /usr/local/share/powershell
sudo rm -rf /usr/share/swift
df -h

- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-bundle-${{ matrix.bundle.name }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-bundle-${{ matrix.bundle.name }}-cargo-
${{ runner.os }}-bundle-cargo-
${{ runner.os }}-cargo-

- name: Compile bundle
run: cargo check --all-targets --features "${{ matrix.bundle.features }}" --verbose

- name: Run bundle tests
if: matrix.bundle.mode == 'test'
run: cargo test --lib --features "${{ matrix.bundle.features }}" --verbose -- --test-threads=1
Comment on lines +189 to +193

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use --no-default-features in feature bundle gate

The new bundle gate is described as catching regressions "outside the default profile," but these commands only pass --features; per cargo test -h, default features remain active unless --no-default-features is set. That means each matrix row still compiles/tests with the default russh,local set enabled, so regressions that appear when consumers build a bundle without defaults (for example --no-default-features --features api) will not be detected by this CI job.

Useful? React with 👍 / 👎.

env:
RUST_LOG: debug

# Security audit using cargo-audit
security:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
name: Security Audit
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -215,7 +286,7 @@
# Build release artifacts for all platforms
build:
name: Build (${{ matrix.target }})
needs: [test, security]
needs: [test, feature_matrix, security]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -305,15 +376,17 @@
# Summary job that requires all other jobs to pass
ci-success:
name: CI Success
needs: [check, test, security, coverage, build]
needs: [check, test, feature_matrix, security, coverage, build]
runs-on: ubuntu-latest
if: always()
steps:
- name: Check all jobs passed
run: |
if [[ "${{ needs.check.result }}" != "success" ]] || \
[[ "${{ needs.test.result }}" != "success" ]] || \
[[ "${{ needs.feature_matrix.result }}" != "success" ]] || \
[[ "${{ needs.security.result }}" != "success" ]] || \
[[ "${{ needs.coverage.result }}" != "success" ]] || \
[[ "${{ needs.build.result }}" != "success" ]]; then
echo "One or more jobs failed"
exit 1
Expand Down
18 changes: 18 additions & 0 deletions docs/development/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,24 @@ cargo test --test '*'
cargo test --features "russh,local"
```

### CI Feature Bundle Gate

GitHub Actions enforces a dedicated optional-feature matrix on Linux stable to
catch regressions outside the default profile:

- Tested bundles: `aws`, `docker`, `api`, `database`, `provisioning`
- Broad aggregate compile gate: `full-provisioning,api,database`

Use these commands locally when working on optional feature paths:

```bash
# Compile all targets for a bundle
cargo check --all-targets --features "<bundle>"

# Run a fast bundle test path (library tests)
cargo test --lib --features "<bundle>" -- --test-threads=1
```

### Running Benchmarks

```bash
Expand Down
Loading