From 8c07c339b28af2b5928ae68afb320c8beaa676b7 Mon Sep 17 00:00:00 2001 From: Jeff Dickey <216188+jdx@users.noreply.github.com> Date: Wed, 6 Dec 2023 11:54:39 -0600 Subject: [PATCH] release: support more arm architectures --- .github/workflows/rtx.yml | 90 ++++++++++++++++++-------------------- scripts/build-tarball.sh | 14 +++++- scripts/release-npm.sh | 4 ++ scripts/release.sh | 13 +++--- scripts/render-homebrew.sh | 4 ++ scripts/render-install.sh | 4 ++ 6 files changed, 72 insertions(+), 57 deletions(-) diff --git a/.github/workflows/rtx.yml b/.github/workflows/rtx.yml index 7da836665..432c938eb 100644 --- a/.github/workflows/rtx.yml +++ b/.github/workflows/rtx.yml @@ -81,58 +81,55 @@ jobs: fail_ci_if_error: false files: lcov.info - build-linux: - name: build-${{matrix.target}} - runs-on: ubuntu-22.04 - timeout-minutes: 45 - strategy: - fail-fast: false - matrix: - target: - - aarch64-unknown-linux-gnu - - x86_64-unknown-linux-gnu - - arm-unknown-linux-musleabihf - - armv7-unknown-linux-gnueabihf - steps: - - uses: actions/checkout@v4 - - name: Rust Cache - uses: Swatinem/rust-cache@v2 - with: - shared-key: "build-linux-${{matrix.target}}" - save-if: ${{ github.event_name == 'push' && github.ref_name == 'main' }} - - uses: taiki-e/install-action@cross - - run: scripts/setup-zipsign.sh - env: - ZIPSIGN: ${{ secrets.ZIPSIGN }} - - run: scripts/build-tarball.sh rtx --release --features openssl/vendored --target ${{matrix.target}} - env: - CROSS: "1" - - uses: actions/upload-artifact@v3 - with: - name: tarball-${{matrix.target}} - path: | - dist/rtx-*.tar.xz - dist/rtx-*.tar.gz - if-no-files-found: error - - build-macos: - name: build-${{matrix.target}} - runs-on: macos-12 + build-tarball: + name: build-tarball-${{matrix.name}} + runs-on: ${{matrix.os}} timeout-minutes: 45 strategy: fail-fast: false matrix: - target: - - x86_64-apple-darwin - - aarch64-apple-darwin + include: + - os: ubuntu-22.04 + name: linux-x64 + target: x86_64-unknown-linux-gnu + - os: ubuntu-22.04 + name: linux-x64-musl + target: aarch64-unknown-linux-musl + - os: ubuntu-22.04 + name: linux-arm64 + target: aarch64-unknown-linux-gnu + - os: ubuntu-22.04 + name: linux-arm64-musl + target: aarch64-unknown-linux-musl + - os: ubuntu-22.04 + name: linux-armv7 + target: armv7-unknown-linux-gnueabi + - os: ubuntu-22.04 + name: linux-armv7-musl + target: armv7-unknown-linux-musleabi + - os: ubuntu-22.04 + name: linux-armv6 + target: arm-unknown-linux-gnueabi + - os: ubuntu-22.04 + name: linux-armv6-musl + target: arm-unknown-linux-musleabi + - os: macos-12 + name: macos-x64 + target: x86_64-apple-darwin + - os: macos-12 + name: macos-arm64 + target: aarch64-apple-darwin steps: - uses: actions/checkout@v4 - - run: rustup target add ${{matrix.target}} + - if: matrix.os == 'macos-12' + run: rustup target add ${{matrix.target}} - name: Rust Cache uses: Swatinem/rust-cache@v2 with: - key: "${{matrix.target}}" + shared-key: "build-tarball-${{matrix.name}}" save-if: ${{ github.event_name == 'push' && github.ref_name == 'main' }} + - if: matrix.os == 'ubuntu-22.04' + uses: taiki-e/install-action@cross - run: scripts/setup-zipsign.sh env: ZIPSIGN: ${{ secrets.ZIPSIGN }} @@ -147,7 +144,7 @@ jobs: e2e-linux: runs-on: ubuntu-22.04 #container: ghcr.io/jdx/rtx:github-actions - needs: [build-linux] + needs: [build-tarball] timeout-minutes: 30 if: github.event_name != 'pull_request' steps: @@ -171,7 +168,7 @@ jobs: command: ./e2e/run_all_tests rpm: runs-on: ubuntu-22.04 - needs: [build-linux] + needs: [build-tarball] timeout-minutes: 10 container: ghcr.io/jdx/rtx:rpm if: github.event_name != 'pull_request' @@ -199,7 +196,7 @@ jobs: container: ghcr.io/jdx/rtx:deb timeout-minutes: 10 if: github.event_name != 'pull_request' - needs: [build-linux] + needs: [build-tarball] steps: - uses: actions/checkout@v4 - uses: crazy-max/ghaction-import-gpg@v6 @@ -230,8 +227,7 @@ jobs: - unit - coverage - e2e-linux - - build-linux - - build-macos + - build-tarball - rpm - deb steps: diff --git a/scripts/build-tarball.sh b/scripts/build-tarball.sh index ef7c5d0ab..c641fdafa 100755 --- a/scripts/build-tarball.sh +++ b/scripts/build-tarball.sh @@ -59,13 +59,23 @@ get_arch() { ;; esac } +get_suffix() { + case "$RUST_TRIPLE" in + *-musl | *-musleabi | *-musleabihf) + echo "-musl" + ;; + *) + echo "" + ;; + esac +} #endregion set -x VERSION=$(./scripts/get-version.sh) -BASENAME=$NAME-$VERSION-$(get_os)-$(get_arch) +BASENAME=$NAME-$VERSION-$(get_os)-$(get_arch)$(get_suffix) -if [ "${CROSS:-}" = "1" ]; then +if command -v cross >/dev/null; then cross build "$@" else cargo build "$@" diff --git a/scripts/release-npm.sh b/scripts/release-npm.sh index 01152814f..dc5890241 100755 --- a/scripts/release-npm.sh +++ b/scripts/release-npm.sh @@ -22,9 +22,13 @@ dist_tag="$(dist_tag_from_version "$RTX_VERSION")" platforms=( linux-x64 + linux-x64-musl linux-arm64 + linux-arm64-musl linux-armv6 + linux-armv6-musl linux-armv7 + linux-armv7-musl macos-x64 macos-arm64 ) diff --git a/scripts/release.sh b/scripts/release.sh index c9bbdaa33..5c569605f 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -10,14 +10,7 @@ export RTX_VERSION RELEASE_DIR rm -rf "${RELEASE_DIR:?}/$RTX_VERSION" mkdir -p "$RELEASE_DIR/$RTX_VERSION" -targets=( - x86_64-unknown-linux-gnu - aarch64-unknown-linux-gnu - arm-unknown-linux-gnueabihf - armv7-unknown-linux-gnueabihf - x86_64-apple-darwin - aarch64-apple-darwin -) +targets=$(find artifacts -name 'tarball-*' -exec basename {} \; | sed 's/^tarball-//') for target in "${targets[@]}"; do cp "artifacts/tarball-$target/"*.tar.gz "$RELEASE_DIR/$RTX_VERSION" cp "artifacts/tarball-$target/"*.tar.xz "$RELEASE_DIR/$RTX_VERSION" @@ -25,9 +18,13 @@ done platforms=( linux-x64 + linux-x64-musl linux-arm64 + linux-arm64-musl linux-armv6 + linux-armv6-musl linux-armv7 + linux-armv7-musl macos-x64 macos-arm64 ) diff --git a/scripts/render-homebrew.sh b/scripts/render-homebrew.sh index c906a41f3..3e297ac65 100755 --- a/scripts/render-homebrew.sh +++ b/scripts/render-homebrew.sh @@ -4,9 +4,13 @@ set -euxo pipefail # shellcheck disable=SC2016 RTX_VERSION=${RTX_VERSION#v*} \ RTX_CHECKSUM_LINUX_X86_64=$(grep "rtx-v$RTX_VERSION-linux-x64.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \ + RTX_CHECKSUM_LINUX_X86_64_MUSL=$(grep "rtx-v$RTX_VERSION-linux-x64-musl.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \ RTX_CHECKSUM_LINUX_ARM64=$(grep "rtx-v$RTX_VERSION-linux-arm64.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \ + RTX_CHECKSUM_LINUX_ARM64_MUSL=$(grep "rtx-v$RTX_VERSION-linux-arm64-musl.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \ RTX_CHECKSUM_LINUX_ARMV6=$(grep "rtx-v$RTX_VERSION-linux-armv6.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \ + RTX_CHECKSUM_LINUX_ARMV6_MUSL=$(grep "rtx-v$RTX_VERSION-linux-armv6-musl.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \ RTX_CHECKSUM_LINUX_ARMV7=$(grep "rtx-v$RTX_VERSION-linux-armv7.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \ + RTX_CHECKSUM_LINUX_ARMV7_MUSL=$(grep "rtx-v$RTX_VERSION-linux-armv7-musl.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \ RTX_CHECKSUM_MACOS_X86_64=$(grep "rtx-v$RTX_VERSION-macos-x64.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \ RTX_CHECKSUM_MACOS_ARM64=$(grep "rtx-v$RTX_VERSION-macos-arm64.tar.xz" "$RELEASE_DIR/v$RTX_VERSION/SHASUMS256.txt" | cut -d ' ' -f1) \ envsubst '$RTX_VERSION,$RTX_CHECKSUM_LINUX_X86_64,$RTX_CHECKSUM_LINUX_ARM64,$RTX_CHECKSUM_MACOS_X86_64,$RTX_CHECKSUM_MACOS_ARM64' \ diff --git a/scripts/render-install.sh b/scripts/render-install.sh index fa3d37564..f5cf4a98b 100755 --- a/scripts/render-install.sh +++ b/scripts/render-install.sh @@ -4,9 +4,13 @@ set -euxo pipefail # shellcheck disable=SC2016 RTX_VERSION=$RTX_VERSION \ RTX_CHECKSUM_LINUX_X86_64=$(grep "rtx-v.*linux-x64.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \ + RTX_CHECKSUM_LINUX_X86_64_MUSL=$(grep "rtx-v.*linux-x64-musl.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \ RTX_CHECKSUM_LINUX_ARM64=$(grep "rtx-v.*linux-arm64.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \ + RTX_CHECKSUM_LINUX_ARM64_MUSL=$(grep "rtx-v.*linux-arm64-musl.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \ RTX_CHECKSUM_LINUX_ARMV6=$(grep "rtx-v.*linux-armv6.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \ + RTX_CHECKSUM_LINUX_ARMV6_MUSL=$(grep "rtx-v.*linux-armv6-musl.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \ RTX_CHECKSUM_LINUX_ARMV7=$(grep "rtx-v.*linux-armv7.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \ + RTX_CHECKSUM_LINUX_ARMV7_MUSL=$(grep "rtx-v.*linux-armv7-musl.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \ RTX_CHECKSUM_MACOS_X86_64=$(grep "rtx-v.*macos-x64.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \ RTX_CHECKSUM_MACOS_ARM64=$(grep "rtx-v.*macos-arm64.tar.gz" "$RELEASE_DIR/$RTX_VERSION/SHASUMS256.txt") \ envsubst '$RTX_VERSION,$RTX_CHECKSUM_LINUX_X86_64,$RTX_CHECKSUM_LINUX_ARM64,$RTX_CHECKSUM_MACOS_X86_64,$RTX_CHECKSUM_MACOS_ARM64' \