Skip to content

Commit

Permalink
basic make script to build distributable binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
brunocodutra committed Dec 2, 2023
1 parent ca2d5f3 commit 67780ad
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,28 @@ jobs:
with:
token: ${{secrets.CODECOV_TOKEN}}
fail_ci_if_error: true

dist:
needs: [fmt, clippy, audit, check, doc]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: macOS-latest
target: x86_64-apple-darwin
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
with:
components: rust-src
targets: ${{ matrix.target }}
- run: sudo apt install -y musl-tools
if: runner.os == 'Linux'
- run: cargo install --force cargo-make
- run: cargo make dist
24 changes: 24 additions & 0 deletions Makefile.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[tasks.env]
env = { TARGET = "${CARGO_MAKE_CRATE_TARGET_TRIPLE}", FLAGS = '[]' }

[tasks.env.linux]
env = { TARGET = "x86_64-unknown-linux-musl", FLAGS = '["-Ctarget-feature=+crt-static", "-Crelocation-model=static"]' }

[tasks.env.mac]
env = { TARGET = "x86_64-apple-darwin", FLAGS = '["-Ctarget-feature=+crt-static", "-Crelocation-model=static"]' }

[tasks.env.windows]
env = { TARGET = "x86_64-pc-windows-msvc", FLAGS = '["-Ctarget-feature=+crt-static"]' }

[tasks.dist]
dependencies = ["env"]
command = "cargo"
args = [
"build",
"-Zbuild-std=core,alloc,std,panic_abort",
"-Zbuild-std-features=panic_immediate_abort",
"-Zunstable-options",
"--config=build.rustflags = ${FLAGS}",
"--target=${TARGET}",
"--release",
]

0 comments on commit 67780ad

Please sign in to comment.