Skip to content

Commit

Permalink
Merge branch 'main' into ps/improve-ts-bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
dani-garcia committed Jan 26, 2024
2 parents ddaf0f9 + 5457935 commit 819e354
Show file tree
Hide file tree
Showing 191 changed files with 4,734 additions and 2,689 deletions.
1 change: 1 addition & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base",
"github>bitwarden/renovate-config:pin-actions",
":combinePatchMinorReleases",
":dependencyDashboard",
":maintainLockFilesWeekly",
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ jobs:
- name: Install rust
uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248 # stable
with:
toolchain: 1.67.0 # https://github.com/cross-rs/cross/issues/1222
toolchain: stable

- name: Cache cargo registry
uses: Swatinem/rust-cache@3cf7f8cc28d1b4e7d01e3783be10a97d55d483c8 # v2.7.1
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
key: ${{ matrix.settings.target }}-cargo

- name: Install Cross
run: cargo install cross --locked
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@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0
uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 # v4.2.0
with:
name: android-${{ matrix.settings.target }}
path: ./target/${{ matrix.settings.target }}/release/libbitwarden_uniffi.so
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
toolchain: stable

- name: Cache cargo registry
uses: Swatinem/rust-cache@3cf7f8cc28d1b4e7d01e3783be10a97d55d483c8 # v2.7.1
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
key: cargo-combine-cache

Expand All @@ -86,7 +86,7 @@ jobs:
java-version: 17

- name: Download Artifacts
uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1

- name: Move artifacts
working-directory: languages/kotlin/sdk/src/main/jniLibs
Expand Down
163 changes: 163 additions & 0 deletions .github/workflows/build-cli-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
---
name: Build bws Docker image

on:
push:
paths:
- "crates/bws/**"
workflow_dispatch:
inputs:
sdk_branch:
description: "Server branch name to deploy (examples: 'master', 'rc', 'feature/sm')"
type: string
default: master
pull_request:
paths:
- ".github/workflows/build-cli-docker.yml"
- "crates/bws/**"

env:
_AZ_REGISTRY: bitwardenprod.azurecr.io

jobs:
build-docker:
name: Build Docker image
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Check Branch to Publish
env:
PUBLISH_BRANCHES: "master,rc,hotfix-rc"
id: publish-branch-check
run: |
REF=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
IFS="," read -a publish_branches <<< $PUBLISH_BRANCHES
if [[ "${publish_branches[*]}" =~ "${REF}" ]]; then
echo "is_publish_branch=true" >> $GITHUB_ENV
else
echo "is_publish_branch=false" >> $GITHUB_ENV
fi
########## Set up Docker ##########
- name: Set up QEMU emulators
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2.2.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@885d1462b80bc1c1c7f0b00334ad271f09369c55 # v2.10.0

########## Login to Docker registries ##########
- name: Login to Azure - Prod Subscription
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
with:
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}

- name: Login to Azure ACR
run: az acr login -n ${_AZ_REGISTRY%.azurecr.io}

- name: Login to Azure - CI Subscription
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
with:
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}

- name: Retrieve github PAT secrets
id: retrieve-secret-pat
uses: bitwarden/gh-actions/get-keyvault-secrets@main
with:
keyvault: "bitwarden-ci"
secrets: "github-pat-bitwarden-devops-bot-repo-scope"

- name: Setup Docker Trust
if: ${{ env.is_publish_branch == 'true' }}
uses: bitwarden/gh-actions/setup-docker-trust@main
with:
azure-creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
azure-keyvault-name: "bitwarden-ci"

