feat: upgrades (#26)
- Add rustfmt file - Add .cargo file for fast compiles - use just commands and cleanup release workflows
This commit is contained in:
parent
d347071dde
commit
7006cd3e2b
5 changed files with 107 additions and 70 deletions
34
.cargo/config_fast_builds.toml
Normal file
34
.cargo/config_fast_builds.toml
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
# Add the contents of this file to `config.toml` to enable "fast build" configuration. Please read the notes below.
|
||||
|
||||
# NOTE: For maximum performance, build using a nightly compiler
|
||||
# If you are using rust stable, remove the "-Zshare-generics=y" below.
|
||||
|
||||
[target.x86_64-unknown-linux-gnu]
|
||||
linker = "clang"
|
||||
rustflags = [
|
||||
"-Clink-arg=-fuse-ld=lld", # Use LLD Linker
|
||||
"-Zshare-generics=y", # (Nightly) Make the current crate share its generic instantiations
|
||||
]
|
||||
|
||||
# NOTE: you must install [Mach-O LLD Port](https://lld.llvm.org/MachO/index.html) on mac. you can easily do this by installing llvm which includes lld with the "brew" package manager:
|
||||
# `brew install llvm`
|
||||
[target.x86_64-apple-darwin]
|
||||
rustflags = [
|
||||
"-Clink-arg=-fuse-ld=/usr/local/opt/llvm/bin/ld64.lld", # Use LLD Linker
|
||||
"-Zshare-generics=y", # (Nightly) Make the current crate share its generic instantiations
|
||||
]
|
||||
|
||||
[target.aarch64-apple-darwin]
|
||||
rustflags = [
|
||||
"-Clink-arg=-fuse-ld=/opt/homebrew/opt/llvm/bin/ld64.lld", # Use LLD Linker
|
||||
"-Zshare-generics=y", # (Nightly) Make the current crate share its generic instantiations
|
||||
]
|
||||
|
||||
[target.x86_64-pc-windows-msvc]
|
||||
linker = "rust-lld.exe" # Use LLD Linker
|
||||
rustflags = ["-Zshare-generics=n"]
|
||||
|
||||
# Optional: Uncommenting the following improves compile times, but reduces the amount of debug info to 'line number tables only'
|
||||
# In most cases the gains are negligible, but if you are on macos and have slow compile times you should see significant gains.
|
||||
#[profile.dev]
|
||||
#debug = 1
|
||||
42
.github/workflows/post-release.yml
vendored
42
.github/workflows/post-release.yml
vendored
|
|
@ -13,38 +13,26 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
target/
|
||||
~/.cargo/bin/
|
||||
~/.cargo/git/db/
|
||||
~/.cargo/registry/index/
|
||||
~/.cargo/registry/cache/
|
||||
key: ${{ runner.os }}-cargo-build-stable-${{ hashFiles('**/Cargo.toml') }}
|
||||
|
||||
- name: Install just
|
||||
run: sudo snap install --edge --classic just
|
||||
- name: Install cargo-release
|
||||
run: cargo install cargo-release
|
||||
|
||||
- name: Git setup
|
||||
run: |
|
||||
git config user.name github-actions
|
||||
git config user.email github-actions@github.com
|
||||
|
||||
- name: Setup post-release version bump
|
||||
run: |
|
||||
# Read the current version from Cargo.toml
|
||||
current_version=$(cargo metadata --format-version 1 --no-deps | \
|
||||
jq --raw-output '.packages | .[] | select(.name == "blue-build").version')
|
||||
|
||||
# Sanity check: current version should be 0.X.Y
|
||||
if ! grep -q '^0\.[0-9]\+\.[0-9]\+$' <<< "${current_version}"; then
|
||||
echo "Invalid version (not in 0.X.Y format): ${current_version}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
minor_version=$(sed 's/^0\.\([0-9]\+\).*/\1/' <<< "${current_version}")
|
||||
next_version=0.$((minor_version + 1)).0-dev
|
||||
echo "Bumping version to ${next_version}"
|
||||
|
||||
# See release.yml for meaning of these arguments
|
||||
cargo release "${next_version}" \
|
||||
--workspace \
|
||||
--no-publish \
|
||||
--no-tag \
|
||||
--no-confirm \
|
||||
--no-push
|
||||
run: just cargo-post-release --execute
|
||||
|
||||
- name: Create PR
|
||||
uses: peter-evans/create-pull-request@v5
|
||||
|
|
|
|||
23
.github/workflows/release.yml
vendored
23
.github/workflows/release.yml
vendored
|
|
@ -20,8 +20,6 @@ jobs:
|
|||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: chainguard-dev/actions/setup-gitsign@main
|
||||
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
|
|
@ -32,6 +30,8 @@ jobs:
|
|||
~/.cargo/registry/cache/
|
||||
key: ${{ runner.os }}-cargo-build-stable-${{ hashFiles('**/Cargo.toml') }}
|
||||
|
||||
- name: Install just
|
||||
run: sudo snap install --edge --classic just
|
||||
- name: Install cargo-release
|
||||
run: cargo install cargo-release
|
||||
|
||||
|
|
@ -40,25 +40,8 @@ jobs:
|
|||
git config user.name github-actions
|
||||
git config user.email github-actions@github.com
|
||||
|
||||
# Leaving bevy comments here for us to discuss. Do we want to start tagging our pre-releases with `dev`?
|
||||
- name: Setup release
|
||||
run: |
|
||||
# release: remove the dev suffix, like going from 0.X.0-dev to 0.X.0
|
||||
# --workspace: updating all crates in the workspace
|
||||
# --no-publish: do not publish to crates.io
|
||||
# --execute: not a dry run
|
||||
# --no-tag: do not push tag for each new version
|
||||
# --no-push: do not push the update commits
|
||||
# --dependent-version upgrade: change 0.X.0-dev in internal dependencies to 0.X.0
|
||||
# --exclude: ignore those packages
|
||||
cargo release release \
|
||||
--workspace \
|
||||
--no-publish \
|
||||
--execute \
|
||||
--no-tag \
|
||||
--no-confirm \
|
||||
--no-push \
|
||||
--dependent-version upgrade
|
||||
run: just cargo-release --execute
|
||||
|
||||
- name: Create PR
|
||||
uses: peter-evans/create-pull-request@v5
|
||||
|
|
|
|||
68
justfile
68
justfile
|
|
@ -2,37 +2,59 @@
|
|||
|
||||
export RUST_BACKTRACE := "1"
|
||||
|
||||
set shell := ["bash", "-cu"]
|
||||
set dotenv-load := true
|
||||
set shell := ["bash", "-cu"]
|
||||
set positional-arguments := true
|
||||
|
||||
# default recipe to display help information
|
||||
default:
|
||||
@just --list
|
||||
|
||||
cargo_bump_release_test:
|
||||
#!/usr/bin/env bash
|
||||
set -euxo pipefail
|
||||
# release: remove the dev suffix, like going from 0.X.0-dev to 0.X.0
|
||||
# --workspace: updating all crates in the workspace
|
||||
# --no-publish: do not publish to crates.io
|
||||
# --execute: not a dry run
|
||||
# --no-tag: do not push tag for each new version
|
||||
# --no-push: do not push the update commits
|
||||
# --dependent-version upgrade: change 0.X.0-dev in internal dependencies to 0.X.0
|
||||
# --exclude: ignore those packages
|
||||
cargo-release *args:
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Read the current version from Cargo.toml
|
||||
current_version=$(cargo metadata --format-version 1 --no-deps | \
|
||||
jq --raw-output '.packages | .[] | select(.name == "blue-build").version')
|
||||
|
||||
echo "Current Version: $current_version"
|
||||
|
||||
# Sanity check: current version should be 0.X.Y
|
||||
if ! grep -q '^0\.[0-9]\+\.[0-9]\+$' <<< "${current_version}"; then
|
||||
echo "Invalid version (not in 0.X.Y format): ${current_version}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
minor_version=$(sed 's/^0\.\([0-9]\+\).*/\1/' <<< "${current_version}")
|
||||
next_version=0.$((minor_version + 1)).0-dev
|
||||
echo "Bumping version to ${next_version}"
|
||||
|
||||
# See release.yml for meaning of these arguments
|
||||
cargo release "${next_version}" \
|
||||
cargo release release -v \
|
||||
--workspace \
|
||||
--no-publish \
|
||||
--no-tag \
|
||||
--no-confirm \
|
||||
--no-push
|
||||
--no-push \
|
||||
--dependent-version upgrade "$@"
|
||||
|
||||
# See @cargo-release for meaning of cargo-release arguments
|
||||
cargo-post-release *args:
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Read the current version from Cargo.toml
|
||||
current_version=$(cargo metadata --format-version 1 --no-deps | \
|
||||
jq --raw-output '.packages | .[] | select(.name == "blue-build").version')
|
||||
|
||||
echo "Current Version: $current_version"
|
||||
|
||||
# Sanity check: current version should be 0.X.Y
|
||||
if ! grep -q '^0\.[0-9]\+\.[0-9]\+$' <<< "${current_version}"; then
|
||||
echo "Invalid version (not in 0.X.Y format): ${current_version}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
minor_version=$(sed 's/^0\.\([0-9]\+\).*/\1/' <<< "${current_version}")
|
||||
next_version=0.$((minor_version + 1)).0-dev
|
||||
echo "Bumping version to ${next_version}"
|
||||
|
||||
# See @cargo-release for meaning of these arguments
|
||||
cargo release -v "${next_version}" \
|
||||
--workspace \
|
||||
--no-publish \
|
||||
--no-tag \
|
||||
--no-confirm \
|
||||
--no-push "$@"
|
||||
|
|
|
|||
10
rustfmt.toml
Normal file
10
rustfmt.toml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
use_field_init_shorthand = true
|
||||
newline_style = "Unix"
|
||||
|
||||
# The following lines may be uncommented on nightly Rust.
|
||||
# Once these features have stabilized, they should be added to the always-enabled options above.
|
||||
# unstable_features = true
|
||||
# imports_granularity = "Crate"
|
||||
# wrap_comments = true
|
||||
# comment_width = 100
|
||||
# normalize_comments = true
|
||||
Loading…
Add table
Add a link
Reference in a new issue