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])
- [ ] 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
> **Warning**
@ -37,7 +47,6 @@
> 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`
- [ ] run `cargo build` to check if it's ok and check last features
- [ ] tag the project with `git tag 0.xx.0`
- [ ] :warning: push the release tag to *GitHub* `git push nushell main --tags` :warning:

View File

@ -1,69 +1,60 @@
use std log
def publish [
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
export def main [] {
let subcrates_wave_1 = [
nu-glob,
nu-json,
nu-path,
nu-pretty-hex,
nu-system,
nu-utils,
nu-term-grid,
nu-test-support,
nu-protocol,
nu-engine,
nu-plugin,
nu-color-config,
nu-parser,
nu-std,
nu-table,
nu-cmd-base,
]
if $no_verify {
cargo publish --no-verify
} else {
cargo publish
# This crate has a `build.rs` file and thus needs `--no-verify`
let subcrates_wave_2 = [
nu-cmd-lang,
]
let subcrates_wave_3 = [
nu-command,
nu-explore,
nu-cli,
nu-cmd-dataframe,
nu-cmd-extra,
nu-lsp,
nu_plugin_query,
nu_plugin_inc,
nu_plugin_gstat,
nu_plugin_formats,
]
log warning "starting publish"
log warning "publishing the first wave of crates"
for crate in $subcrates_wave_1 {
cargo publish -p $crate
}
log warning "publishing the second wave of crates"
for crate in $subcrates_wave_2 {
cargo publish -p $crate --no-verify
}
log warning "publishing the third wave of crates"
for crate in $subcrates_wave_3 {
cargo publish -p $crate
}
cargo publish
}
let subcrates_wave_1 = [
nu-glob,
nu-json,
nu-path,
nu-pretty-hex,
nu-system,
nu-utils,
nu-term-grid,
nu-test-support,
nu-protocol,
nu-engine,
nu-plugin,
nu-color-config,
nu-parser,
nu-std,
nu-table,
nu-cmd-base,
]
# This crate has a `build.rs` file and thus needs `--no-verify`
let subcrates_wave_2 = [
nu-cmd-lang,
]
let subcrates_wave_3 = [
nu-command,
nu-explore,
nu-cli,
nu-cmd-dataframe,
nu-cmd-extra,
nu-lsp,
nu_plugin_query,
nu_plugin_inc,
nu_plugin_gstat,
nu_plugin_formats,
]
log warning "publishing the first wave of crates"
for subcrate in $subcrates_wave_1 {
publish ("crates" | path join $subcrate)
}
log warning "publishing the second wave of crates"
for subcrate in $subcrates_wave_2 {
publish ("crates" | path join $subcrate) --no-verify
}
log warning "publishing the third wave of crates"
for subcrate in $subcrates_wave_3 {
publish ("crates" | path join $subcrate)
}
cargo publish