Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Release

# Tag a version to cut a release:
# cargo set-version 0.1.0 # or edit Cargo.toml
# git tag v0.1.0 && git push origin v0.1.0
#
# This builds a binary per platform, attaches them to the GitHub Release, and
# publishes the crate to crates.io. Because the assets are named
# `frd-<target>.{tar.gz,zip}` with the binary at the archive root, `cargo binstall frd`
# finds them with no `[package.metadata.binstall]` config (it matches binstall's
# default naming). `cargo install frd` keeps working by compiling from source.

on:
push:
tags: ["v*"]

concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false

env:
CARGO_TERM_COLOR: always

jobs:
build:
name: build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
permissions:
contents: write # create the release and upload assets
strategy:
fail-fast: false
matrix:
include:
- { os: macos-latest, target: aarch64-apple-darwin }
- { os: macos-latest, target: x86_64-apple-darwin }
- { os: ubuntu-latest, target: x86_64-unknown-linux-gnu }
- { os: ubuntu-24.04-arm, target: aarch64-unknown-linux-gnu }
- { os: windows-latest, target: x86_64-pc-windows-msvc }
steps:
- uses: actions/checkout@v6

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Build
run: cargo build --release --locked --target ${{ matrix.target }}

- name: Package (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
archive="frd-${{ matrix.target }}.tar.gz"
tar -czf "$archive" -C "target/${{ matrix.target }}/release" frd
echo "ASSET=$archive" >> "$GITHUB_ENV"

- name: Package (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$archive = "frd-${{ matrix.target }}.zip"
Compress-Archive -Path "target/${{ matrix.target }}/release/frd.exe" -DestinationPath $archive
"ASSET=$archive" | Out-File -FilePath $env:GITHUB_ENV -Append

- name: Upload to release
uses: softprops/action-gh-release@v2
with:
files: ${{ env.ASSET }}
fail_on_unmatched_files: true
generate_release_notes: true

publish-crate:
name: publish to crates.io
# Only publish once every platform binary built, so a failed build never ships a
# crates.io version whose GitHub Release is missing binaries.
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- name: Publish
run: cargo publish --locked
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
184 changes: 183 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,21 @@ edition = "2024"
description = "Speed up local Rust builds and shrink target/ with interactive cargo and profile tuning"
license = "MIT"
repository = "https://github.com/cs50victor/fast-rust-dev"
readme = "README.md"
keywords = ["cargo", "build", "performance", "disk", "optimization"]
categories = ["command-line-utilities", "development-tools"]

[dependencies]
anyhow = "1.0.102"
clap = { version = "4.6.1", features = ["derive"] }
console = "0.16.3"
dirs = "6.0.0"
similar = "3.1.1"
# Pinned to 0.36 on purpose: it has MSRV 1.75 (below our edition-2024 floor, so no cost),
# while 0.37+ raises the MSRV and 0.39 needs Rust 1.95. Only RAM and disk facts are used.
sysinfo = { version = "0.36", default-features = false, features = ["system", "disk"] }
toml_edit = "0.25.12"

# frd recommends `strip` to the projects it tunes, so it ships its own binaries stripped too.
[profile.release]
strip = true
Loading
Loading