[SM-1287] Refactor out command logic from main.rs in bws #4551
Workflow file for this run
This file contains 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 @bitwarden/sdk-napi | |
on: | |
pull_request: | |
push: | |
branches: | |
- "main" | |
- "rc" | |
- "hotfix-rc" | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
working-directory: crates/bitwarden-napi | |
jobs: | |
generate_schemas: | |
uses: ./.github/workflows/generate_schemas.yml | |
build: | |
name: Building @bitwarden/sdk-napi for - ${{ matrix.settings.os }} | |
runs-on: ${{ matrix.settings.os || 'ubuntu-latest' }} | |
needs: generate_schemas | |
strategy: | |
fail-fast: false | |
matrix: | |
settings: | |
- os: macos-13 | |
target: x86_64-apple-darwin | |
build: | | |
npm run build | |
strip -x *.node | |
- os: macos-13 | |
target: aarch64-apple-darwin | |
build: | | |
npm run build-arm64 | |
strip -x *.node | |
- os: windows-2022 | |
target: x86_64-pc-windows-msvc | |
build: npm run build | |
- os: ubuntu-22.04 | |
target: x86_64-unknown-linux-gnu | |
build: | | |
set -e && | |
npm run build && | |
strip *.node | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | |
- name: Setup Node | |
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | |
with: | |
node-version: 18 | |
cache: "npm" | |
cache-dependency-path: crates/bitwarden-napi/package-lock.json | |
- 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 | |
with: | |
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.os }} | |
- name: Retrieve schemas | |
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | |
with: | |
name: schemas.ts | |
path: ${{ github.workspace }}/crates/bitwarden-napi/src-ts/bitwarden_client/ | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: ${{ matrix.settings.build }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
with: | |
name: sdk-bitwarden-napi-${{ matrix.settings.target }} | |
path: ${{ github.workspace }}/crates/bitwarden-napi/sdk-napi.*.node | |
if-no-files-found: error |