From 84a285b9855e4c348ecaed4b1db311a54f60464e Mon Sep 17 00:00:00 2001 From: Tim Oram Date: Sat, 7 Jun 2025 17:29:32 -0230 Subject: [PATCH] Update release process This change contains a major rewrite of the release process to generate fewer overall releases, while adding support for additional targets. The most significant change is releasing fully static binaries for Linux targets, meaning there is no longer a need to make multiple binaries to support different versions of glibc. macOS now has a universal binary that will work on Apple silicon as well as x86_64 systems. On Windows a new target of x86_64 GNU is now being published. The other noteworthy change is the creation of archives for each release, where each archive includes the README, license and other related files, along with the binary. On a project development point of view, the latest release and full release now shares a pipeline. This ensures that the release pipeline is being regularly actioned, as well as providing latest releases against all supported targets. --- .github/scripts/build-archive-macos.bash | 15 + .github/scripts/build-archive-unix.bash | 15 + .github/scripts/build-archive-windows.bash | 15 + .github/scripts/cross-install.bash | 17 + .github/scripts/ubuntu-packages-install.bash | 5 + .github/scripts/update-tag.bash | 22 - .github/workflows/release-latest.yml | 217 -------- .github/workflows/release.yml | 517 ++++++++++--------- Cargo.lock | 37 -- Cargo.toml | 6 +- 10 files changed, 349 insertions(+), 517 deletions(-) create mode 100755 .github/scripts/build-archive-macos.bash create mode 100755 .github/scripts/build-archive-unix.bash create mode 100755 .github/scripts/build-archive-windows.bash create mode 100755 .github/scripts/cross-install.bash create mode 100755 .github/scripts/ubuntu-packages-install.bash delete mode 100755 .github/scripts/update-tag.bash delete mode 100644 .github/workflows/release-latest.yml diff --git a/.github/scripts/build-archive-macos.bash b/.github/scripts/build-archive-macos.bash new file mode 100755 index 000000000..f86ff0d64 --- /dev/null +++ b/.github/scripts/build-archive-macos.bash @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +# Build archive directory, copy contents and create archive + +set -e +set -u +set -o pipefail + +mkdir -p "$ARCHIVE" +cp "$BIN" "$ARCHIVE"/ +cp {CHANGELOG.md,README.md,COPYING} "$ARCHIVE"/ +cp -r ./readme/ "$ARCHIVE/readme" + +7z a "$ARCHIVE.zip" "$ARCHIVE" +echo "ASSET=$ARCHIVE.zip" >> "$GITHUB_ENV" diff --git a/.github/scripts/build-archive-unix.bash b/.github/scripts/build-archive-unix.bash new file mode 100755 index 000000000..2ba60c1d3 --- /dev/null +++ b/.github/scripts/build-archive-unix.bash @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +# Build archive directory, copy contents and create archive + +set -e +set -u +set -o pipefail + +mkdir -p "$ARCHIVE" +cp "$BIN" "$ARCHIVE"/ +cp {CHANGELOG.md,README.md,COPYING,src/interactive-rebase-tool.1} "$ARCHIVE"/ +cp -r readme/ "$ARCHIVE" + +tar czf "$ARCHIVE.tar.gz" "$ARCHIVE" +echo "ASSET=$ARCHIVE.tar.gz" >> "$GITHUB_ENV" diff --git a/.github/scripts/build-archive-windows.bash b/.github/scripts/build-archive-windows.bash new file mode 100755 index 000000000..30699b2ba --- /dev/null +++ b/.github/scripts/build-archive-windows.bash @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +# Build archive directory, copy contents and create archive + +set -e +set -u +set -o pipefail + +mkdir -p "$ARCHIVE" +cp "$BIN.exe" "$ARCHIVE"/ +cp {CHANGELOG.md,README.md,COPYING} "$ARCHIVE"/ +cp -r readme/ "$ARCHIVE" + +7z a "$ARCHIVE.zip" "$ARCHIVE" +echo "ASSET=$ARCHIVE.zip" >> "$GITHUB_ENV" diff --git a/.github/scripts/cross-install.bash b/.github/scripts/cross-install.bash new file mode 100755 index 000000000..6ad35cc26 --- /dev/null +++ b/.github/scripts/cross-install.bash @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +# Install Cross using the pre-compiled binaries to speed up release/build time + +set -e +set -u +set -o pipefail + + +CROSS_VERSION="v0.2.5" + +cross_download_dir="$RUNNER_TEMP/cross-download" +mkdir "$cross_download_dir" +echo "$cross_download_dir" >> "$GITHUB_PATH" +cd "$cross_download_dir" +curl -LO "https://github.com/cross-rs/cross/releases/download/$CROSS_VERSION/cross-x86_64-unknown-linux-musl.tar.gz" +tar xf "cross-x86_64-unknown-linux-musl.tar.gz" diff --git a/.github/scripts/ubuntu-packages-install.bash b/.github/scripts/ubuntu-packages-install.bash new file mode 100755 index 000000000..c65fd3b9f --- /dev/null +++ b/.github/scripts/ubuntu-packages-install.bash @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -e +set -u +set -o pipefail diff --git a/.github/scripts/update-tag.bash b/.github/scripts/update-tag.bash deleted file mode 100755 index 2b230087d..000000000 --- a/.github/scripts/update-tag.bash +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -u -set -o pipefail - -master_ref="$(git rev-parse "$DEFAULT_BRANCH")" -master_ref_short="$(git rev-parse --short "$DEFAULT_BRANCH")" - -curl -X PATCH \ - -H "accept: application/vnd.github.dorian-preview+json" \ - -H "content-type: application/json" \ - -H "authorization: token $GITHUB_ACCESS_TOKEN" \ - -d "{\"sha\": \"$master_ref\", \"force\": true}" \ - "https://api.github.com/repos/$REPOSITORY/git/refs/tags/latest" - -curl -X PATCH \ - -H "accept: application/vnd.github.dorian-preview+json" \ - -H "content-type: application/json" \ - -H "authorization: token $GITHUB_ACCESS_TOKEN" \ - -d "{\"name\": \"Latest Release ($master_ref_short)\"}" \ - "https://api.github.com/repos/$REPOSITORY/releases/$TARGET_RELEASE_ID" diff --git a/.github/workflows/release-latest.yml b/.github/workflows/release-latest.yml deleted file mode 100644 index 080b555b7..000000000 --- a/.github/workflows/release-latest.yml +++ /dev/null @@ -1,217 +0,0 @@ -name: Release Latest - -on: - push: - branches: - - master - -jobs: - update-latest-tag: - name: Update Latest Tag - runs-on: ubuntu-latest - env: - TARGET_RELEASE_ID: 18843342 - GITHUB_ACCESS_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - REPOSITORY: "MitMaro/git-interactive-rebase-tool" - DEFAULT_BRANCH: "master" - steps: - - uses: actions/checkout@v3 - - name: "Update Tag and Title" - run: "./.github/scripts/update-tag.bash" - - deb: - name: "Release Latest - ${{ matrix.platform.name }}" - continue-on-error: true - strategy: - matrix: - platform: - - name: ubuntu_arm64 - target: aarch64-unknown-linux-gnu - image: ubuntu:24.04 - - name: ubuntu_amd64 - target: x86_64-unknown-linux-gnu - image: ubuntu:24.04 - - - name: debian_arm64 - target: aarch64-unknown-linux-gnu - image: debian:sid-slim - - name: debian_amd64 - target: x86_64-unknown-linux-gnu - image: debian:sid-slim - runs-on: ubuntu-latest - needs: update-latest-tag - timeout-minutes: 10 - steps: - - uses: actions/checkout@v4 - - name: Cache - uses: Swatinem/rust-cache@v2 - - uses: dtolnay/rust-toolchain@master - with: - toolchain: nightly - - uses: baptiste0928/cargo-install@v2 - with: - crate: cargo-deb - - name: Build - uses: houseabsolute/actions-rust-cross@v0 - with: - command: build - target: ${{ matrix.platform.target }} - toolchain: nightly - args: "--release --features dev" - - - name: "Build Deb" - run: cargo +nightly deb --no-strip --no-build --target ${{ matrix.platform.target }} --output "target/git-interactive-rebase-tool-unstable-${{ matrix.platform.name }}.deb" - - name: Upload - uses: ncipollo/release-action@v1 - with: - tag: latest - allowUpdates: true - artifacts: "target/git-interactive-rebase-tool-unstable-${{ matrix.platform.name }}.deb" - artifactErrorsFailBuild: true - artifactContentType: "application/vnd.debian.binary-package" - replacesArtifacts: true - omitBodyDuringUpdate: true - omitDraftDuringUpdate: true - omitNameDuringUpdate: true - makeLatest: false - prerelease: true - updateOnlyUnreleased: true - - linux-other: - name: "Release Latest - ${{ matrix.platform.name }}" - continue-on-error: true - strategy: - matrix: - platform: - # Alpine - - name: alpine-arm64 - target: aarch64-unknown-linux-gnu - features: "zlib-ng-compat" - - name: alpine-amd64 - target: x86_64-unknown-linux-gnu - # Arch - - name: arch-arm64 - target: aarch64-unknown-linux-gnu - features: "zlib-ng-compat" - - name: arch-amd64 - target: x86_64-unknown-linux-gnu - # Fedora - - name: fedora-arm64 - target: aarch64-unknown-linux-gnu - features: "zlib-ng-compat" - - name: fedora-amd64 - target: x86_64-unknown-linux-gnu - # Raspberry PI - - name: pi0-1_arm - target: arm-unknown-linux-gnueabihf - - name: pi2-4_armv7 - target: armv7-unknown-linux-gnueabihf - features: "zlib-ng-compat" - - name: pi5_arm64 - target: aarch64-unknown-linux-gnu - features: "zlib-ng-compat" - needs: update-latest-tag - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Cache - uses: Swatinem/rust-cache@v2 - - name: Build - uses: houseabsolute/actions-rust-cross@v0 - with: - command: build - target: ${{ matrix.platform.target }} - toolchain: nightly - args: "--features 'dev ${{ matrix.platform.features }}'" - - name: "Copy" - run: cp target/${{ matrix.platform.target }}/debug/interactive-rebase-tool target/debug/git-interactive-rebase-tool-unstable-${{ matrix.platform.name }} - - name: Upload - uses: ncipollo/release-action@v1 - with: - tag: latest - allowUpdates: true - artifacts: target/debug/git-interactive-rebase-tool-unstable-${{ matrix.platform.name }} - artifactErrorsFailBuild: true - replacesArtifacts: true - omitBodyDuringUpdate: true - omitDraftDuringUpdate: true - omitNameDuringUpdate: true - makeLatest: false - prerelease: true - updateOnlyUnreleased: true - - macos: - name: "Release Latest - macOS_${{ matrix.platform.name }}" - continue-on-error: true - strategy: - matrix: - platform: - - name: arm - target: aarch64-apple-darwin - - name: intel - target: x86_64-apple-darwin - runs-on: macos-latest - timeout-minutes: 10 - needs: update-latest-tag - steps: - - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@nightly - with: - toolchain: nightly - targets: ${{ matrix.platform.target }} - - name: "Build" - run: | - cargo build --features dev --target ${{ matrix.platform.target }} - cp target/${{ matrix.platform.target }}/debug/interactive-rebase-tool target/git-interactive-rebase-tool-unstable-macos_${{ matrix.platform.name }} - - name: Upload - uses: ncipollo/release-action@v1 - with: - tag: latest - allowUpdates: true - artifacts: target/git-interactive-rebase-tool-unstable-macos_${{ matrix.platform.name }} - artifactErrorsFailBuild: true - replacesArtifacts: true - omitBodyDuringUpdate: true - omitDraftDuringUpdate: true - omitNameDuringUpdate: true - makeLatest: false - prerelease: true - updateOnlyUnreleased: true - - windows: - name: "Release Latest - Windows_${{ matrix.platform.name }}" - continue-on-error: true - strategy: - matrix: - platform: - - name: arm64 - target: aarch64-pc-windows-msvc - - name: x64 - target: x86_64-pc-windows-msvc - runs-on: windows-latest - timeout-minutes: 10 - needs: update-latest-tag - steps: - - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@stable - with: - toolchain: stable - targets: ${{ matrix.platform.target }} - - name: "Build" - run: | - cargo rustc --target ${{ matrix.platform.target }} --release --bin interactive-rebase-tool - copy target/${{ matrix.platform.target }}/release/interactive-rebase-tool.exe target/git-interactive-rebase-tool-unstable-windows_${{ matrix.platform.name }}.exe - - name: Upload - uses: ncipollo/release-action@v1 - with: - tag: latest - allowUpdates: true - artifacts: "target/git-interactive-rebase-tool-unstable-windows_${{ matrix.platform.name }}.exe" - artifactErrorsFailBuild: true - replacesArtifacts: true - omitBodyDuringUpdate: true - omitDraftDuringUpdate: true - omitNameDuringUpdate: true - makeLatest: false - prerelease: true - updateOnlyUnreleased: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7979add1e..36523ee23 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,283 +3,322 @@ name: Release Packages on: release: types: [ published ] + push: + branches: + - master jobs: - build_tag: - name: "Build Tag Name" + update-latest-release: + name: Update Latest + if: github.ref == 'refs/heads/master' runs-on: ubuntu-latest timeout-minutes: 1 outputs: release_version: ${{ steps.ref.outputs.version }} steps: - - name: " Build Tag" - id: ref + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Update Tag + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} shell: bash run: | - ref="${{ github.ref }}"; - ref="${ref//refs\/heads\//}"; - ref="${ref//refs\/tags\//}"; - ref="${ref//master/dev}"; - echo "$ref"; - echo "version=$ref" >> "$GITHUB_OUTPUT" + gh api \ + -X PATCH \ + --field sha=$(git rev-parse master) \ + --field force=true \ + repos/{owner}/{repo}/git/refs/tags/latest + gh release edit latest \ + --tag latest \ + --title "Latest Release ($(git rev-parse --short master))" \ + --prerelease + build-tag: + name: Tag Name + runs-on: ubuntu-latest + timeout-minutes: 1 + outputs: + release_version: ${{ steps.ref.outputs.version }} + steps: + - name: Set Tag + id: ref + shell: bash + run: | + if [[ "${{ github.ref }}" == 'refs/heads/master' ]]; then + echo "version=latest" >> "$GITHUB_OUTPUT" + else + ref="${{ github.ref }}"; + ref="${ref//refs\/heads\//}"; + ref="${ref//refs\/tags\//}"; + ref="${ref//master/dev}"; + echo "version=$ref" >> "$GITHUB_OUTPUT" + fi - build-deb: - name: "Release ${{ matrix.platform.name }}" + build-linux: + name: "Release Linux (${{ matrix.name }})" + runs-on: ${{ matrix.runner }} + timeout-minutes: 10 + needs: [ build-tag ] strategy: matrix: - platform: - - name: ubuntu-20.04_arm64 - target: aarch64-unknown-linux-gnu - image: ubuntu:20.04 - build-args: "--features zlib-ng-compat" - pkg-args: --no-strip - - name: ubuntu-20.04_amd64 - target: x86_64-unknown-linux-gnu - image: ubuntu:20.04 - - - name: ubuntu-22.04_arm64 - target: aarch64-unknown-linux-gnu - image: ubuntu:22.04 - build-args: "--features zlib-ng-compat" - pkg-args: --no-strip - - name: ubuntu-22.04_amd64 - target: x86_64-unknown-linux-gnu - image: ubuntu:22.04 - - - name: ubuntu-24.04_arm64 - target: aarch64-unknown-linux-gnu - image: ubuntu:24.04 - build-args: "--features zlib-ng-compat" - pkg-args: --no-strip - - name: ubuntu-24.04_amd64 - target: x86_64-unknown-linux-gnu - image: ubuntu:24.04 - - - name: debian-10_arm64 - target: aarch64-unknown-linux-gnu - image: debian:10-slim - build-args: "--features zlib-ng-compat" - pkg-args: --no-strip - - name: debian-10_amd64 - target: x86_64-unknown-linux-gnu - image: debian:10-slim - - - name: debian-11_arm64 - target: aarch64-unknown-linux-gnu - image: debian:11-slim - build-args: "--features zlib-ng-compat" - pkg-args: --no-strip - - name: debian-11_amd64 - target: x86_64-unknown-linux-gnu - image: debian:11-slim - - - name: debian-12_arm64 + include: + # GNU - aarch64 + - name: gnu-aarch64 + runner: ubuntu-latest target: aarch64-unknown-linux-gnu - image: debian:12-slim - build-args: "--features zlib-ng-compat" - pkg-args: --no-strip - - name: debian-12_amd64 - target: x86_64-unknown-linux-gnu - image: debian:12-slim - - - name: debian-sid_arm64 - target: aarch64-unknown-linux-gnu - image: debian:sid-slim - build-args: "--features zlib-ng-compat" - pkg-args: --no-strip - - name: debian-sid_amd64 - target: x86_64-unknown-linux-gnu - image: debian:sid-slim - runs-on: ubuntu-latest - timeout-minutes: 10 - needs: [ build_tag ] + strip-bin: aarch64-linux-gnu-strip + deb: true + rpm: true + + # musl - x86_64 + - name: musl-x86_64 + runner: ubuntu-latest + target: x86_64-unknown-linux-musl + strip-bin: x86_64-linux-musl-strip + deb: true + rpm: true + + # GNU - embedded abi - hard float + - name: arm-gnueabihf + runner: ubuntu-latest + target: armv7-unknown-linux-gnueabihf + strip-bin: arm-linux-gnueabihf-strip + + # musl - embedded abi - hard float + - name: arm-musleabihf + runner: ubuntu-latest + target: armv7-unknown-linux-musleabihf + strip-bin: arm-linux-musleabihf-strip + + # musl - embedded abi - soft float + - name: arm-musleabi + runner: ubuntu-latest + target: armv7-unknown-linux-musleabi + strip-bin: arm-linux-musleabi-strip + steps: - - uses: actions/checkout@v3 - - uses: dtolnay/rust-toolchain@stable - with: - toolchain: stable - - uses: baptiste0928/cargo-install@v2 - with: - crate: cargo-deb - - name: Build - uses: houseabsolute/actions-rust-cross@v0 + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@master with: - command: build - target: ${{ matrix.platform.target }} toolchain: stable - args: "--release ${{ matrix.platform.build-args }}" - - name: "Build Deb" - run: $HOME/.cargo/bin/cargo +stable deb ${{ matrix.platform.pkg-args }} --no-build --target ${{ matrix.platform.target }} --output "target/git-interactive-rebase-tool-${{ needs.build_tag.outputs.release_version }}-${{ matrix.platform.name }}.deb" - - name: "Upload Release" - uses: softprops/action-gh-release@v1 - with: - files: | - target/*.deb + target: ${{ matrix.target }} + + - name: Install Packages + shell: bash + run: .github/scripts/ubuntu-packages-install.bash + + - name: Install Cross + shell: bash + run: .github/scripts/cross-install.bash + + - name: Set Rust Target Variables + shell: bash + run: | + echo "TARGET_DIR=target/cross/${{ matrix.name }}" >> "$GITHUB_ENV" + + - name: Set Rust Feature Variables + if: github.ref == 'refs/heads/master' + shell: bash + run: | + echo "FEATURES=--features dev" >> "$GITHUB_ENV" + + - name: Build Binary + shell: bash + run: | + cross build --verbose --release --target-dir ${{ env.TARGET_DIR }} --target ${{ matrix.target }} ${{ env.FEATURES }} + + - name: Build Binary Name + shell: bash + run: | + echo "BIN=${{ env.TARGET_DIR }}/${{ matrix.target }}/release/interactive-rebase-tool" >> $GITHUB_ENV + + - name: Strip Release Binary + shell: bash + run: | + docker run --rm \ + -v "$PWD/target:/target:Z" \ + "ghcr.io/cross-rs/${{ matrix.target }}:main" \ + "${{ matrix.strip-bin }}" \ + "/$BIN" + + - name: Build Archive Name + shell: bash + run: | + echo "ARCHIVE=linux-girt-${{ needs.build-tag.outputs.release_version }}-${{ matrix.name }}" >> $GITHUB_ENV + + - name: Build Archive + if: matrix.runner != 'windows-latest' + shell: bash + run: .github/scripts/build-archive-unix.bash + + - name: Upload Release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + shell: bash + run: | + gh release upload \ + "${{ needs.build-tag.outputs.release_version }}" \ + ${{ env.ASSET }} \ + --clobber - build-rpm: - name: "Release ${{ matrix.platform.name }}" - strategy: - matrix: - platform: - - name: fedora-39_arm64 - target: aarch64-unknown-linux-gnu - image: fedora:39 - build-args: "--features zlib-ng-compat" - - name: fedora-39_amd64 - target: x86_64-unknown-linux-gnu - image: fedora:39 - - name: fedora-40_arm64 - target: aarch64-unknown-linux-gnu - image: fedora:40 - build-args: "--features zlib-ng-compat" - - name: fedora-40_amd64 - target: x86_64-unknown-linux-gnu - image: fedora:40 - runs-on: ubuntu-latest - timeout-minutes: 10 - needs: [ build_tag ] - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@stable - with: - toolchain: stable - - uses: baptiste0928/cargo-install@v2 - with: - crate: cargo-generate-rpm - - name: Build - uses: houseabsolute/actions-rust-cross@v0 - with: - command: build - target: ${{ matrix.platform.target }} - toolchain: stable - args: "--release ${{ matrix.platform.build-args }}" - - name: "Build RPM" - run: $HOME/.cargo/bin/cargo +stable generate-rpm --target ${{ matrix.platform.target }} --output "target/git-interactive-rebase-tool-${{ needs.build_tag.outputs.release_version }}-${{ matrix.platform.name }}.rpm" - - name: "Upload Release" - uses: softprops/action-gh-release@v1 - with: - files: | - target/*.rpm + - name: Install cargo-deb + if: matrix.deb + shell: bash + run: | + cargo install cargo-deb + + - name: Build Deb + if: matrix.deb + env: + CARGO_TARGET_DIR: ${{ env.TARGET_DIR }} + run: | + cargo +stable deb \ + --no-strip \ + --no-build \ + --target ${{ matrix.target }} \ + --output "target/deb-girt-${{ needs.build-tag.outputs.release_version }}-${{ matrix.name }}.deb" + + - name: Upload Deb + if: matrix.deb + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + shell: bash + run: | + gh release upload \ + "${{ needs.build-tag.outputs.release_version }}" \ + "target/deb-girt-${{ needs.build-tag.outputs.release_version }}-${{ matrix.name }}.deb" \ + --clobber + + - name: Install cargo-generate-rpm + if: matrix.rpm + shell: bash + run: | + cargo install cargo-generate-rpm + + - name: Build RPM + if: matrix.rpm + run: | + cargo +stable generate-rpm \ + --target-dir ${{ env.TARGET_DIR }} \ + --target ${{ matrix.target }} \ + --output "target/rpm-girt-${{ needs.build_tag.outputs.release_version }}-${{ matrix.name }}.rpm" + + - name: Upload RPM + if: matrix.rpm env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + shell: bash + run: | + gh release upload \ + "${{ needs.build-tag.outputs.release_version }}" \ + "target/rpm-girt-${{ needs.build_tag.outputs.release_version }}-${{ matrix.name }}.rpm" \ + --clobber - linux-other: - name: "Release ${{ matrix.platform.name }}" - continue-on-error: true + build-windows: + name: "Release Windows (${{ matrix.name }})" + runs-on: windows-latest + timeout-minutes: 10 + needs: [ build-tag ] strategy: matrix: - platform: - # Alpine - - name: alpine_arm64 - target: aarch64-unknown-linux-gnu - build-args: "--features zlib-ng-compat" - - name: alpine_amd64 - target: x86_64-unknown-linux-gnu - # Arch - - name: arch_arm64 - target: aarch64-unknown-linux-gnu - build-args: "--features zlib-ng-compat" - - name: arch_amd64 - target: x86_64-unknown-linux-gnu - # Raspberry PI - - name: pi0-1_arm - target: arm-unknown-linux-gnueabihf - - name: pi2-4_armv7 - target: armv7-unknown-linux-gnueabihf - build-args: "--features zlib-ng-compat" - - name: pi5_arm64 - target: aarch64-unknown-linux-gnu - build-args: "--features zlib-ng-compat" - needs: [ build_tag ] - runs-on: ubuntu-latest + include: + - name: "msvc-aarch64" + target: "aarch64-pc-windows-msvc" + - name: "msvc-x86_64" + target: "x86_64-pc-windows-msvc" + - name: "gnu-x86_64" + target: "x86_64-pc-windows-gnu" steps: - - uses: actions/checkout@v4 - - name: Cache - uses: Swatinem/rust-cache@v2 - - name: Build - uses: houseabsolute/actions-rust-cross@v0 + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@master with: - command: build - target: ${{ matrix.platform.target }} toolchain: stable - args: "--release ${{ matrix.platform.build-args }}" - - name: "Copy" - run: cp target/${{ matrix.platform.target }}/release/interactive-rebase-tool target/release/git-interactive-rebase-tool-${{ needs.build_tag.outputs.release_version }}-${{ matrix.platform.name }} - - name: "Upload Release" - uses: softprops/action-gh-release@v1 - with: - files: target/release/git-interactive-rebase-tool-${{ needs.build_tag.outputs.release_version }}-${{ matrix.platform.name }} + targets: ${{ matrix.target }} + + - name: Set Rust Feature Variables + if: github.ref == 'refs/heads/master' + shell: bash + run: | + echo "FEATURES=--features dev" >> "$GITHUB_ENV" + + - name: Build + run: | + cargo rustc --target ${{ matrix.target }} --release --bin interactive-rebase-tool ${{ env.FEATURES }} + + - name: Build Archive + shell: bash + env: + ARCHIVE: windows-girt-${{ needs.build-tag.outputs.release_version }}-${{ matrix.name }} + BIN: target/${{ matrix.target }}/release/interactive-rebase-tool + run: .github/scripts/build-archive-windows.bash + + - name: Upload Release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + shell: bash + run: | + gh release upload \ + "${{ needs.build-tag.outputs.release_version }}" \ + ${{ env.ASSET }} \ + --clobber build-macos: - name: "Release macOS-${{ matrix.platform.macos }}_${{ matrix.platform.name }}" - strategy: - matrix: - platform: - - name: macos-12_arm - target: aarch64-apple-darwin - macos: 12 - - name: macos-12_intel - target: x86_64-apple-darwin - macos: 12 - - name: macos-13_arm - target: aarch64-apple-darwin - macos: 13 - - name: macos-13_intel - target: x86_64-apple-darwin - macos: 13 - - name: macos-14_arm - target: aarch64-apple-darwin - macos: 14 - - name: macos-14_intel - target: x86_64-apple-darwin - macos: 14 - runs-on: macos-${{ matrix.platform.macos }} + name: "Release macOS" + runs-on: macos-latest timeout-minutes: 5 - needs: [ build_tag ] + needs: [ build-tag ] steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@stable + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Install Rust + uses: dtolnay/rust-toolchain@master with: toolchain: stable - targets: ${{ matrix.platform.target }} - - name: "Build" - run: "cargo +stable build --release --target ${{ matrix.platform.target }}" - - name: "Rename" - run: "cp target/${{ matrix.platform.target }}/release/interactive-rebase-tool target/git-interactive-rebase-tool-${{ needs.build_tag.outputs.release_version }}-${{ matrix.platform.name }}" - - name: "Upload Release" - uses: softprops/action-gh-release@v1 - with: - files: target/git-interactive-rebase-tool-${{ needs.build_tag.outputs.release_version }}-${{ matrix.platform.name }} + targets: aarch64-apple-darwin,x86_64-apple-darwin + + - name: Set Rust Feature Variables + if: github.ref == 'refs/heads/master' + shell: bash + run: | + echo "FEATURES=--features dev" >> "$GITHUB_ENV" + + - name: Build (aarch64) + run: | + cargo +stable build --release --target aarch64-apple-darwin ${{ env.FEATURES }} + strip target/aarch64-apple-darwin/release/interactive-rebase-tool + + - name: Build (x86_64) + run: | + cargo +stable build --release --target x86_64-apple-darwin ${{ env.FEATURES }} + strip target/x86_64-apple-darwin/release/interactive-rebase-tool + + - name: Universal Binary + run: | + mkdir -p target/universal/ + lipo -create -output target/universal/interactive-rebase-tool target/aarch64-apple-darwin/release/interactive-rebase-tool target/x86_64-apple-darwin/release/interactive-rebase-tool + + - name: Build Archive + shell: bash env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ARCHIVE: macos-girt-${{ needs.build-tag.outputs.release_version }}-universal + BIN: target/universal/interactive-rebase-tool + run: .github/scripts/build-archive-macos.bash - build-windows: - name: "Release Windows_${{ matrix.target }}" - strategy: - matrix: - target: [ 'aarch64', 'x86_64' ] - runs-on: windows-latest - timeout-minutes: 10 - needs: [ build_tag ] - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@stable - with: - toolchain: stable - targets: "${{ matrix.target }}-pc-windows-msvc" - - name: "Build" - run: "cargo rustc --target ${{ matrix.target }}-pc-windows-msvc --release --bin interactive-rebase-tool" - - name: "Rename" - run: "copy target/${{ matrix.target }}-pc-windows-msvc/release/interactive-rebase-tool.exe target/git-interactive-rebase-tool-${{ needs.build_tag.outputs.release_version }}-windows-${{ matrix.version }}_${{ matrix.target }}.exe" - - name: "Upload Release" - uses: softprops/action-gh-release@v1 - with: - files: target/git-interactive-rebase-tool-${{ needs.build_tag.outputs.release_version }}-windows-${{ matrix.version }}_${{ matrix.target }}.exe + - name: Upload Release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + shell: bash + run: | + gh release upload \ + "${{ needs.build-tag.outputs.release_version }}" \ + ${{ env.ASSET }} \ + --clobber diff --git a/Cargo.lock b/Cargo.lock index 7a012b0b1..c18cfb76b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -104,15 +104,6 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bba18ee93d577a8428902687bcc2b6b45a56b1981a1f6d779731c86cc4c5db18" -[[package]] -name = "cmake" -version = "0.1.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130" -dependencies = [ - "cc", -] - [[package]] name = "core-foundation-sys" version = "0.8.6" @@ -470,26 +461,11 @@ name = "libgit2-sys" version = "0.18.0+1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1a117465e7e1597e8febea8bb0c410f1c7fb93b1e1cddf34363f8390367ffec" -dependencies = [ - "cc", - "libc", - "libssh2-sys", - "libz-sys", - "pkg-config", -] - -[[package]] -name = "libssh2-sys" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dc8a030b787e2119a731f1951d6a773e2280c660f8ec4b0f5e1505a386e71ee" dependencies = [ "cc", "libc", "libz-sys", - "openssl-sys", "pkg-config", - "vcpkg", ] [[package]] @@ -499,7 +475,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "037731f5d3aaa87a5675e895b63ddff1a87624bc29f77004ea829809654e48f6" dependencies = [ "cc", - "cmake", "libc", "pkg-config", "vcpkg", @@ -570,18 +545,6 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" -[[package]] -name = "openssl-sys" -version = "0.9.99" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "parking_lot" version = "0.12.3" diff --git a/Cargo.toml b/Cargo.toml index ab16e913e..6ed0ee9eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,16 +63,16 @@ rustc_version = "0.4.0" [features] default = [] dev = [] -# Mostly used for some arm systems -zlib-ng-compat = ["git2/zlib-ng-compat"] [profile.release] +strip = true incremental = true debug = 0 lto = true codegen-units = 1 [package.metadata.deb] +name = "interactive-rebase-tool" license-file = ["COPYING"] extended-description = """\ Full feature terminal based sequence editor for git interactive rebase.""" @@ -87,11 +87,13 @@ assets = [ ] [package.metadata.generate-rpm] +name = "interactive-rebase-tool" assets = [ { source = "target/release/interactive-rebase-tool", dest = "/usr/bin/interactive-rebase-tool", mode = "755" }, { source = "README.md", dest = "/usr/share/doc/interactive-rebase-tool/", mode = "644" }, { source = "readme/*.md", dest = "/usr/share/doc/interactive-rebase-tool/readme/", mode = "644" }, { source = "CHANGELOG.md", dest = "/usr/share/doc/interactive-rebase-tool/", mode = "644" }, + { source = "COPYING", dest = "/usr/share/doc/interactive-rebase-tool/", mode = "644" }, { source = "src/interactive-rebase-tool.1", dest = "/usr/share/man/man1/interactive-rebase-tool.1", mode = "644" }, ]