Skip to content

[SM-1129] Run command with secrets #1521

[SM-1129] Run command with secrets

[SM-1129] Run command with secrets #1521

---
name: Build Python Wheels
on:
pull_request:
push:
branches:
- "main"
- "rc"
- "hotfix-rc"
workflow_dispatch:
defaults:
run:
shell: bash
working-directory: languages/python
jobs:
generate_schemas:
uses: ./.github/workflows/generate_schemas.yml
setup:
name: Setup
runs-on: ubuntu-22.04
outputs:
package_version: ${{ steps.retrieve-version.outputs.package_version }}
steps:
- name: Checkout repo
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Get Package Version
id: retrieve-version
run: |
VERSION="$(grep -o '^version = ".*"' ../../crates/bitwarden-py/Cargo.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+")"
echo "package_version=$VERSION" >> $GITHUB_OUTPUT
build:
name: Building Python wheel for - ${{ matrix.settings.os }} - ${{ matrix.settings.target }}
runs-on: ${{ matrix.settings.os || 'ubuntu-latest' }}
needs:
- generate_schemas
- setup
env:
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
strategy:
fail-fast: false
matrix:
settings:
- os: macos-12
target: x86_64-apple-darwin
- os: macos-12
target: aarch64-apple-darwin
- os: windows-2022
target: x86_64-pc-windows-msvc
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
- os: ubuntu-22.04
target: aarch64-unknown-linux-gnu
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
- 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.py
path: ${{ github.workspace }}/languages/python/bitwarden_sdk
- name: Build wheels
if: ${{ matrix.settings.target != 'x86_64-unknown-linux-gnu' }}
uses: PyO3/maturin-action@52b28abb0c6729beb388babfc348bf6ff5aaff31 # v1.42.2
with:
target: ${{ matrix.settings.target }}
args: --release --find-interpreter --sdist
sccache: "true"
manylinux: "2_28" # https://github.com/pola-rs/polars/pull/12211
working-directory: ${{ github.workspace }}/languages/python
- name: Build wheels (Linux - x86_64)
if: ${{ matrix.settings.target == 'x86_64-unknown-linux-gnu' }}
uses: PyO3/maturin-action@52b28abb0c6729beb388babfc348bf6ff5aaff31 # v1.42.2
with:
target: ${{ matrix.settings.target }}
args: --release --find-interpreter --sdist
container: quay.io/pypa/manylinux_2_28_x86_64:2023-11-20-745eb52
sccache: "true"
manylinux: "2_28" # https://github.com/pola-rs/polars/pull/12211
working-directory: ${{ github.workspace }}/languages/python
- name: Upload wheels
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: bitwarden_sdk-${{ env._PACKAGE_VERSION }}-${{ matrix.settings.target }}
path: ${{ github.workspace }}/target/wheels/bitwarden_sdk*.whl
- name: Upload sdists
if: ${{ matrix.settings.target == 'x86_64-unknown-linux-gnu' }} # we only need one sdist
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: bitwarden_sdk-${{ env._PACKAGE_VERSION }}-sdist
path: ${{ github.workspace }}/target/wheels/bitwarden_sdk-*.tar.gz