Skip to content

[SM-1287] Refactor out command logic from main.rs in bws #4551

[SM-1287] Refactor out command logic from main.rs in bws

[SM-1287] Refactor out command logic from main.rs in bws #4551

---
name: Build Rust crates
on:
workflow_dispatch:
pull_request:
push:
branches:
- "main"
- "rc"
- "hotfix-rc"
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Building ${{matrix.package}} for - ${{ matrix.os }}
runs-on: ${{ matrix.settings.os || 'ubuntu-latest' }}
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
package:
- bitwarden
- bitwarden-api-api
- bitwarden-api-identity
- bitwarden-crypto
- bitwarden-generators
steps:
- name: Checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Install rust
uses: dtolnay/rust-toolchain@d8352f6b1d2e870bc5716e7a6d9b65c4cc244a1a # stable
with:
toolchain: stable
targets: ${{ matrix.settings.target }}
- name: Cache cargo registry
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
- name: Build
run: cargo build -p ${{ matrix.package }} --release
env:
RUSTFLAGS: "-D warnings"
- name: Build Internal
if: ${{ matrix.package == 'bitwarden' }}
run: cargo build -p ${{ matrix.package }} --features internal --release
env:
RUSTFLAGS: "-D warnings"
release-dry-run:
name: Release dry-run
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/head/main' || github.ref == 'refs/head/rc' || github.ref == 'refs/head/hotfix-rc' }}
needs:
- build
steps:
- name: Checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Install rust
uses: dtolnay/rust-toolchain@d8352f6b1d2e870bc5716e7a6d9b65c4cc244a1a # stable
with:
toolchain: stable
targets: ${{ matrix.settings.target }}
- name: Cache cargo registry
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
- name: Install cargo-release
run: cargo install cargo-release
- name: Cargo release dry run
run: cargo-release release publish --no-publish -p bitwarden-api-api -p bitwarden-api-identity -p bitwarden