#! run `dist init` after modifying this file to set up your CI
#
[workspace]
members = ["cargo:."]

# Config for 'dist'
[dist]
# The preferred dist version to use in CI (Cargo.toml SemVer syntax)
cargo-dist-version = "0.32.0"
# CI backends to support
ci = "github"
# The installers to generate for each app
installers = ["shell", "homebrew"]
# A GitHub repo to push Homebrew formulas to
tap = "cdviz-dev/homebrew-tap"
# Target platforms to build apps for (Rust target-triple syntax)
targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl"]
github-build-setup = "release-build-setup.yml.part"
# Path that installers should place binaries in
install-path = "CARGO_HOME"
# Publish jobs to run in CI
publish-jobs = ["homebrew"]
# Whether to install an updater program
install-updater = false
# Post-announce jobs to run in CI
post-announce-jobs = ["./release-after"]
github-custom-job-permissions = { "release-after" = { packages = "write", contents = "read" } }
# Whether CI should trigger releases with dispatches instead of tag pushes
dispatch-releases = false

[dist.github-custom-runners]
# see https://github.com/axodotdev/cargo-dist/issues/1760

# Use an `ubuntu-latest` runner for all "global" steps of the release process,
# rather than cargo-dist's default of using the oldest possible Linux runner.
# This includes `plan`, `build-global-artifacts`, `host`, and `announce`, none
# of which actually rely on the specific Linux version.
global = "ubuntu-latest"

# Use GitHub's native ARM64 runners instead of buildjet for cost-free native compilation
aarch64-unknown-linux-gnu = "ubuntu-22.04-arm"
aarch64-unknown-linux-musl = "ubuntu-22.04-arm" # "buildjet-8vcpu-ubuntu-2204-arm" #
x86_64-unknown-linux-musl = "ubuntu-latest"

[dist.github-custom-runners.aarch64-apple-darwin]
# Use ARM Mac runner to build ARM binary (not strictly required, but nice).
# dist uses `macos-13` (Intel) by default and cross-compiles to ARM.
runner = "macos-14"

[dist.github-custom-runners.x86_64-unknown-linux-gnu]
# # Lock Linux to minimum supported version (Ubuntu 18.04 / RHEL 8, glibc 2.28).
# # PyPa is the Python Packaging Authority, they manage old Linux variants for building Python wheels.
# # The container `host` uses MUSL because dist itself may require a newer glibc than we are locked to.
# # Runs on ubuntu-latest, dist defaults to oldest possible runner, but container usage means we can use latest
# # and not have to worry about it being EOL-ed.
runner = "ubuntu-22.04"
container = { image = "quay.io/pypa/manylinux_2_28_x86_64", host = "x86_64-unknown-linux-musl" }

# [dist.github-custom-runners.aarch64-unknown-linux-gnu]
# # Use native ARM64 runner instead of cross-compilation with zigbuild
# # This avoids cross-compilation toolchain issues with complex C dependencies like librdkafka
# runner = "ubuntu-24.04-arm"
# container = { image = "quay.io/pypa/manylinux_2_28_x86_64", host = "x86_64-unknown-linux-musl" }

# [dist.github-custom-runners.aarch64-pc-windows-msvc]
# # This setup is nearly identical to specifying nothing, but dist defaults to the oldest possible
# # ubuntu runner, and is sometimes slow to update when they are EOL-ed by GitHub. We use a container,
# # so we can use latest and not have to worry about their EOL.
# # https://github.com/axodotdev/cargo-dist/blob/c8ba950c63f9c38c77782912ec6cdb6807bd0fbd/cargo-dist/src/backend/ci/github.rs#L678-L688
# runner = "ubuntu-latest"
# host = "x86_64-unknown-linux-gnu"
# container = { image = "messense/cargo-xwin", host = "x86_64-unknown-linux-musl", package_manager = "apt" }