########## Generate image tag and build Docker image ##########
- name: Generate Docker image tag
id: tag
run: |
REF=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
IMAGE_TAG=$(echo "${REF}" | sed "s#/#-#g") # slash safe branch name
if [[ "${IMAGE_TAG}" == "master" ]]; then
IMAGE_TAG=dev
elif [[ ("${IMAGE_TAG}" == "rc") || ("${IMAGE_TAG}" == "hotfix-rc") ]]; then
IMAGE_TAG=rc
fi
echo "image_tag=${IMAGE_TAG}" >> $GITHUB_OUTPUT
- name: Generate tag list
id: tag-list
env:
IMAGE_TAG: ${{ steps.tag.outputs.image_tag }}
IS_PUBLISH_BRANCH: ${{ env.is_publish_branch }}
run: |
if [[ ("${IMAGE_TAG}" == "dev" || "${IMAGE_TAG}" == "rc") && "${IS_PUBLISH_BRANCH}" == "true" ]]; then
echo "tags=$_AZ_REGISTRY/bws:${IMAGE_TAG},bitwarden/bws:${IMAGE_TAG}" >> $GITHUB_OUTPUT
else
echo "tags=$_AZ_REGISTRY/bws:${IMAGE_TAG}" >> $GITHUB_OUTPUT
fi
- name: Build and push Docker image
uses: docker/build-push-action@1104d471370f9806843c095c1db02b5a90c5f8b6 # v3.3.1
with:
context: .
file: crates/bws/Dockerfile
platforms: |
linux/amd64,
linux/arm64/v8
push: true
tags: ${{ steps.tag-list.outputs.tags }}
secrets: |
"GH_PAT=${{ steps.retrieve-secret-pat.outputs.github-pat-bitwarden-devops-bot-repo-scope }}"
- name: Log out of Docker and disable Docker Notary
if: ${{ env.is_publish_branch == 'true' }}
run: |
docker logout
echo "DOCKER_CONTENT_TRUST=0" >> $GITHUB_ENV
check-failures:
name: Check for failures
if: always()
runs-on: ubuntu-22.04
needs: build-docker
steps:
- name: Check if any job failed
if: |
github.ref == 'refs/heads/master'
|| github.ref == 'refs/heads/rc'
|| github.ref == 'refs/heads/hotfix-rc'
env:
BUILD_DOCKER_STATUS: ${{ needs.build-docker.result }}
run: |
if [ "$BUILD_DOCKER_STATUS" = "failure" ]; then
exit 1
fi
- name: Login to Azure - CI subscription
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
if: failure()
with:
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}

- name: Retrieve secrets
id: retrieve-secrets
uses: bitwarden/gh-actions/get-keyvault-secrets@main
if: failure()
with:
keyvault: "bitwarden-ci"
secrets: "devops-alerts-slack-webhook-url"

- name: Notify Slack on failure
uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f # v2.0.0
if: failure()
env:
SLACK_WEBHOOK_URL: ${{ steps.retrieve-secrets.outputs.devops-alerts-slack-webhook-url }}
with:
status: ${{ job.status }}
16 changes: 8 additions & 8 deletions .github/workflows/build-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ jobs:
targets: ${{ matrix.settings.target }}

- name: Cache cargo registry
uses: Swatinem/rust-cache@3cf7f8cc28d1b4e7d01e3783be10a97d55d483c8 # v2.7.1
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.os }}

- name: Install Cross (aarch64-unknown-linux-gnu)
if: ${{ matrix.settings.target == 'aarch64-unknown-linux-gnu' }}
run: cargo install cross --locked
run: cargo install cross --locked --git https://github.com/cross-rs/cross.git --rev 185398b1b885820515a212de720a306b08e2c8c9

- name: Build
if: ${{ matrix.settings.target != 'aarch64-unknown-linux-gnu' }}
Expand All @@ -99,7 +99,7 @@ jobs:
run: zip -j ./bws-${{ matrix.settings.target }}-${{ env._PACKAGE_VERSION }}.zip ./target/${{ matrix.settings.target }}/release/bws

- name: Upload artifact
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0
uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 # v4.2.0
with:
name: bws-${{ matrix.settings.target }}-${{ env._PACKAGE_VERSION }}.zip
path: ./bws-${{ matrix.settings.target }}-${{ env._PACKAGE_VERSION }}.zip
Expand All @@ -118,12 +118,12 @@ jobs:
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Download x86_64-apple-darwin artifact
uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
name: bws-x86_64-apple-darwin-${{ env._PACKAGE_VERSION }}.zip

