Publish v0.10.0: #293
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| tags: [ 'v*' ] | |
| pull_request: | |
| branches: [ "main" ] | |
| workflow_dispatch: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| COMMON_FEATURES: "sign,encrypt,compress,kerberos" | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| container: | |
| image: rustlang/rust:nightly | |
| timeout-minutes: 10 | |
| strategy: | |
| matrix: | |
| compile_features: [ async, multi_threaded, single_threaded ] | |
| services: | |
| samba: | |
| image: ghcr.io/avivnaaman/smb-tests:latest | |
| env: | |
| ACCOUNT_LocalAdmin: 123456 | |
| SAMBA_CONF_LOG_LEVEL: 1 | |
| SAMBA_VOLUME_CONFIG_MyShare: "[MyShare]; path=/shares/MyShare; read only = no; browseable = yes; create mask = 0777; directory mask = 0777; smb encrypt = desired" | |
| SAMBA_VOLUME_CONFIG_PublicShare: "[PublicShare]; path=/shares/PublicShare; read only = no; browseable = yes; guest ok = yes; smb encrypt = disabled" | |
| SAMBA_GLOBAL_CONFIG_smb_SPACE_ports: "139 445" | |
| SAMBA_GLOBAL_CONFIG_smb_SPACE_encrypt: "auto" | |
| options: --name samba --privileged --cap-add NET_ADMIN | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Prepare async tests | |
| if: ${{ matrix.compile_features == 'async' }} | |
| run: | | |
| echo "COMMON_FEATURES=${COMMON_FEATURES},quic" >> "${GITHUB_ENV}" | |
| apt update | |
| apt install -y libibverbs1 ibverbs-utils librdmacm1 libibumad3 ibverbs-providers rdma-core libibverbs-dev iproute2 perftest librdmacm-dev rdmacm-utils libprotobuf-dev protobuf-compiler clang | |
| - name: Format/${{ matrix.compile_features }} | |
| run: | | |
| rustup component add rustfmt | |
| cargo fmt --verbose --check | |
| - name: Lint/${{ matrix.compile_features }} | |
| run: | | |
| rustup component add clippy | |
| cargo clippy --verbose --no-default-features --features "${{ matrix.compile_features }},${COMMON_FEATURES}" -- -Dclippy::all | |
| - name: Tests/${{ matrix.compile_features }} | |
| run: | | |
| export SMB_RUST_TESTS_SERVER=samba | |
| export RUST_LOG=debug | |
| cargo test --verbose --no-default-features --features "${{ matrix.compile_features }},${COMMON_FEATURES}" -- --nocapture | |
| # Test without encryption and compression | |
| cargo test --verbose --no-default-features --features "${{ matrix.compile_features }},sign" -- --nocapture | |
| # Test signing with specific algorithms | |
| cargo test --verbose --no-default-features --features "${{ matrix.compile_features }},sign_cmac" -- --nocapture | |
| cargo test --verbose --no-default-features --features "${{ matrix.compile_features }},sign_gmac" -- --nocapture | |
| cargo test --verbose --no-default-features --features "${{ matrix.compile_features }},sign_hmac" -- --nocapture | |
| - name: Build/${{ matrix.compile_features }} | |
| run: cargo build --verbose --no-default-features --features "${{ matrix.compile_features }},${COMMON_FEATURES}" | |
| build-msrv: | |
| runs-on: ubuntu-latest | |
| container: | |
| image: rust:1.85 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build | |
| run: | | |
| for td_model in async multi_threaded single_threaded; do | |
| echo "Compiling with features: $td_model, ${COMMON_FEATURES}" | |
| cargo build --verbose --no-default-features --features "$td_model,${COMMON_FEATURES}" | |
| done | |
| - name: Doc | |
| run: | | |
| for td_model in async multi_threaded single_threaded; do | |
| echo "Generating documentation with features: $td_model, ${COMMON_FEATURES}" | |
| cargo doc --verbose --no-default-features --features "$td_model,${COMMON_FEATURES}" | |
| done | |
| publish: | |
| runs-on: ubuntu-latest | |
| container: | |
| image: rust:1.85 | |
| needs: [ test, build-msrv ] | |
| environment: production | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setting up environment | |
| run: apt update && apt install -y jq | |
| - name: Verify tag matches Cargo.toml version | |
| run: | | |
| TAG_VERSION=${GITHUB_REF#refs/tags/v} | |
| CARGO_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version') | |
| if [ "$TAG_VERSION" != "$CARGO_VERSION" ]; then | |
| echo "Tag version ($TAG_VERSION) doesn't match Cargo.toml version ($CARGO_VERSION)" | |
| exit 1 | |
| fi | |
| - name: Publish to crates.io | |
| # Currently, MSRV does not support the `cargo publish --workspace` command, so putting all packages explicitly is required. | |
| # Also, versions are always workspace-defined, so publishing all packages together is required. | |
| run: cargo publish -p smb-dtyp -p smb-fscc -p smb-msg -p smb-transport -p smb-rpc -p smb --token ${{ secrets.CRATES_IO_TOKEN }} |