Skip to content

[DEVOPS-1748] Build pipeline for C++ sdk #3415

[DEVOPS-1748] Build pipeline for C++ sdk

[DEVOPS-1748] Build pipeline for C++ sdk #3415

Workflow file for this run

---
name: Build Android
on:
pull_request:
push:
branches:
- "main"
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
settings:
- target: aarch64-linux-android
- target: armv7-linux-androideabi
- target: x86_64-linux-android
- target: i686-linux-android
steps:
- name: Checkout repo
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Install rust
uses: dtolnay/rust-toolchain@d8352f6b1d2e870bc5716e7a6d9b65c4cc244a1a # stable
with:
toolchain: stable
- name: Cache cargo registry
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
key: ${{ matrix.settings.target }}-cargo
- name: Install Cross
run: cargo install cross --locked --git https://github.com/cross-rs/cross.git --rev 185398b1b885820515a212de720a306b08e2c8c9
- name: Build
env:
TARGET: ${{ matrix.settings.target }}
run: cross build -p bitwarden-uniffi --release --target=${{ matrix.settings.target }}
- name: Upload artifact
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: android-${{ matrix.settings.target }}
path: ./target/${{ matrix.settings.target }}/release/libbitwarden_uniffi.so
if-no-files-found: error
combine:
runs-on: ubuntu-22.04
needs: build
steps:
- name: Checkout repo (PR)
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
if: github.event_name == 'pull_request'
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
- name: Checkout repo (Push)
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
if: github.event_name == 'push'
with:
fetch-depth: 0
- name: Install rust
uses: dtolnay/rust-toolchain@d8352f6b1d2e870bc5716e7a6d9b65c4cc244a1a # stable
with:
toolchain: stable
- name: Cache cargo registry
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
key: cargo-combine-cache
- name: Setup Java
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
distribution: temurin
java-version: 17
- name: Download Artifacts
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
- name: Move artifacts
working-directory: languages/kotlin/sdk/src/main/jniLibs
run: |
mkdir armeabi-v7a arm64-v8a x86 x86_64
mv /home/runner/work/sdk/sdk/android-armv7-linux-androideabi/libbitwarden_uniffi.so ./armeabi-v7a/libbitwarden_uniffi.so
mv /home/runner/work/sdk/sdk/android-aarch64-linux-android/libbitwarden_uniffi.so ./arm64-v8a/libbitwarden_uniffi.so
mv /home/runner/work/sdk/sdk/android-i686-linux-android/libbitwarden_uniffi.so ./x86/libbitwarden_uniffi.so
mv /home/runner/work/sdk/sdk/android-x86_64-linux-android/libbitwarden_uniffi.so ./x86_64/libbitwarden_uniffi.so
- name: Generate bindings
working-directory: languages/kotlin
run: ./build-schemas.sh
- name: Publish
uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2
with:
arguments: sdk:publish
build-root-directory: languages/kotlin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}