From d64b51f5611908bdb27bbb2accb83701b5d7c6bf Mon Sep 17 00:00:00 2001 From: Daniel Hougaard Date: Mon, 12 Aug 2024 21:51:30 +0400 Subject: [PATCH 1/5] Musl build fix --- .github/workflows/build-c-bindings.yml | 20 ++++++++++++++++++-- .github/workflows/release-java.yml | 24 ++++++++++++------------ 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build-c-bindings.yml b/.github/workflows/build-c-bindings.yml index c5130da..bf7bd72 100644 --- a/.github/workflows/build-c-bindings.yml +++ b/.github/workflows/build-c-bindings.yml @@ -56,11 +56,26 @@ jobs: tar -xzf aarch64-linux-musl-cross.tgz echo "$PWD/aarch64-linux-musl-cross/bin" >> $GITHUB_PATH - - name: Install cross-compilation tools for x86_64-musl + - name: Install MUSL (x86 Linux) toolchains if: matrix.settings.target == 'x86_64-unknown-linux-musl' run: | sudo apt-get update - sudo apt-get install -y musl-tools + + sudo apt-get install -y \ + wget \ + build-essential \ + musl-tools + + mkdir -p ${HOME}/musl_toolchains + cd ${HOME}/musl_toolchains + + wget https://musl.cc/x86_64-linux-musl-cross.tgz + tar -xzf x86_64-linux-musl-cross.tgz + rm x86_64-linux-musl-cross.tgz + + echo "${HOME}/musl_toolchains/x86_64-linux-musl-cross/bin" >> $GITHUB_PATH + + x86_64-linux-musl-gcc --version - name: Build Rust (GNU/Others) if: ${{ !endsWith(matrix.settings.target, '-linux-musl') }} @@ -74,6 +89,7 @@ jobs: env: RUSTFLAGS: "-D warnings -C target-feature=-crt-static" CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-musl-gcc + CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER: x86_64-linux-musl-gcc run: cargo build --target ${{ matrix.settings.target }} --release --workspace --exclude infisical-py - name: Upload Artifact diff --git a/.github/workflows/release-java.yml b/.github/workflows/release-java.yml index 2f5ab30..29e1259 100644 --- a/.github/workflows/release-java.yml +++ b/.github/workflows/release-java.yml @@ -3,8 +3,8 @@ run-name: Release Java SDK on: push: - tags: - - "*.*.*" # version, e.g. 1.0.0 + # tags: + # - "*.*.*" # version, e.g. 1.0.0 jobs: generate_schemas: @@ -111,13 +111,13 @@ jobs: echo "Listing files in languages/java/src/main/resources:" ls -R languages/java/src/main/resources - - name: Publish Maven - working-directory: languages/java - run: | - ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache - env: - ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALUSERNAME }} - ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALPASSWORD }} - ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEY }} - ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEYID }} # Last 8 characters of the full key ID - ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEYPASSWORD }} + # - name: Publish Maven + # working-directory: languages/java + # run: | + # ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache + # env: + # ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALUSERNAME }} + # ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALPASSWORD }} + # ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEY }} + # ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEYID }} # Last 8 characters of the full key ID + # ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEYPASSWORD }} From 64a957a74137f004b8d687144f79aa7125b66253 Mon Sep 17 00:00:00 2001 From: Daniel Hougaard Date: Mon, 12 Aug 2024 22:42:11 +0400 Subject: [PATCH 2/5] Change to zigbuild building architecture --- .github/workflows/build-c-bindings.yml | 53 ++++++++------------------ 1 file changed, 16 insertions(+), 37 deletions(-) diff --git a/.github/workflows/build-c-bindings.yml b/.github/workflows/build-c-bindings.yml index bf7bd72..9343849 100644 --- a/.github/workflows/build-c-bindings.yml +++ b/.github/workflows/build-c-bindings.yml @@ -47,50 +47,29 @@ jobs: sudo apt-get update sudo apt-get install -y gcc-aarch64-linux-gnu - - name: Install cross-compilation tools for aarch64-musl - if: matrix.settings.target == 'aarch64-unknown-linux-musl' - run: | - sudo apt-get update - sudo apt-get install -y musl-tools - wget https://musl.cc/aarch64-linux-musl-cross.tgz - tar -xzf aarch64-linux-musl-cross.tgz - echo "$PWD/aarch64-linux-musl-cross/bin" >> $GITHUB_PATH - - - name: Install MUSL (x86 Linux) toolchains - if: matrix.settings.target == 'x86_64-unknown-linux-musl' - run: | - sudo apt-get update - - sudo apt-get install -y \ - wget \ - build-essential \ - musl-tools - - mkdir -p ${HOME}/musl_toolchains - cd ${HOME}/musl_toolchains - - wget https://musl.cc/x86_64-linux-musl-cross.tgz - tar -xzf x86_64-linux-musl-cross.tgz - rm x86_64-linux-musl-cross.tgz + - uses: goto-bus-stop/setup-zig@7ab2955eb728f5440978d5824358023be3a2802d # v2.2.0 + if: ${{ contains(matrix.settings.target, 'musl') }} + with: + version: 0.12.0 - echo "${HOME}/musl_toolchains/x86_64-linux-musl-cross/bin" >> $GITHUB_PATH + - 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 - x86_64-linux-musl-gcc --version + - name: Add build architecture + run: rustup target add ${{ matrix.settings.target }} - - name: Build Rust (GNU/Others) - if: ${{ !endsWith(matrix.settings.target, '-linux-musl') }} + - name: Build Rust for MUSL - ${{ matrix.settings.target }} + if: ${{ contains(matrix.settings.target, 'musl') }} env: - RUSTFLAGS: "-D warnings" - CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc - run: cargo build --target ${{ matrix.settings.target }} --release --workspace --exclude infisical-py + RUSTFLAGS: "-D warnings -C target-feature=-crt-static" + run: cargo zigbuild -p infisical-c --target ${{ matrix.settings.target }} --release - - name: Build Rust (Musl) - if: endsWith(matrix.settings.target, '-linux-musl') + - name: Build Rust for Non-MUSL - ${{ matrix.settings.target }} + if: ${{ !contains(matrix.settings.target, 'musl') }} env: RUSTFLAGS: "-D warnings -C target-feature=-crt-static" - CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-musl-gcc - CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER: x86_64-linux-musl-gcc - run: cargo build --target ${{ matrix.settings.target }} --release --workspace --exclude infisical-py + run: cargo build -p infisical-c --target ${{ matrix.settings.target }} --release - name: Upload Artifact uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 From b62a63522bb396eb52d9c2a07ef991d59a3a5ddd Mon Sep 17 00:00:00 2001 From: Daniel Hougaard Date: Mon, 12 Aug 2024 22:46:02 +0400 Subject: [PATCH 3/5] Update build-c-bindings.yml --- .github/workflows/build-c-bindings.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-c-bindings.yml b/.github/workflows/build-c-bindings.yml index 9343849..e9a8f57 100644 --- a/.github/workflows/build-c-bindings.yml +++ b/.github/workflows/build-c-bindings.yml @@ -68,6 +68,7 @@ jobs: - name: Build Rust for Non-MUSL - ${{ matrix.settings.target }} if: ${{ !contains(matrix.settings.target, 'musl') }} env: + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-musl-gcc RUSTFLAGS: "-D warnings -C target-feature=-crt-static" run: cargo build -p infisical-c --target ${{ matrix.settings.target }} --release From 0b04f94f500d4a29c131b1b1fcb18d006a61e06e Mon Sep 17 00:00:00 2001 From: Daniel Hougaard Date: Mon, 12 Aug 2024 22:54:30 +0400 Subject: [PATCH 4/5] Update build-c-bindings.yml --- .github/workflows/build-c-bindings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-c-bindings.yml b/.github/workflows/build-c-bindings.yml index e9a8f57..859a39f 100644 --- a/.github/workflows/build-c-bindings.yml +++ b/.github/workflows/build-c-bindings.yml @@ -68,7 +68,7 @@ jobs: - name: Build Rust for Non-MUSL - ${{ matrix.settings.target }} if: ${{ !contains(matrix.settings.target, 'musl') }} env: - CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-musl-gcc + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-musl-gcc RUSTFLAGS: "-D warnings -C target-feature=-crt-static" run: cargo build -p infisical-c --target ${{ matrix.settings.target }} --release From 685559c4de499f0a6c5416a8362978e784d2edfc Mon Sep 17 00:00:00 2001 From: Daniel Hougaard Date: Mon, 12 Aug 2024 22:58:37 +0400 Subject: [PATCH 5/5] Update build-c-bindings.yml --- .github/workflows/build-c-bindings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-c-bindings.yml b/.github/workflows/build-c-bindings.yml index 859a39f..ca5ce59 100644 --- a/.github/workflows/build-c-bindings.yml +++ b/.github/workflows/build-c-bindings.yml @@ -68,7 +68,7 @@ jobs: - name: Build Rust for Non-MUSL - ${{ matrix.settings.target }} if: ${{ !contains(matrix.settings.target, 'musl') }} env: - CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-musl-gcc + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc RUSTFLAGS: "-D warnings -C target-feature=-crt-static" run: cargo build -p infisical-c --target ${{ matrix.settings.target }} --release