Upgrade to nu v0.78 for binaries release workflow (#8840)

# Description

Upgrade to nu v0.78 for binary packages release workflow

Test Release: https://github.com/hustcer/nu-release/releases/tag/v0.78.2
Release workflow running output:
https://github.com/hustcer/nu-release/actions/runs/4656319252/jobs/8239828202

# User-Facing Changes

_(List of all changes that impact the user experience here. This helps
us keep track of breaking changes.)_

# Tests + Formatting

Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect` to check that you're using the standard code
style
- `cargo test --workspace` to check that all tests pass
- `cargo run -- crates/nu-std/tests/run.nu` to run the tests for the
standard library

> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```

# After Submitting

If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
This commit is contained in:
Justin Ma 2023-04-11 04:10:41 +08:00 committed by GitHub
parent 74dcac3b0d
commit 9bb2c8faf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 41 additions and 33 deletions

View File

@ -50,17 +50,17 @@ let flags = $env.TARGET_RUSTFLAGS
let dist = $'($env.GITHUB_WORKSPACE)/output' let dist = $'($env.GITHUB_WORKSPACE)/output'
let version = (open Cargo.toml | get package.version) let version = (open Cargo.toml | get package.version)
$'Debugging info:' print $'Debugging info:'
print { version: $version, bin: $bin, os: $os, target: $target, src: $src, flags: $flags, dist: $dist }; hr-line -b print { version: $version, bin: $bin, os: $os, target: $target, src: $src, flags: $flags, dist: $dist }; hr-line -b
# $env # $env
let USE_UBUNTU = 'ubuntu-20.04' let USE_UBUNTU = 'ubuntu-20.04'
$'(char nl)Packaging ($bin) v($version) for ($target) in ($src)...'; hr-line -b print $'(char nl)Packaging ($bin) v($version) for ($target) in ($src)...'; hr-line -b
if not ('Cargo.lock' | path exists) { cargo generate-lockfile } if not ('Cargo.lock' | path exists) { cargo generate-lockfile }
$'Start building ($bin)...'; hr-line print $'Start building ($bin)...'; hr-line
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Build for Ubuntu and macOS # Build for Ubuntu and macOS
@ -70,23 +70,28 @@ if $os in [$USE_UBUNTU, 'macos-latest'] {
sudo apt update sudo apt update
sudo apt-get install libxcb-composite0-dev -y sudo apt-get install libxcb-composite0-dev -y
} }
if $target == 'aarch64-unknown-linux-gnu' { match $target {
sudo apt-get install gcc-aarch64-linux-gnu -y 'aarch64-unknown-linux-gnu' => {
let-env CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER = 'aarch64-linux-gnu-gcc' sudo apt-get install gcc-aarch64-linux-gnu -y
cargo-build-nu $flags let-env CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER = 'aarch64-linux-gnu-gcc'
} else if $target == 'armv7-unknown-linux-gnueabihf' { cargo-build-nu $flags
sudo apt-get install pkg-config gcc-arm-linux-gnueabihf -y }
let-env CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER = 'arm-linux-gnueabihf-gcc' 'riscv64gc-unknown-linux-gnu' => {
cargo-build-nu $flags sudo apt-get install gcc-riscv64-linux-gnu -y
} else if $target == 'riscv64gc-unknown-linux-gnu' { let-env CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER = 'riscv64-linux-gnu-gcc'
sudo apt-get install gcc-riscv64-linux-gnu -y cargo-build-nu $flags
let-env CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER = 'riscv64-linux-gnu-gcc' }
cargo-build-nu $flags 'armv7-unknown-linux-gnueabihf' => {
} else { sudo apt-get install pkg-config gcc-arm-linux-gnueabihf -y
# musl-tools to fix 'Failed to find tool. Is `musl-gcc` installed?' let-env CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER = 'arm-linux-gnueabihf-gcc'
# Actually just for x86_64-unknown-linux-musl target cargo-build-nu $flags
if $os == $USE_UBUNTU { sudo apt install musl-tools -y } }
cargo-build-nu $flags _ => {
# musl-tools to fix 'Failed to find tool. Is `musl-gcc` installed?'
# Actually just for x86_64-unknown-linux-musl target
if $os == $USE_UBUNTU { sudo apt install musl-tools -y }
cargo-build-nu $flags
}
} }
} }
@ -107,31 +112,34 @@ if $os in ['windows-latest'] {
let suffix = if $os == 'windows-latest' { '.exe' } let suffix = if $os == 'windows-latest' { '.exe' }
# nu, nu_plugin_* were all included # nu, nu_plugin_* were all included
let executable = $'target/($target)/release/($bin)*($suffix)' let executable = $'target/($target)/release/($bin)*($suffix)'
$'Current executable file: ($executable)' print $'Current executable file: ($executable)'
cd $src; mkdir $dist; cd $src; mkdir $dist;
rm -rf $'target/($target)/release/*.d' $'target/($target)/release/nu_pretty_hex*' rm -rf $'target/($target)/release/*.d' $'target/($target)/release/nu_pretty_hex*'
$'(char nl)All executable files:'; hr-line print $'(char nl)All executable files:'; hr-line
ls -f $executable # We have to use `print` here to make sure the command output is displayed
print (ls -f $executable); sleep 1sec
$'(char nl)Copying release files...'; hr-line print $'(char nl)Copying release files...'; hr-line
cp -v README.release.txt $'($dist)/README.txt' cp -v README.release.txt $'($dist)/README.txt'
[LICENSE $executable] | each {|it| cp -rv $it $dist } | flatten [LICENSE $executable] | each {|it| cp -rv $it $dist } | flatten
# Sleep a few seconds to make sure the cp process finished successfully
sleep 3sec
$'(char nl)Check binary release version detail:'; hr-line print $'(char nl)Check binary release version detail:'; hr-line
let ver = if $os == 'windows-latest' { let ver = if $os == 'windows-latest' {
(do -i { ./output/nu.exe -c 'version' }) | str join (do -i { ./output/nu.exe -c 'version' }) | str join
} else { } else {
(do -i { ./output/nu -c 'version' }) | str join (do -i { ./output/nu -c 'version' }) | str join
} }
if ($ver | str trim | is-empty) { if ($ver | str trim | is-empty) {
$'(ansi r)Incompatible nu binary...(ansi reset)' print $'(ansi r)Incompatible nu binary...(ansi reset)'
} else { $ver } } else { print $ver }
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Create a release archive and send it to output for the following steps # Create a release archive and send it to output for the following steps
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
cd $dist; $'(char nl)Creating release archive...'; hr-line cd $dist; print $'(char nl)Creating release archive...'; hr-line
if $os in [$USE_UBUNTU, 'macos-latest'] { if $os in [$USE_UBUNTU, 'macos-latest'] {
let files = (ls | get name) let files = (ls | get name)
@ -141,7 +149,7 @@ if $os in [$USE_UBUNTU, 'macos-latest'] {
mkdir $dest mkdir $dest
$files | each {|it| mv $it $dest } | ignore $files | each {|it| mv $it $dest } | ignore
$'(char nl)(ansi g)Archive contents:(ansi reset)'; hr-line; ls $dest print $'(char nl)(ansi g)Archive contents:(ansi reset)'; hr-line; ls $dest
tar -czf $archive $dest tar -czf $archive $dest
print $'archive: ---> ($archive)'; ls $archive print $'archive: ---> ($archive)'; ls $archive
@ -152,7 +160,7 @@ if $os in [$USE_UBUNTU, 'macos-latest'] {
let releaseStem = $'($bin)-($version)-($target)' let releaseStem = $'($bin)-($version)-($target)'
$'(char nl)Download less related stuffs...'; hr-line print $'(char nl)Download less related stuffs...'; hr-line
aria2c https://github.com/jftuga/less-Windows/releases/download/less-v608/less.exe -o less.exe aria2c https://github.com/jftuga/less-Windows/releases/download/less-v608/less.exe -o less.exe
aria2c https://raw.githubusercontent.com/jftuga/less-Windows/master/LICENSE -o LICENSE-for-less.txt aria2c https://raw.githubusercontent.com/jftuga/less-Windows/master/LICENSE -o LICENSE-for-less.txt
@ -160,7 +168,7 @@ if $os in [$USE_UBUNTU, 'macos-latest'] {
if (get-env _EXTRA_) == 'msi' { if (get-env _EXTRA_) == 'msi' {
let wixRelease = $'($src)/target/wix/($releaseStem).msi' let wixRelease = $'($src)/target/wix/($releaseStem).msi'
$'(char nl)Start creating Windows msi package...' print $'(char nl)Start creating Windows msi package...'
cd $src; hr-line cd $src; hr-line
# Wix need the binaries be stored in target/release/ # Wix need the binaries be stored in target/release/
cp -r $'($dist)/*' target/release/ cp -r $'($dist)/*' target/release/
@ -171,7 +179,7 @@ if $os in [$USE_UBUNTU, 'macos-latest'] {
} else { } else {
$'(char nl)(ansi g)Archive contents:(ansi reset)'; hr-line; ls print $'(char nl)(ansi g)Archive contents:(ansi reset)'; hr-line; ls
let archive = $'($dist)/($releaseStem).zip' let archive = $'($dist)/($releaseStem).zip'
7z a $archive * 7z a $archive *
print $'archive: ---> ($archive)'; print $'archive: ---> ($archive)';

View File

@ -75,7 +75,7 @@ jobs:
- name: Setup Nushell - name: Setup Nushell
uses: hustcer/setup-nu@v3 uses: hustcer/setup-nu@v3
with: with:
version: 0.72.1 version: 0.78.0
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}