From bd96e79b4445cb7b2afef7577f47df9278529463 Mon Sep 17 00:00:00 2001 From: Michal Checinski Date: Fri, 1 Mar 2024 16:42:37 +0100 Subject: [PATCH 01/23] Change go module name --- languages/go/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages/go/go.mod b/languages/go/go.mod index a9e125453..c36872163 100644 --- a/languages/go/go.mod +++ b/languages/go/go.mod @@ -1,4 +1,4 @@ -module github.com/bitwarden/sdk/languages/go +module github.com/bitwarden/sm-sdk-go go 1.18 From ae7ea7a7513269376a8d757196e80f442b1bfe4d Mon Sep 17 00:00:00 2001 From: Michal Checinski Date: Fri, 1 Mar 2024 16:42:54 +0100 Subject: [PATCH 02/23] Add precompiled C packages --- .github/workflows/release-go.yml | 50 ++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/.github/workflows/release-go.yml b/.github/workflows/release-go.yml index b9ff394be..e50e3e644 100644 --- a/.github/workflows/release-go.yml +++ b/.github/workflows/release-go.yml @@ -58,6 +58,56 @@ jobs: with: path: sdk + - name: Download x86_64-apple-darwin artifact + uses: bitwarden/gh-actions/download-artifacts@main + with: + workflow: build-rust-cross-platform.yml + path: temp/macos-x64 + workflow_conclusion: success + branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + artifacts: libbitwarden_c_files-x86_64-apple-darwin + + - name: Download aarch64-apple-darwin artifact + uses: bitwarden/gh-actions/download-artifacts@main + with: + workflow: build-rust-cross-platform.yml + workflow_conclusion: success + branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + artifacts: libbitwarden_c_files-aarch64-apple-darwin + path: temp/macos-arm64 + + - name: Download x86_64-unknown-linux-gnu artifact + uses: bitwarden/gh-actions/download-artifacts@main + with: + workflow: build-rust-cross-platform.yml + workflow_conclusion: success + branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + artifacts: libbitwarden_c_files-x86_64-unknown-linux-gnu + path: temp/linux-x64 + + - name: Download x86_64-pc-windows-msvc artifact + uses: bitwarden/gh-actions/download-artifacts@main + with: + workflow: build-rust-cross-platform.yml + workflow_conclusion: success + branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + artifacts: libbitwarden_c_files-x86_64-pc-windows-msvc + path: temp/windows-x64 + + - name: Copy lib files + run: | + mkdir -p languages/go/bitwarden_sdk_secrets/lib/macos-arm64 + mkdir -p languages/go/bitwarden_sdk_secrets/lib/linux-x64 + mkdir -p languages/go/bitwarden_sdk_secrets/lib/macos-x64 + mkdir -p languages/go/bitwarden_sdk_secrets/lib/windows-x64 + + platforms=("macos-arm64" "linux-x64" "macos-x64" "windows-x64") + files=("libbitwarden_c.dylib" "libbitwarden_c.so" "libbitwarden_c.dylib" "bitwarden_c.dll") + + for ((i=0; i<${#platforms[@]}; i++)); do + cp "temp/${platforms[$i]}/${files[$i]}" "languages/go/bitwarden_sdk_secrets/lib/${platforms[$i]}/${files[$i]}" + done + - name: Login to Azure - Prod Subscription uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 with: From 55154c07074281a55e79e0f44c502be54a5cf51c Mon Sep 17 00:00:00 2001 From: Michal Checinski Date: Fri, 1 Mar 2024 16:44:55 +0100 Subject: [PATCH 03/23] Comment out sync to the external repo for dry run --- .github/workflows/release-go.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release-go.yml b/.github/workflows/release-go.yml index e50e3e644..eccb615bc 100644 --- a/.github/workflows/release-go.yml +++ b/.github/workflows/release-go.yml @@ -145,15 +145,15 @@ jobs: git add . git commit -m "Update Go SDK to ${{ github.sha }}" - if [[ "${{ github.event.inputs.release_type }}" == "Dry Run" ]]; then - echo "===================================" - echo "[!] Dry Run - Skipping push" - echo "===================================" - git ls-files -m - exit 0 - else + # if [[ "${{ github.event.inputs.release_type }}" == "Dry Run" ]]; then + # echo "===================================" + # echo "[!] Dry Run - Skipping push" + # echo "===================================" + # git ls-files -m + # exit 0 + # else git push origin main - fi + # fi - name: Create release tag on SDK Go repo if: ${{ github.event.inputs.release_type != 'Dry Run' }} From 6665bfa87c0dfcdfb23d9a754b58c1536a89505e Mon Sep 17 00:00:00 2001 From: Michal Checinski Date: Fri, 1 Mar 2024 16:57:17 +0100 Subject: [PATCH 04/23] Add linux arm64 target --- .github/workflows/build-rust-cross-platform.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build-rust-cross-platform.yml b/.github/workflows/build-rust-cross-platform.yml index 67c41c6f9..3f20a842f 100644 --- a/.github/workflows/build-rust-cross-platform.yml +++ b/.github/workflows/build-rust-cross-platform.yml @@ -8,6 +8,7 @@ on: - main - rc - hotfix-rc + pull_request: jobs: build_rust: @@ -25,6 +26,8 @@ jobs: target: x86_64-pc-windows-msvc - os: ubuntu-22.04 target: x86_64-unknown-linux-gnu + - os: ubuntu-22.04 + target: arm64-unknown-linux-gnu steps: - name: Checkout From de20e4dc020c608d07a9cf3eff5a32d7f64d476b Mon Sep 17 00:00:00 2001 From: Michal Checinski Date: Fri, 1 Mar 2024 16:57:30 +0100 Subject: [PATCH 05/23] Download schemas artifact --- .github/workflows/release-go.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-go.yml b/.github/workflows/release-go.yml index eccb615bc..395774555 100644 --- a/.github/workflows/release-go.yml +++ b/.github/workflows/release-go.yml @@ -58,6 +58,15 @@ jobs: with: path: sdk + - name: Download artifacts + uses: bitwarden/gh-actions/download-artifacts@main + with: + workflow: generate_schemas.yml + path: languages/go/bitwarden_sdk_secrets/lib + workflow_conclusion: success + branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + artifacts: schemas.go + - name: Download x86_64-apple-darwin artifact uses: bitwarden/gh-actions/download-artifacts@main with: @@ -85,6 +94,15 @@ jobs: artifacts: libbitwarden_c_files-x86_64-unknown-linux-gnu path: temp/linux-x64 + - name: Download arm64-unknown-linux-gnu artifact + uses: bitwarden/gh-actions/download-artifacts@main + with: + workflow: build-rust-cross-platform.yml + workflow_conclusion: success + branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + artifacts: libbitwarden_c_files-arm64-unknown-linux-gnu + path: temp/linux-arm64 + - name: Download x86_64-pc-windows-msvc artifact uses: bitwarden/gh-actions/download-artifacts@main with: @@ -100,8 +118,9 @@ jobs: mkdir -p languages/go/bitwarden_sdk_secrets/lib/linux-x64 mkdir -p languages/go/bitwarden_sdk_secrets/lib/macos-x64 mkdir -p languages/go/bitwarden_sdk_secrets/lib/windows-x64 + mkdir -p languages/go/bitwarden_sdk_secrets/lib/linux-arm64 - platforms=("macos-arm64" "linux-x64" "macos-x64" "windows-x64") + platforms=("macos-arm64" "linux-x64" "linux-arm64" "macos-x64" "windows-x64") files=("libbitwarden_c.dylib" "libbitwarden_c.so" "libbitwarden_c.dylib" "bitwarden_c.dll") for ((i=0; i<${#platforms[@]}; i++)); do From bd59d6d4a23c75886345487a52233eca98c83128 Mon Sep 17 00:00:00 2001 From: Michal Checinski Date: Fri, 1 Mar 2024 16:58:15 +0100 Subject: [PATCH 06/23] Comment for testing --- .github/workflows/release-go.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release-go.yml b/.github/workflows/release-go.yml index 395774555..63241e1af 100644 --- a/.github/workflows/release-go.yml +++ b/.github/workflows/release-go.yml @@ -94,14 +94,14 @@ jobs: artifacts: libbitwarden_c_files-x86_64-unknown-linux-gnu path: temp/linux-x64 - - name: Download arm64-unknown-linux-gnu artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: libbitwarden_c_files-arm64-unknown-linux-gnu - path: temp/linux-arm64 + # - name: Download arm64-unknown-linux-gnu artifact + # uses: bitwarden/gh-actions/download-artifacts@main + # with: + # workflow: build-rust-cross-platform.yml + # workflow_conclusion: success + # branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + # artifacts: libbitwarden_c_files-arm64-unknown-linux-gnu + # path: temp/linux-arm64 - name: Download x86_64-pc-windows-msvc artifact uses: bitwarden/gh-actions/download-artifacts@main @@ -120,7 +120,7 @@ jobs: mkdir -p languages/go/bitwarden_sdk_secrets/lib/windows-x64 mkdir -p languages/go/bitwarden_sdk_secrets/lib/linux-arm64 - platforms=("macos-arm64" "linux-x64" "linux-arm64" "macos-x64" "windows-x64") + platforms=("macos-arm64" "linux-x64" "macos-x64" "windows-x64") # "linux-arm64" files=("libbitwarden_c.dylib" "libbitwarden_c.so" "libbitwarden_c.dylib" "bitwarden_c.dll") for ((i=0; i<${#platforms[@]}; i++)); do From 2304096be049c4091f3ed733e1663618caeb7e18 Mon Sep 17 00:00:00 2001 From: Michal Checinski Date: Fri, 1 Mar 2024 17:05:50 +0100 Subject: [PATCH 07/23] Fix --- .github/workflows/release-go.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release-go.yml b/.github/workflows/release-go.yml index 223b779a8..434c3280d 100644 --- a/.github/workflows/release-go.yml +++ b/.github/workflows/release-go.yml @@ -114,17 +114,17 @@ jobs: - name: Copy lib files run: | - mkdir -p languages/go/bitwarden_sdk_secrets/lib/macos-arm64 - mkdir -p languages/go/bitwarden_sdk_secrets/lib/linux-x64 - mkdir -p languages/go/bitwarden_sdk_secrets/lib/macos-x64 - mkdir -p languages/go/bitwarden_sdk_secrets/lib/windows-x64 - mkdir -p languages/go/bitwarden_sdk_secrets/lib/linux-arm64 + mkdir -p sdk/languages/go/bitwarden_sdk_secrets/lib/macos-arm64 + mkdir -p sdk/languages/go/bitwarden_sdk_secrets/lib/linux-x64 + mkdir -p sdk/languages/go/bitwarden_sdk_secrets/lib/macos-x64 + mkdir -p sdk/languages/go/bitwarden_sdk_secrets/lib/windows-x64 + mkdir -p sdk/languages/go/bitwarden_sdk_secrets/lib/linux-arm64 platforms=("macos-arm64" "linux-x64" "macos-x64" "windows-x64") # "linux-arm64" files=("libbitwarden_c.dylib" "libbitwarden_c.so" "libbitwarden_c.dylib" "bitwarden_c.dll") for ((i=0; i<${#platforms[@]}; i++)); do - cp "temp/${platforms[$i]}/${files[$i]}" "languages/go/bitwarden_sdk_secrets/lib/${platforms[$i]}/${files[$i]}" + cp "temp/${platforms[$i]}/${files[$i]}" "sdk/languages/go/bitwarden_sdk_secrets/lib/${platforms[$i]}/${files[$i]}" done - name: Login to Azure - Prod Subscription From cac8d7050f87d240a656baaddedff7f2bf70d9b8 Mon Sep 17 00:00:00 2001 From: Michal Checinski Date: Fri, 1 Mar 2024 17:08:23 +0100 Subject: [PATCH 08/23] Fix --- .github/workflows/release-go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-go.yml b/.github/workflows/release-go.yml index 434c3280d..01e9e98ef 100644 --- a/.github/workflows/release-go.yml +++ b/.github/workflows/release-go.yml @@ -62,7 +62,7 @@ jobs: uses: bitwarden/gh-actions/download-artifacts@main with: workflow: generate_schemas.yml - path: languages/go/bitwarden_sdk_secrets/lib + path: sdk/languages/go/bitwarden_sdk_secrets/lib workflow_conclusion: success branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} artifacts: schemas.go From 942b8cf85bbe4ed849e0f1eabb673cd00d964e8d Mon Sep 17 00:00:00 2001 From: Michal Checinski Date: Fri, 1 Mar 2024 17:16:35 +0100 Subject: [PATCH 09/23] Fix --- .github/workflows/release-go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-go.yml b/.github/workflows/release-go.yml index 01e9e98ef..2d5890270 100644 --- a/.github/workflows/release-go.yml +++ b/.github/workflows/release-go.yml @@ -175,7 +175,7 @@ jobs: # fi - name: Create release tag on SDK Go repo - if: ${{ github.event.inputs.release_type != 'Dry Run' }} + # if: ${{ github.event.inputs.release_type != 'Dry Run' }} working-directory: sm-sdk-go run: | # Check if tag exists, set output then exit 0 if true. From 1fb081f7db56e4ae1ccd527edfce4cfda015099e Mon Sep 17 00:00:00 2001 From: Michal Checinski Date: Fri, 1 Mar 2024 17:23:45 +0100 Subject: [PATCH 10/23] Download linux arm64 release from current branch --- .github/workflows/release-go.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release-go.yml b/.github/workflows/release-go.yml index 2d5890270..cfbe41939 100644 --- a/.github/workflows/release-go.yml +++ b/.github/workflows/release-go.yml @@ -94,14 +94,15 @@ jobs: artifacts: libbitwarden_c_files-x86_64-unknown-linux-gnu path: temp/linux-x64 - # - name: Download arm64-unknown-linux-gnu artifact - # uses: bitwarden/gh-actions/download-artifacts@main - # with: - # workflow: build-rust-cross-platform.yml - # workflow_conclusion: success - # branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - # artifacts: libbitwarden_c_files-arm64-unknown-linux-gnu - # path: temp/linux-arm64 + - name: Download arm64-unknown-linux-gnu artifact + uses: bitwarden/gh-actions/download-artifacts@main + with: + workflow: build-rust-cross-platform.yml + workflow_conclusion: success + # branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + branch: DEVOPS-1750-fix-go-release + artifacts: libbitwarden_c_files-arm64-unknown-linux-gnu + path: temp/linux-arm64 - name: Download x86_64-pc-windows-msvc artifact uses: bitwarden/gh-actions/download-artifacts@main @@ -120,7 +121,7 @@ jobs: mkdir -p sdk/languages/go/bitwarden_sdk_secrets/lib/windows-x64 mkdir -p sdk/languages/go/bitwarden_sdk_secrets/lib/linux-arm64 - platforms=("macos-arm64" "linux-x64" "macos-x64" "windows-x64") # "linux-arm64" + platforms=("macos-arm64" "linux-x64" "linux-arm64" "macos-x64" "windows-x64") files=("libbitwarden_c.dylib" "libbitwarden_c.so" "libbitwarden_c.dylib" "bitwarden_c.dll") for ((i=0; i<${#platforms[@]}; i++)); do From 64fe83fb90b00296444371226cdf529379431369 Mon Sep 17 00:00:00 2001 From: Michal Checinski Date: Fri, 1 Mar 2024 19:08:33 +0100 Subject: [PATCH 11/23] Fix --- .github/workflows/build-rust-cross-platform.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-rust-cross-platform.yml b/.github/workflows/build-rust-cross-platform.yml index 3f20a842f..f1b9ff774 100644 --- a/.github/workflows/build-rust-cross-platform.yml +++ b/.github/workflows/build-rust-cross-platform.yml @@ -27,7 +27,7 @@ jobs: - os: ubuntu-22.04 target: x86_64-unknown-linux-gnu - os: ubuntu-22.04 - target: arm64-unknown-linux-gnu + target: aarch64-unknown-linux-gnu steps: - name: Checkout From 0fffee86a7e20164da489c0829a37e74b27b607e Mon Sep 17 00:00:00 2001 From: Michal Checinski Date: Fri, 1 Mar 2024 19:09:36 +0100 Subject: [PATCH 12/23] Remove testing values --- .github/workflows/release-go.yml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release-go.yml b/.github/workflows/release-go.yml index cfbe41939..a8324014f 100644 --- a/.github/workflows/release-go.yml +++ b/.github/workflows/release-go.yml @@ -99,8 +99,7 @@ jobs: with: workflow: build-rust-cross-platform.yml workflow_conclusion: success - # branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - branch: DEVOPS-1750-fix-go-release + branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} artifacts: libbitwarden_c_files-arm64-unknown-linux-gnu path: temp/linux-arm64 @@ -165,18 +164,18 @@ jobs: git add . git commit -m "Update Go SDK to ${{ github.sha }}" - # if [[ "${{ github.event.inputs.release_type }}" == "Dry Run" ]]; then - # echo "===================================" - # echo "[!] Dry Run - Skipping push" - # echo "===================================" - # git ls-files -m - # exit 0 - # else + if [[ "${{ github.event.inputs.release_type }}" == "Dry Run" ]]; then + echo "===================================" + echo "[!] Dry Run - Skipping push" + echo "===================================" + git ls-files -m + exit 0 + else git push origin main - # fi + fi - name: Create release tag on SDK Go repo - # if: ${{ github.event.inputs.release_type != 'Dry Run' }} + if: ${{ github.event.inputs.release_type != 'Dry Run' }} working-directory: sm-sdk-go run: | # Check if tag exists, set output then exit 0 if true. From 4b4b9cc26223119b76949cb5e7a4092cb4257dee Mon Sep 17 00:00:00 2001 From: Michal Checinski Date: Fri, 1 Mar 2024 19:16:44 +0100 Subject: [PATCH 13/23] Replace repo name --- .github/workflows/release-go.yml | 6 ++++++ languages/go/go.mod | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-go.yml b/.github/workflows/release-go.yml index a8324014f..377f6b2b9 100644 --- a/.github/workflows/release-go.yml +++ b/.github/workflows/release-go.yml @@ -158,6 +158,12 @@ jobs: # Copy files to local sm-sdk-go repo path cp --verbose -rf sdk/languages/go/. sm-sdk-go + - name: Replace repo name + working-directory: sm-sdk-go + run: | + find . -name '*' -exec \ + gsed -i -e 's/github.com\/bitwarden\/sdk\/languages\/go/github.com\/bitwarden\/sm-sdk-go/g' {} \; + - name: Push changes working-directory: sm-sdk-go run: | diff --git a/languages/go/go.mod b/languages/go/go.mod index c36872163..a9e125453 100644 --- a/languages/go/go.mod +++ b/languages/go/go.mod @@ -1,4 +1,4 @@ -module github.com/bitwarden/sm-sdk-go +module github.com/bitwarden/sdk/languages/go go 1.18 From 3640a0f8fbcc6834a29cf7527696bc1d05974731 Mon Sep 17 00:00:00 2001 From: Michal Checinski Date: Mon, 4 Mar 2024 18:43:05 +0100 Subject: [PATCH 14/23] Install gcc-aarch64-linux-gnu --- .github/workflows/build-rust-cross-platform.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build-rust-cross-platform.yml b/.github/workflows/build-rust-cross-platform.yml index f1b9ff774..e42082cd8 100644 --- a/.github/workflows/build-rust-cross-platform.yml +++ b/.github/workflows/build-rust-cross-platform.yml @@ -41,6 +41,10 @@ jobs: - name: Cache cargo registry uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 + - name: Install gcc-aarch64-linux-gnu + if: matrix.settings.target == 'aarch64-unknown-linux-gnu' + run: sudo apt-get install gcc-aarch64-linux-gnu + - name: Add build architecture run: rustup target add ${{ matrix.settings.target }} From b42cfe8dedaa3f84152d29def232a5e60bc57d25 Mon Sep 17 00:00:00 2001 From: Michal Checinski Date: Mon, 4 Mar 2024 19:21:24 +0100 Subject: [PATCH 15/23] Comment out aarch64 linux build --- .github/workflows/build-rust-cross-platform.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-rust-cross-platform.yml b/.github/workflows/build-rust-cross-platform.yml index e42082cd8..7bb64f09d 100644 --- a/.github/workflows/build-rust-cross-platform.yml +++ b/.github/workflows/build-rust-cross-platform.yml @@ -26,8 +26,8 @@ jobs: 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 + # - os: ubuntu-22.04 + # target: aarch64-unknown-linux-gnu steps: - name: Checkout From 5f368bc858be64a130daa546c60bd40a1ac11bcb Mon Sep 17 00:00:00 2001 From: Michal Checinski Date: Tue, 5 Mar 2024 11:31:49 +0100 Subject: [PATCH 16/23] Comment out linux arm64 --- .github/workflows/release-go.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release-go.yml b/.github/workflows/release-go.yml index 377f6b2b9..3afbea252 100644 --- a/.github/workflows/release-go.yml +++ b/.github/workflows/release-go.yml @@ -94,14 +94,14 @@ jobs: artifacts: libbitwarden_c_files-x86_64-unknown-linux-gnu path: temp/linux-x64 - - name: Download arm64-unknown-linux-gnu artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: libbitwarden_c_files-arm64-unknown-linux-gnu - path: temp/linux-arm64 + # - name: Download arm64-unknown-linux-gnu artifact + # uses: bitwarden/gh-actions/download-artifacts@main + # with: + # workflow: build-rust-cross-platform.yml + # workflow_conclusion: success + # branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + # artifacts: libbitwarden_c_files-arm64-unknown-linux-gnu + # path: temp/linux-arm64 - name: Download x86_64-pc-windows-msvc artifact uses: bitwarden/gh-actions/download-artifacts@main @@ -118,9 +118,9 @@ jobs: mkdir -p sdk/languages/go/bitwarden_sdk_secrets/lib/linux-x64 mkdir -p sdk/languages/go/bitwarden_sdk_secrets/lib/macos-x64 mkdir -p sdk/languages/go/bitwarden_sdk_secrets/lib/windows-x64 - mkdir -p sdk/languages/go/bitwarden_sdk_secrets/lib/linux-arm64 + # mkdir -p sdk/languages/go/bitwarden_sdk_secrets/lib/linux-arm64 - platforms=("macos-arm64" "linux-x64" "linux-arm64" "macos-x64" "windows-x64") + platforms=("macos-arm64" "linux-x64" "macos-x64" "windows-x64") # "linux-arm64" files=("libbitwarden_c.dylib" "libbitwarden_c.so" "libbitwarden_c.dylib" "bitwarden_c.dll") for ((i=0; i<${#platforms[@]}; i++)); do From 0da0223ba65aef22a16ff8ce6855ce33655d4ca1 Mon Sep 17 00:00:00 2001 From: Michal Checinski Date: Fri, 8 Mar 2024 13:08:22 +0100 Subject: [PATCH 17/23] Uncomment aarch64 linux --- .github/workflows/build-rust-cross-platform.yml | 4 ++-- .github/workflows/release-go.yml | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-rust-cross-platform.yml b/.github/workflows/build-rust-cross-platform.yml index 7bb64f09d..e42082cd8 100644 --- a/.github/workflows/build-rust-cross-platform.yml +++ b/.github/workflows/build-rust-cross-platform.yml @@ -26,8 +26,8 @@ jobs: 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 + - os: ubuntu-22.04 + target: aarch64-unknown-linux-gnu steps: - name: Checkout diff --git a/.github/workflows/release-go.yml b/.github/workflows/release-go.yml index 3afbea252..5aa63ac57 100644 --- a/.github/workflows/release-go.yml +++ b/.github/workflows/release-go.yml @@ -94,14 +94,14 @@ jobs: artifacts: libbitwarden_c_files-x86_64-unknown-linux-gnu path: temp/linux-x64 - # - name: Download arm64-unknown-linux-gnu artifact - # uses: bitwarden/gh-actions/download-artifacts@main - # with: - # workflow: build-rust-cross-platform.yml - # workflow_conclusion: success - # branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - # artifacts: libbitwarden_c_files-arm64-unknown-linux-gnu - # path: temp/linux-arm64 + - name: Download arm64-unknown-linux-gnu artifact + uses: bitwarden/gh-actions/download-artifacts@main + with: + workflow: build-rust-cross-platform.yml + workflow_conclusion: success + branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + artifacts: libbitwarden_c_files-arm64-unknown-linux-gnu + path: temp/linux-arm64 - name: Download x86_64-pc-windows-msvc artifact uses: bitwarden/gh-actions/download-artifacts@main From 4ba442d42248f7a36375badb2f673e9f552a19ad Mon Sep 17 00:00:00 2001 From: Michal Checinski Date: Mon, 11 Mar 2024 15:22:10 +0100 Subject: [PATCH 18/23] COmment for not working --- .github/workflows/release-go.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release-go.yml b/.github/workflows/release-go.yml index 5aa63ac57..3afbea252 100644 --- a/.github/workflows/release-go.yml +++ b/.github/workflows/release-go.yml @@ -94,14 +94,14 @@ jobs: artifacts: libbitwarden_c_files-x86_64-unknown-linux-gnu path: temp/linux-x64 - - name: Download arm64-unknown-linux-gnu artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: libbitwarden_c_files-arm64-unknown-linux-gnu - path: temp/linux-arm64 + # - name: Download arm64-unknown-linux-gnu artifact + # uses: bitwarden/gh-actions/download-artifacts@main + # with: + # workflow: build-rust-cross-platform.yml + # workflow_conclusion: success + # branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + # artifacts: libbitwarden_c_files-arm64-unknown-linux-gnu + # path: temp/linux-arm64 - name: Download x86_64-pc-windows-msvc artifact uses: bitwarden/gh-actions/download-artifacts@main From 4ddcfb6b47f33af6963d1cb3de46affd1d982f94 Mon Sep 17 00:00:00 2001 From: Michal Checinski Date: Mon, 11 Mar 2024 16:09:27 +0100 Subject: [PATCH 19/23] Release --- .github/workflows/release-go.yml | 116 +++++++++++++++---------------- 1 file changed, 56 insertions(+), 60 deletions(-) diff --git a/.github/workflows/release-go.yml b/.github/workflows/release-go.yml index 3afbea252..66a13e530 100644 --- a/.github/workflows/release-go.yml +++ b/.github/workflows/release-go.yml @@ -67,66 +67,6 @@ jobs: branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} artifacts: schemas.go - - name: Download x86_64-apple-darwin artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - path: temp/macos-x64 - workflow_conclusion: success - branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: libbitwarden_c_files-x86_64-apple-darwin - - - name: Download aarch64-apple-darwin artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: libbitwarden_c_files-aarch64-apple-darwin - path: temp/macos-arm64 - - - name: Download x86_64-unknown-linux-gnu artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: libbitwarden_c_files-x86_64-unknown-linux-gnu - path: temp/linux-x64 - - # - name: Download arm64-unknown-linux-gnu artifact - # uses: bitwarden/gh-actions/download-artifacts@main - # with: - # workflow: build-rust-cross-platform.yml - # workflow_conclusion: success - # branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - # artifacts: libbitwarden_c_files-arm64-unknown-linux-gnu - # path: temp/linux-arm64 - - - name: Download x86_64-pc-windows-msvc artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: libbitwarden_c_files-x86_64-pc-windows-msvc - path: temp/windows-x64 - - - name: Copy lib files - run: | - mkdir -p sdk/languages/go/bitwarden_sdk_secrets/lib/macos-arm64 - mkdir -p sdk/languages/go/bitwarden_sdk_secrets/lib/linux-x64 - mkdir -p sdk/languages/go/bitwarden_sdk_secrets/lib/macos-x64 - mkdir -p sdk/languages/go/bitwarden_sdk_secrets/lib/windows-x64 - # mkdir -p sdk/languages/go/bitwarden_sdk_secrets/lib/linux-arm64 - - platforms=("macos-arm64" "linux-x64" "macos-x64" "windows-x64") # "linux-arm64" - files=("libbitwarden_c.dylib" "libbitwarden_c.so" "libbitwarden_c.dylib" "bitwarden_c.dll") - - for ((i=0; i<${#platforms[@]}; i++)); do - cp "temp/${platforms[$i]}/${files[$i]}" "sdk/languages/go/bitwarden_sdk_secrets/lib/${platforms[$i]}/${files[$i]}" - done - - name: Login to Azure - Prod Subscription uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 with: @@ -216,6 +156,58 @@ jobs: keyvault: ${{ env._KEY_VAULT }} secrets: "github-pat-bitwarden-devops-bot-repo-scope" + - name: Download x86_64-apple-darwin artifact + uses: bitwarden/gh-actions/download-artifacts@main + with: + workflow: build-rust-cross-platform.yml + workflow_conclusion: success + branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + artifacts: libbitwarden_c_files-x86_64-apple-darwin + skip_unpack: true + + - name: Download aarch64-apple-darwin artifact + uses: bitwarden/gh-actions/download-artifacts@main + with: + workflow: build-rust-cross-platform.yml + workflow_conclusion: success + branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + artifacts: libbitwarden_c_files-aarch64-apple-darwin + skip_unpack: true + + - name: Download x86_64-unknown-linux-gnu artifact + uses: bitwarden/gh-actions/download-artifacts@main + with: + workflow: build-rust-cross-platform.yml + workflow_conclusion: success + branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + artifacts: libbitwarden_c_files-x86_64-unknown-linux-gnu + skip_unpack: true + + # - name: Download arm64-unknown-linux-gnu artifact + # uses: bitwarden/gh-actions/download-artifacts@main + # with: + # workflow: build-rust-cross-platform.yml + # workflow_conclusion: success + # branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + # artifacts: libbitwarden_c_files-arm64-unknown-linux-gnu + + - name: Download x86_64-pc-windows-msvc artifact + uses: bitwarden/gh-actions/download-artifacts@main + with: + workflow: build-rust-cross-platform.yml + workflow_conclusion: success + branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + artifacts: libbitwarden_c_files-x86_64-pc-windows-msvc + skip_unpack: true + + - name: Rename build artifacts + run: | + ls -lR + mv libbitwarden_c_files-x86_64-apple-darwin.zip libbitwarden_c_files-x86_64-apple-darwin-$_PKG_VERSION.zip + mv libbitwarden_c_files-aarch64-apple-darwin.zip libbitwarden_c_files-aarch64-apple-darwin-$_PKG_VERSION.zip + mv libbitwarden_c_files-x86_64-unknown-linux-gnu.zip libbitwarden_c_files-x86_64-unknown-linux-gnu-$_PKG_VERSION.zip + mv libbitwarden_c_files-x86_64-pc-windows-msvc.zip libbitwarden_c_files-x86_64-pc-windows-msvc-$_PKG_VERSION.zip + - name: Create release if: ${{ github.event.inputs.release_type != 'Dry Run' }} uses: ncipollo/release-action@6c75be85e571768fa31b40abf38de58ba0397db5 # v1.13.0 @@ -227,3 +219,7 @@ jobs: draft: true repo: sm-sdk-go owner: bitwarden + artifacts: "libbitwarden_c_files-x86_64-apple-darwin-$_PKG_VERSION.zip, + libbitwarden_c_files-aarch64-apple-darwin-$_PKG_VERSION.zip, + libbitwarden_c_files-x86_64-unknown-linux-gnu-$_PKG_VERSION.zip, + libbitwarden_c_files-x86_64-pc-windows-msvc-$_PKG_VERSION.zip" From 16fe3784cab99fdbabd1e0ccaae5e25572db81c8 Mon Sep 17 00:00:00 2001 From: Michal Checinski Date: Mon, 11 Mar 2024 16:47:59 +0100 Subject: [PATCH 20/23] Remove linux arm64 build - we need arm runner for that --- .github/workflows/build-rust-cross-platform.yml | 6 ------ .github/workflows/release-go.yml | 8 -------- 2 files changed, 14 deletions(-) diff --git a/.github/workflows/build-rust-cross-platform.yml b/.github/workflows/build-rust-cross-platform.yml index e42082cd8..0db2d0cde 100644 --- a/.github/workflows/build-rust-cross-platform.yml +++ b/.github/workflows/build-rust-cross-platform.yml @@ -26,8 +26,6 @@ jobs: 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 @@ -41,10 +39,6 @@ jobs: - name: Cache cargo registry uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 - - name: Install gcc-aarch64-linux-gnu - if: matrix.settings.target == 'aarch64-unknown-linux-gnu' - run: sudo apt-get install gcc-aarch64-linux-gnu - - name: Add build architecture run: rustup target add ${{ matrix.settings.target }} diff --git a/.github/workflows/release-go.yml b/.github/workflows/release-go.yml index 66a13e530..32fa5d897 100644 --- a/.github/workflows/release-go.yml +++ b/.github/workflows/release-go.yml @@ -183,14 +183,6 @@ jobs: artifacts: libbitwarden_c_files-x86_64-unknown-linux-gnu skip_unpack: true - # - name: Download arm64-unknown-linux-gnu artifact - # uses: bitwarden/gh-actions/download-artifacts@main - # with: - # workflow: build-rust-cross-platform.yml - # workflow_conclusion: success - # branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - # artifacts: libbitwarden_c_files-arm64-unknown-linux-gnu - - name: Download x86_64-pc-windows-msvc artifact uses: bitwarden/gh-actions/download-artifacts@main with: From e1de9197f0c262de2e04a5a7c4f0f8464212e214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ch=C4=99ci=C5=84ski?= Date: Mon, 11 Mar 2024 16:48:20 +0100 Subject: [PATCH 21/23] Update .github/workflows/release-go.yml Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> --- .github/workflows/release-go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-go.yml b/.github/workflows/release-go.yml index 32fa5d897..2320a9ba3 100644 --- a/.github/workflows/release-go.yml +++ b/.github/workflows/release-go.yml @@ -64,7 +64,7 @@ jobs: workflow: generate_schemas.yml path: sdk/languages/go/bitwarden_sdk_secrets/lib workflow_conclusion: success - branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} artifacts: schemas.go - name: Login to Azure - Prod Subscription From 9518e1cdae0ee77deba46e28a1d4a4e44f935b7c Mon Sep 17 00:00:00 2001 From: Michal Checinski Date: Mon, 11 Mar 2024 16:48:59 +0100 Subject: [PATCH 22/23] Fix --- .github/workflows/release-go.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release-go.yml b/.github/workflows/release-go.yml index 32fa5d897..4950168c9 100644 --- a/.github/workflows/release-go.yml +++ b/.github/workflows/release-go.yml @@ -29,7 +29,7 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Branch check - if: ${{ github.event.inputs.release_type != 'Dry Run' }} + if: ${{ inputs.release_type != 'Dry Run' }} run: | if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then echo "===================================" @@ -64,7 +64,7 @@ jobs: workflow: generate_schemas.yml path: sdk/languages/go/bitwarden_sdk_secrets/lib workflow_conclusion: success - branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} artifacts: schemas.go - name: Login to Azure - Prod Subscription @@ -110,7 +110,7 @@ jobs: git add . git commit -m "Update Go SDK to ${{ github.sha }}" - if [[ "${{ github.event.inputs.release_type }}" == "Dry Run" ]]; then + if [[ "${{ inputs.release_type }}" == "Dry Run" ]]; then echo "===================================" echo "[!] Dry Run - Skipping push" echo "===================================" @@ -121,7 +121,7 @@ jobs: fi - name: Create release tag on SDK Go repo - if: ${{ github.event.inputs.release_type != 'Dry Run' }} + if: ${{ inputs.release_type != 'Dry Run' }} working-directory: sm-sdk-go run: | # Check if tag exists, set output then exit 0 if true. @@ -161,7 +161,7 @@ jobs: with: workflow: build-rust-cross-platform.yml workflow_conclusion: success - branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} artifacts: libbitwarden_c_files-x86_64-apple-darwin skip_unpack: true @@ -170,7 +170,7 @@ jobs: with: workflow: build-rust-cross-platform.yml workflow_conclusion: success - branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} artifacts: libbitwarden_c_files-aarch64-apple-darwin skip_unpack: true @@ -179,7 +179,7 @@ jobs: with: workflow: build-rust-cross-platform.yml workflow_conclusion: success - branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} artifacts: libbitwarden_c_files-x86_64-unknown-linux-gnu skip_unpack: true @@ -188,7 +188,7 @@ jobs: with: workflow: build-rust-cross-platform.yml workflow_conclusion: success - branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} artifacts: libbitwarden_c_files-x86_64-pc-windows-msvc skip_unpack: true @@ -201,7 +201,7 @@ jobs: mv libbitwarden_c_files-x86_64-pc-windows-msvc.zip libbitwarden_c_files-x86_64-pc-windows-msvc-$_PKG_VERSION.zip - name: Create release - if: ${{ github.event.inputs.release_type != 'Dry Run' }} + if: ${{ inputs.release_type != 'Dry Run' }} uses: ncipollo/release-action@6c75be85e571768fa31b40abf38de58ba0397db5 # v1.13.0 with: tag: v${{ env._PKG_VERSION }} From 997221b61bcfbfcefef9293d75cec4eca25b9ae7 Mon Sep 17 00:00:00 2001 From: Michal Checinski Date: Mon, 11 Mar 2024 16:59:17 +0100 Subject: [PATCH 23/23] Remove ls --- .github/workflows/release-go.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release-go.yml b/.github/workflows/release-go.yml index 4950168c9..c35826be0 100644 --- a/.github/workflows/release-go.yml +++ b/.github/workflows/release-go.yml @@ -194,7 +194,6 @@ jobs: - name: Rename build artifacts run: | - ls -lR mv libbitwarden_c_files-x86_64-apple-darwin.zip libbitwarden_c_files-x86_64-apple-darwin-$_PKG_VERSION.zip mv libbitwarden_c_files-aarch64-apple-darwin.zip libbitwarden_c_files-aarch64-apple-darwin-$_PKG_VERSION.zip mv libbitwarden_c_files-x86_64-unknown-linux-gnu.zip libbitwarden_c_files-x86_64-unknown-linux-gnu-$_PKG_VERSION.zip