- name: Download aarch64-apple-darwin artifact
uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
name: bws-aarch64-apple-darwin-${{ env._PACKAGE_VERSION }}.zip

Expand All @@ -142,7 +142,7 @@ jobs:
run: zip ./bws-macos-universal-${{ env._PACKAGE_VERSION }}.zip ./bws-macos-universal/bws

- name: Upload artifact
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0
uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 # v4.2.0
with:
name: bws-macos-universal-${{ env._PACKAGE_VERSION }}.zip
path: ./bws-macos-universal-${{ env._PACKAGE_VERSION }}.zip
Expand All @@ -163,7 +163,7 @@ jobs:
toolchain: stable

- name: Cache cargo registry
uses: Swatinem/rust-cache@3cf7f8cc28d1b4e7d01e3783be10a97d55d483c8 # v2.7.1
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
key: cargo-cli-about

Expand All @@ -177,7 +177,7 @@ jobs:
sed -i.bak 's/\$NAME\$/Bitwarden Secrets Manager CLI/g' THIRDPARTY.html
- name: Upload artifact
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0
uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 # v4.2.0
with:
name: THIRDPARTY.html
path: ./crates/bws/THIRDPARTY.html
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/build-dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Download C# schemas artifact
uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
name: schemas.cs
path: languages/csharp/Bitwarden.Sdk
Expand All @@ -35,25 +35,25 @@ jobs:
global-json-file: languages/csharp/global.json

- name: Download x86_64-apple-darwin files
uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
name: libbitwarden_c_files-x86_64-apple-darwin
path: languages/csharp/Bitwarden.Sdk/macos-x64

- name: Download aarch64-apple-darwin files
uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
name: libbitwarden_c_files-aarch64-apple-darwin
path: languages/csharp/Bitwarden.Sdk/macos-arm64

- name: Download x86_64-unknown-linux-gnu files
uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
name: libbitwarden_c_files-x86_64-unknown-linux-gnu
path: languages/csharp/Bitwarden.Sdk/ubuntu-x64
path: languages/csharp/Bitwarden.Sdk/linux-x64

- name: Download x86_64-pc-windows-msvc files
uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
name: libbitwarden_c_files-x86_64-pc-windows-msvc
path: languages/csharp/Bitwarden.Sdk/windows-x64
Expand All @@ -71,7 +71,7 @@ jobs:
working-directory: languages/csharp/Bitwarden.Sdk

- name: Upload NuGet package
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0
uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 # v4.2.0
with:
name: Bitwarden.Sdk.0.0.1.nupkg
path: |
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/build-java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
workflow_dispatch:

jobs:
generate_schemas:
Expand All @@ -24,7 +25,7 @@ jobs:
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Download Java schemas artifact
uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
name: sdk-schemas-java
path: languages/java/src/main/java/bit/sdk/schema/
Expand All @@ -36,28 +37,28 @@ jobs:
java-version: 17

- name: Download x86_64-apple-darwin files
uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
name: libbitwarden_c_files-x86_64-apple-darwin
path: languages/java/src/main/resources/darwin-x64
path: languages/java/src/main/resources/darwin-x86-64

- name: Download aarch64-apple-darwin files
uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
name: libbitwarden_c_files-aarch64-apple-darwin
path: languages/java/src/main/resources/darwin-aarch64

- name: Download x86_64-unknown-linux-gnu files
uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
name: libbitwarden_c_files-x86_64-unknown-linux-gnu
path: languages/java/src/main/resources/ubuntu-x64
path: languages/java/src/main/resources/linux-x86-64

- name: Download x86_64-pc-windows-msvc files
uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
name: libbitwarden_c_files-x86_64-pc-windows-msvc
path: languages/java/src/main/resources/windows-x64
path: languages/java/src/main/resources/win32-x86-64

- name: Publish Maven
uses: gradle/gradle-build-action@982da8e78c05368c70dac0351bb82647a9e9a5d2 # v2.11.1
Expand Down
Loading

0 comments on commit 819e354

Please sign in to comment.