From 723098022d140eecda6cc71ec40f01e9d4a26965 Mon Sep 17 00:00:00 2001 From: tangowithfoxtrot <5676771+tangowithfoxtrot@users.noreply.github.com> Date: Fri, 10 May 2024 09:26:08 -0700 Subject: [PATCH 1/5] add new targets for Go wrapper --- .../workflows/build-rust-cross-platform.yml | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-rust-cross-platform.yml b/.github/workflows/build-rust-cross-platform.yml index 46b481a65..6c4bb973b 100644 --- a/.github/workflows/build-rust-cross-platform.yml +++ b/.github/workflows/build-rust-cross-platform.yml @@ -19,13 +19,18 @@ jobs: matrix: settings: - os: macos-12 - target: x86_64-apple-darwin - - os: macos-12 - target: aarch64-apple-darwin + target: + - x86_64-apple-darwin + - aarch64-apple-darwin - os: windows-2022 - target: x86_64-pc-windows-msvc + target: + - x86_64-pc-windows-msvc + - x86_64-pc-windows-gnu - os: ubuntu-22.04 - target: x86_64-unknown-linux-gnu + target: + - x86_64-unknown-linux-gnu + - x86_64-unknown-linux-musl + - aarch64-unknown-linux-musl steps: - name: Checkout @@ -39,13 +44,20 @@ jobs: - name: Cache cargo registry uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 + - uses: goto-bus-stop/setup-zig@7ab2955eb728f5440978d5824358023be3a2802d # v2.2.0 + with: + version: 0.12.0 + + - name: Install Zigbuild + run: cargo install cargo-zigbuild --locked --git https://github.com/rust-cross/cargo-zigbuild --rev 6f7e1336c9cd13cf1b3704f93c40fcf84caaed6b # 0.18.4 + - name: Add build architecture run: rustup target add ${{ matrix.settings.target }} - name: Build Rust env: RUSTFLAGS: "-D warnings" - run: cargo build --target ${{ matrix.settings.target }} --release + run: cargo zigbuild --target ${{ matrix.settings.target }} --release - name: Upload Artifact uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 From cc9b278befdcc1e7ab30f9e31f4f23e8d3c98b94 Mon Sep 17 00:00:00 2001 From: tangowithfoxtrot <5676771+tangowithfoxtrot@users.noreply.github.com> Date: Fri, 10 May 2024 09:30:07 -0700 Subject: [PATCH 2/5] fix: 'rustup does not support target 'Array'' --- .../workflows/build-rust-cross-platform.yml | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-rust-cross-platform.yml b/.github/workflows/build-rust-cross-platform.yml index 6c4bb973b..f9095491b 100644 --- a/.github/workflows/build-rust-cross-platform.yml +++ b/.github/workflows/build-rust-cross-platform.yml @@ -19,18 +19,19 @@ jobs: matrix: settings: - os: macos-12 - target: - - x86_64-apple-darwin - - aarch64-apple-darwin + target: x86_64-apple-darwin + - os: macos-12 + target: arch64-apple-darwin + - os: windows-2022 + target: x86_64-pc-windows-msvc - os: windows-2022 - target: - - x86_64-pc-windows-msvc - - x86_64-pc-windows-gnu + target: x86_64-pc-windows-gnu + - os: ubuntu-22.04 + target: x86_64-unknown-linux-gnu + - os: ubuntu-22.04 + target: x86_64-unknown-linux-musl - os: ubuntu-22.04 - target: - - x86_64-unknown-linux-gnu - - x86_64-unknown-linux-musl - - aarch64-unknown-linux-musl + target: aarch64-unknown-linux-musl steps: - name: Checkout From 28473e09ecf623b1b440c1505d203e3c297906f6 Mon Sep 17 00:00:00 2001 From: tangowithfoxtrot <5676771+tangowithfoxtrot@users.noreply.github.com> Date: Fri, 10 May 2024 10:42:47 -0700 Subject: [PATCH 3/5] _just_ build the `bitwarden-c` crate --- .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 f9095491b..6bd785c91 100644 --- a/.github/workflows/build-rust-cross-platform.yml +++ b/.github/workflows/build-rust-cross-platform.yml @@ -58,7 +58,7 @@ jobs: - name: Build Rust env: RUSTFLAGS: "-D warnings" - run: cargo zigbuild --target ${{ matrix.settings.target }} --release + run: cargo zigbuild -p bitwarden-c --target ${{ matrix.settings.target }} --release - name: Upload Artifact uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 From 1eb395af7d5e908195e9ba426246825b0c48ee71 Mon Sep 17 00:00:00 2001 From: tangowithfoxtrot <5676771+tangowithfoxtrot@users.noreply.github.com> Date: Fri, 10 May 2024 11:09:16 -0700 Subject: [PATCH 4/5] fix typo in macOS aarch64 target --- .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 6bd785c91..0923d4648 100644 --- a/.github/workflows/build-rust-cross-platform.yml +++ b/.github/workflows/build-rust-cross-platform.yml @@ -21,7 +21,7 @@ jobs: - os: macos-12 target: x86_64-apple-darwin - os: macos-12 - target: arch64-apple-darwin + target: aarch64-apple-darwin - os: windows-2022 target: x86_64-pc-windows-msvc - os: windows-2022 From 64656556d4280ffcb6a7f4c848cca7129573a1b7 Mon Sep 17 00:00:00 2001 From: tangowithfoxtrot <5676771+tangowithfoxtrot@users.noreply.github.com> Date: Fri, 10 May 2024 13:22:22 -0700 Subject: [PATCH 5/5] separate musl targets from others --- .github/workflows/build-rust-cross-platform.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-rust-cross-platform.yml b/.github/workflows/build-rust-cross-platform.yml index 6bd785c91..dc9d2386f 100644 --- a/.github/workflows/build-rust-cross-platform.yml +++ b/.github/workflows/build-rust-cross-platform.yml @@ -46,20 +46,29 @@ jobs: uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 - uses: goto-bus-stop/setup-zig@7ab2955eb728f5440978d5824358023be3a2802d # v2.2.0 + if: ${{ contains(matrix.settings.target, 'musl') }} with: version: 0.12.0 - name: Install Zigbuild + if: ${{ contains(matrix.settings.target, 'musl') }} run: cargo install cargo-zigbuild --locked --git https://github.com/rust-cross/cargo-zigbuild --rev 6f7e1336c9cd13cf1b3704f93c40fcf84caaed6b # 0.18.4 - name: Add build architecture run: rustup target add ${{ matrix.settings.target }} - - name: Build Rust + - name: Build Rust for - ${{ matrix.settings.target }} + if: ${{ contains(matrix.settings.target, 'musl') }} env: RUSTFLAGS: "-D warnings" run: cargo zigbuild -p bitwarden-c --target ${{ matrix.settings.target }} --release + - name: Build Rust for - ${{ matrix.settings.target }} + if: ${{ !contains(matrix.settings.target, 'musl') }} + env: + RUSTFLAGS: "-D warnings" + run: cargo build -p bitwarden-c --target ${{ matrix.settings.target }} --release + - name: Upload Artifact uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: