From 218a65830ccab7bcd9bc3e26082665190fde5a38 Mon Sep 17 00:00:00 2001 From: Ryan Butler Date: Sat, 5 Oct 2024 02:38:24 -0400 Subject: [PATCH] ci: release for all platforms --- .github/workflows/release.yaml | 28 ++++++++++++++++++++++++++++ Cargo.toml | 7 +++++++ rust-toolchain.toml | 2 +- 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..936aacb --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,28 @@ +name: Release +on: + workflow_dispatch: + +jobs: + build: + name: Build the code for each platform + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4.2.0 + - uses: mlugg/setup-zig@v1.2.1 + with: + version: 0.13.0 + - name: Cache cargo dependencies + uses: Swatinem/rust-cache@v2.7.3 + # - name: Install mingw + # run: sudo apt-get install -y mingw-w64 + + - name: Install cargo-zigbuild + run: cargo install --locked cargo-zigbuild@0.19.3 + + - name: Cargo zigbuild + run: | + cargo zigbuild \ + --target x86_64-unknown-linux-musl \ + --target aarch64-unknown-linux-musl \ + --target x86_64-pc-windows-gnu \ + --all diff --git a/Cargo.toml b/Cargo.toml index 8762e0f..3782c2e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,3 +60,10 @@ opt-level = 1 [profile.dev.package."*"] # Seems to cause crashes on mac on opt-level 3 opt-level = 2 + +# What we use when producing artifacts to distribute +[profile.artifact] +inherits = "release" +lto = true +strip = true +debug = false diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 955d676..d118a7e 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -2,4 +2,4 @@ channel = "1.81.0" # See workspace Cargo.toml components = ["rust-src"] profile = "default" -targets = ["x86_64-pc-windows-msvc", "x86_64-unknown-linux-musl", "aarch64-unknown-linux-musl", "aarch64-apple-darwin"] +targets = ["x86_64-pc-windows-gnu", "x86_64-unknown-linux-musl", "aarch64-unknown-linux-musl", "aarch64-apple-darwin"]