1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-02 07:07:46 +00:00

Use cargo hack in release process (#804)

This PR adds two [`cargo hack`](https://github.com/taiki-e/cargo-hack)
commands to the release process to check for errors due to combination
of features. The first one will run `cargo check` on each crate multiple
times over, toggling different combinations of features each time. This
is to check for compilation errors regarding missing imports, etc. The
second command will run `cargo build` for each crate separately (with
default features) to check for build errors (from `build.rs` or
whatever).

Using the [error](https://github.com/nushell/nushell/pull/11786) from
the 0.90.0 publishing as a test, the first command does indeed find the
compilation error.

In the future, we should probably put these commands into a manually
triggered CI job so that they will be run on multiple platforms.

Also, this PR cleans up `nu_release.nu` a little bit.
This commit is contained in:
Ian Manske 2024-03-30 22:36:20 +00:00 committed by GitHub
parent b9c873bc67
commit a2929c0bf8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 76 additions and 76 deletions

View file

@ -25,7 +25,17 @@
## 1. Minor bump of the version ([example][nushell bump example]) ## 1. Minor bump of the version ([example][nushell bump example])
- [ ] in the repo of Nushell, run `/path/to/nu_scripts/make_release/bump-version.nu` - [ ] in the repo of Nushell, run `/path/to/nu_scripts/make_release/bump-version.nu`
- [ ] Also commit `Cargo.lock` AFTER running a Cargo command like `cargo check --workspace` - [ ] then, ensure there are no compilation errors with any combination of features by running:
```nushell
cargo hack --all --feature-powerset --skip default-no-clipboard,stable,wasi,mimalloc check
```
(this will take a while...)
- [ ] check for build errors by running:
```nushell
cargo hack --all build
```
(this will build each crate with default features)
- [ ] commit changes with bumped versions (this includes changes to `Cargo.lock`)
## 2. Tag the [`nushell`] repo ## 2. Tag the [`nushell`] repo
> **Warning** > **Warning**
@ -37,7 +47,6 @@
> e.g. the `nushell` remote would be `https://github.com/nushell/nushell` or `git@github.com:nushell/nushell` > e.g. the `nushell` remote would be `https://github.com/nushell/nushell` or `git@github.com:nushell/nushell`
- [ ] get the latest version bump commit with `git pull nushell main` - [ ] get the latest version bump commit with `git pull nushell main`
- [ ] run `cargo build` to check if it's ok and check last features
- [ ] tag the project with `git tag 0.xx.0` - [ ] tag the project with `git tag 0.xx.0`
- [ ] :warning: push the release tag to *GitHub* `git push nushell main --tags` :warning: - [ ] :warning: push the release tag to *GitHub* `git push nushell main --tags` :warning:

View file

@ -1,18 +1,6 @@
use std log use std log
def publish [ export def main [] {
crate: path # the path to the crate to publish.
--no-verify # dont verify the contents by building them. Can be useful for crates with a `build.rs`.
] {
cd $crate
if $no_verify {
cargo publish --no-verify
} else {
cargo publish
}
}
let subcrates_wave_1 = [ let subcrates_wave_1 = [
nu-glob, nu-glob,
nu-json, nu-json,
@ -51,19 +39,22 @@ let subcrates_wave_3 = [
nu_plugin_formats, nu_plugin_formats,
] ]
log warning "starting publish"
log warning "publishing the first wave of crates" log warning "publishing the first wave of crates"
for subcrate in $subcrates_wave_1 { for crate in $subcrates_wave_1 {
publish ("crates" | path join $subcrate) cargo publish -p $crate
} }
log warning "publishing the second wave of crates" log warning "publishing the second wave of crates"
for subcrate in $subcrates_wave_2 { for crate in $subcrates_wave_2 {
publish ("crates" | path join $subcrate) --no-verify cargo publish -p $crate --no-verify
} }
log warning "publishing the third wave of crates" log warning "publishing the third wave of crates"
for subcrate in $subcrates_wave_3 { for crate in $subcrates_wave_3 {
publish ("crates" | path join $subcrate) cargo publish -p $crate
} }
cargo publish cargo publish
}