From b98d2819288f86dd5b316c726cda0f84a1f63eb5 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Tue, 27 May 2025 13:12:39 +0100 Subject: build: make less, more resilient builds and cross compile where possible --- .github/workflows/release.yml | 70 +++++++++++++++++++++++++++++-------------- 1 file changed, 47 insertions(+), 23 deletions(-) (limited to '.github') diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 07820b2..2a5303a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,37 +19,61 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} upload-assets: + needs: create-release strategy: matrix: - os: - - ubuntu-latest - - ubuntu-24.04 - - ubuntu-22.04 - - ubuntu-24.04-arm - - ubuntu-22.04-arm - - macos-latest - - macos-15 - - macos-14 - - macos-13 - - windows-latest - - windows-2022 - - windows-2019 + include: + # NOTE: compatibility according to LLM model o3 + # ---------- everything we can build on Linux ---------- + # x86_64 + # compatibility: Ubuntu 14.04+, Debian 8+, RHEL/CentOS 7+, Fedora 21+, openSUSE, Arch, etc. Any x86-64 distro with glibc ≥ 2.17. (Not Alpine) + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu.2.17 # glibc ≥ 2.17 + build-tool: cargo-zigbuild + # aarch64 + # compatibility: Ubuntu 20.04+, Debian 11+, Amazon Linux 2, AWS Graviton, Raspberry Pi OS 64-bit, etc. Any aarch64/arm64 distro with glibc ≥ 2.17. + - os: ubuntu-latest + target: aarch64-unknown-linux-gnu.2.17 + build-tool: cargo-zigbuild + # musl (Alpine etc.) + # compatibility: Alpine 3.12+, Distroless and scratch containers, and very old glibc systems. Fully static; no external libraries. Still needs a CA-certificate bundle (apk add ca-certificates on Alpine). + - os: ubuntu-latest + target: x86_64-unknown-linux-musl + build-tool: cargo-zigbuild + # windows - faster alternative to native windows toolchain + # compatibility: Windows 7 SP1 / Server 2008 R2 and newer, including Windows 11. Requires the “Universal C Runtime” which is already present on Windows 10+ or via the VC++ 2015-2022 redistributable on older systems. No other DLLs needed. + - os: ubuntu-latest + target: x86_64-pc-windows-msvc + build-tool: cargo-zigbuild + # ---------- macOS (needs real mac runner) ------------- + # compatibility: macOS 10.13 High Sierra (2017) or newer. Intel + Apple Silicon. + - os: macos-14 + target: universal-apple-darwin # universal = x86_64 + arm64 + build-tool: cargo # native cargo is fastest + # ---------- native Windows toolchain ------------------ + # switch to this if issues are reported with the zig build + # - os: windows-latest + # target: x86_64-pc-windows-msvc + # build-tool: cargo runs-on: ${{ matrix.os }} + env: + # make openssl + libgit2 static so the binaries work on old distros + OPENSSL_STATIC: 1 + # enable Rust LTO + stripping (you can also move this into Cargo.toml) + CARGO_PROFILE_RELEASE_LTO: true + CARGO_PROFILE_RELEASE_STRIP: symbols + steps: - uses: actions/checkout@v3 + # (optional) cache build artefacts; speeds up repeated releases + - uses: Swatinem/rust-cache@v2 - uses: taiki-e/upload-rust-binary-action@v1 with: - # (required) Comma-separated list of binary names (non-extension portion of filename) to build and upload. - # Note that glob pattern is not supported yet. bin: ngit,git-remote-nostr - archive: ngit-$tag-${{ matrix.os }} - # (optional) On which platform to distribute the `.tar.gz` file. - # [default value: unix] - # [possible values: all, unix, windows, none] + target: ${{ matrix.target }} + build-tool: ${{ matrix.build-tool }} + # final file name: ngit-v1.6.3-x86_64-unknown-linux-gnu.tar.gz … + archive: ngit-$tag-${{ matrix.target }} tar: unix - # (optional) On which platform to distribute the `.zip` file. - # [default value: windows] - # [possible values: all, unix, windows, none] zip: windows - # (required) GitHub token for uploading assets to GitHub Releases. token: ${{ secrets.GITHUB_TOKEN }} -- cgit v1.2.3