Migrate CI and builds to Just, add "full" builds (#660)

This commit is contained in:
Félix Saparelli 2023-01-08 18:27:36 +13:00 committed by GitHub
parent 305bf8123d
commit aea9df602c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 717 additions and 463 deletions

4
e2e-tests/fake-cargo/cargo Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
echo Always returns 1 to prevent use of "cargo-build"
exit 1

29
e2e-tests/live.sh Executable file
View file

@ -0,0 +1,29 @@
#!/bin/bash
set -euxo pipefail
unset CARGO_INSTALL_ROOT
crates="b3sum cargo-release cargo-binstall cargo-watch miniserve sccache"
export CARGO_HOME=$(mktemp -d 2>/dev/null || mktemp -d -t 'cargo-home')
othertmpdir=$(mktemp -d 2>/dev/null || mktemp -d -t 'cargo-test')
export PATH="$CARGO_HOME/bin:$othertmpdir/bin:$PATH"
mkdir -p "$othertmpdir/bin"
# Copy it to bin to test use of env var `CARGO`
cp "./$1" "$othertmpdir/bin/"
# Install binaries using cargo-binstall
# shellcheck disable=SC2086
cargo binstall --no-confirm $crates
rm -r "$othertmpdir"
# Test that the installed binaries can be run
b3sum --version
cargo-release release --version
cargo-binstall --help >/dev/null
cargo binstall --help >/dev/null
cargo watch -V
miniserve -V

14
e2e-tests/manifest-path.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/bash
set -euxo pipefail
unset CARGO_INSTALL_ROOT
export CARGO_HOME=$(mktemp -d 2>/dev/null || mktemp -d -t 'cargo-home')
export PATH="$CARGO_HOME/bin:$PATH"
# Install binaries using `--manifest-path`
# Also test default github template
"./$1" binstall --force --manifest-path "manifests/github-test-Cargo.toml" --no-confirm cargo-binstall
# Test that the installed binaries can be run
cargo binstall --help >/dev/null

View file

@ -0,0 +1,13 @@
[package]
name = "cargo-binstall"
description = "Rust binary package installer for CI integration"
repository = "https://bitbucket.org/nobodyxusdcdc/hello-world"
version = "0.12.0"
rust-version = "1.61.0"
authors = ["ryan <ryan@kurte.nz>"]
edition = "2021"
license = "GPL-3.0"
[[bin]]
name = "cargo-binstall"
path = "src/main.rs"

View file

@ -0,0 +1,13 @@
[package]
name = "cargo-binstall"
description = "Rust binary package installer for CI integration"
repository = "https://github.com/cargo-bins/cargo-binstall"
version = "0.12.0"
rust-version = "1.61.0"
authors = ["ryan <ryan@kurte.nz>"]
edition = "2021"
license = "GPL-3.0"
[[bin]]
name = "cargo-binstall"
path = "src/main.rs"

View file

@ -0,0 +1,16 @@
[package]
name = "cargo-binstall"
description = "Rust binary package installer for CI integration"
repository = "https://github.com/cargo-bins/cargo-binstall"
version = "0.12.0"
rust-version = "1.61.0"
authors = ["ryan <ryan@kurte.nz>"]
edition = "2021"
license = "GPL-3.0"
[package.metadata.binstall]
bin-dir = "{ bin }{ binary-ext }"
[[bin]]
name = "cargo-binstall"
path = "src/main.rs"

View file

@ -0,0 +1,13 @@
[package]
name = "cargo-binstall"
description = "Rust binary package installer for CI integration"
repository = "https://gitlab.kitware.com/NobodyXu/hello-world"
version = "0.2.0"
rust-version = "1.61.0"
authors = ["ryan <ryan@kurte.nz>"]
edition = "2021"
license = "GPL-3.0"
[[bin]]
name = "cargo-binstall"
path = "src/main.rs"

33
e2e-tests/other-repos.sh Executable file
View file

@ -0,0 +1,33 @@
#!/bin/bash
set -euxo pipefail
unset CARGO_INSTALL_ROOT
export CARGO_HOME=$(mktemp -d 2>/dev/null || mktemp -d -t 'cargo-home')
export PATH="$CARGO_HOME/bin:$PATH"
# Test default GitLab pkg-url templates
"./$1" binstall \
--force \
--manifest-path "manifests/gitlab-test-Cargo.toml" \
--no-confirm \
--disable-strategies compile \
cargo-binstall
# Test default BitBucket pkg-url templates
"./$1" binstall \
--force \
--manifest-path "manifests/bitbucket-test-Cargo.toml" \
--no-confirm \
--disable-strategies compile \
cargo-binstall
# Test default Github pkg-url templates,
# with bin-dir provided
"./$1" binstall \
--force \
--manifest-path "manifests/github-test-Cargo2.toml" \
--no-confirm \
--disable-strategies compile \
cargo-binstall

26
e2e-tests/strategies.sh Executable file
View file

@ -0,0 +1,26 @@
#!/bin/bash
set -uxo pipefail
unset CARGO_INSTALL_ROOT
export CARGO_HOME=$(mktemp -d 2>/dev/null || mktemp -d -t 'cargo-home')
export PATH="$CARGO_HOME/bin:$PATH"
## Test --disable-strategies
"./$1" binstall --no-confirm --disable-strategies quick-install,compile cargo-update
exit_code="$?"
if [ "$exit_code" != 94 ]; then
echo "Expected exit code 94, but actual exit code $exit_code"
exit 1
fi
## Test --strategies
"./$1" binstall --no-confirm --strategies crate-meta-data cargo-update
exit_code="$?"
if [ "$exit_code" != 94 ]; then
echo "Expected exit code 94, but actual exit code $exit_code"
exit 1
fi

16
e2e-tests/tls.sh Executable file
View file

@ -0,0 +1,16 @@
#!/bin/bash
set -euxo pipefail
unset CARGO_INSTALL_ROOT
export CARGO_HOME=$(mktemp -d 2>/dev/null || mktemp -d -t 'cargo-home')
export PATH="$CARGO_HOME/bin:$PATH"
"./$1" binstall \
--force \
--min-tls-version "${2:-1.3}" \
--no-confirm \
cargo-binstall
# Test that the installed binaries can be run
cargo binstall --help >/dev/null

19
e2e-tests/upgrade.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/bash
set -euxo pipefail
unset CARGO_INSTALL_ROOT
export CARGO_HOME=$(mktemp -d 2>/dev/null || mktemp -d -t 'cargo-home')
export PATH="$CARGO_HOME/bin:$PATH"
# Test skip when installed
"./$1" binstall --no-confirm --force cargo-binstall@0.11.1
"./$1" binstall --log-level=info --no-confirm cargo-binstall@0.11.1 | grep -q 'cargo-binstall v0.11.1 is already installed'
"./$1" binstall --log-level=info --no-confirm cargo-binstall@0.10.0 | grep -q -v 'cargo-binstall v0.10.0 is already installed'
## Test When 0.11.0 is installed but can be upgraded.
"./$1" binstall --no-confirm cargo-binstall@0.12.0
"./$1" binstall --log-level=info --no-confirm cargo-binstall@0.12.0 | grep -q 'cargo-binstall v0.12.0 is already installed'
"./$1" binstall --log-level=info --no-confirm cargo-binstall@^0.12.0 | grep -q -v 'cargo-binstall v0.12.0 is already installed'

18
e2e-tests/version-syntax.sh Executable file
View file

@ -0,0 +1,18 @@
#!/bin/bash
set -euxo pipefail
unset CARGO_INSTALL_ROOT
export CARGO_HOME=$(mktemp -d 2>/dev/null || mktemp -d -t 'cargo-home')
export PATH="$CARGO_HOME/bin:$PATH"
# Test --version
"./$1" binstall --force --no-confirm --version 0.11.1 cargo-binstall
# Test that the installed binaries can be run
cargo binstall --help >/dev/null
# Test "$crate_name@$version"
"./$1" binstall --force --no-confirm cargo-binstall@0.11.1
# Test that the installed binaries can be run
cargo binstall --help >/dev/null