-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge #81: Add CI script and minimal/recent lock files
167032a Add justfile (Tobin C. Harding) 7201282 CI: Add script and update github actions (Tobin C. Harding) cb682cd Add minimal and recent lock files (Tobin C. Harding) Pull request description: Add test scripts and lock files, as well as updating the github actions, to mimic how we do things in `rust-secp256k1`. ACKs for top commit: apoelstra: ACK 167032a Tree-SHA512: 879d360cc318e18a52945167f1e9f08094d3bd5690512c682131f29c90046a38dae4fc31b01993906cce32bd37230c6c412e66acc2568d1cb4de4d0a118deddc
- Loading branch information
Showing
7 changed files
with
235 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# This file is automatically @generated by Cargo. | ||
# It is not intended for manual editing. | ||
version = 3 | ||
|
||
[[package]] | ||
name = "bitcoinconsensus" | ||
version = "0.100.0+0.20.2" | ||
dependencies = [ | ||
"cc", | ||
"rustc-serialize", | ||
] | ||
|
||
[[package]] | ||
name = "cc" | ||
version = "1.0.83" | ||
source = "registry+https://github.com/rust-lang/crates.io-index" | ||
checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" | ||
dependencies = [ | ||
"libc", | ||
] | ||
|
||
[[package]] | ||
name = "libc" | ||
version = "0.2.151" | ||
source = "registry+https://github.com/rust-lang/crates.io-index" | ||
checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" | ||
|
||
[[package]] | ||
name = "rustc-serialize" | ||
version = "0.3.25" | ||
source = "registry+https://github.com/rust-lang/crates.io-index" | ||
checksum = "fe834bc780604f4674073badbad26d7219cadfb4a2275802db12cbae17498401" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# This file is automatically @generated by Cargo. | ||
Check warning on line 1 in Cargo-recent.lock
|
||
# It is not intended for manual editing. | ||
version = 3 | ||
|
||
[[package]] | ||
name = "bitcoinconsensus" | ||
version = "0.100.0+0.20.2" | ||
dependencies = [ | ||
"cc", | ||
"rustc-serialize", | ||
] | ||
|
||
[[package]] | ||
name = "cc" | ||
version = "1.0.83" | ||
source = "registry+https://github.com/rust-lang/crates.io-index" | ||
checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" | ||
dependencies = [ | ||
"libc", | ||
] | ||
|
||
[[package]] | ||
name = "libc" | ||
version = "0.2.151" | ||
source = "registry+https://github.com/rust-lang/crates.io-index" | ||
checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" | ||
|
||
[[package]] | ||
name = "rustc-serialize" | ||
version = "0.3.25" | ||
source = "registry+https://github.com/rust-lang/crates.io-index" | ||
checksum = "fe834bc780604f4674073badbad26d7219cadfb4a2275802db12cbae17498401" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
|
||
REPO_DIR=$(git rev-parse --show-toplevel) | ||
FEATURES="std" # Note we don't currently test with "external-secp". | ||
|
||
cargo --version | ||
rustc --version | ||
|
||
# Work out if we are using a nightly toolchain. | ||
NIGHTLY=false | ||
if cargo --version | grep nightly; then | ||
NIGHTLY=true | ||
fi | ||
|
||
# Make all cargo invocations verbose | ||
export CARGO_TERM_VERBOSE=true | ||
|
||
# Defaults / "std" feature | ||
cargo build --locked | ||
cargo test --locked | ||
|
||
# No features. | ||
cargo build --locked --no-default-features | ||
cargo test --locked --no-default-features | ||
|
||
if [ "$DO_LINT" = true ] | ||
then | ||
cargo clippy --locked --all-features --all-targets -- -D warnings | ||
fi | ||
|
||
# Build the docs if told to (this only works with the nightly toolchain) | ||
if [ "$DO_DOCSRS" = true ]; then | ||
RUSTDOCFLAGS="--cfg docsrs -D warnings -D rustdoc::broken-intra-doc-links" cargo +nightly doc --all-features | ||
fi | ||
|
||
# Build the docs with a stable toolchain, in unison with the DO_DOCSRS command | ||
# above this checks that we feature guarded docs imports correctly. | ||
if [ "$DO_DOCS" = true ]; then | ||
RUSTDOCFLAGS="-D warnings" cargo +stable doc --all-features | ||
fi | ||
|
||
# Run formatter if told to. | ||
if [ "$DO_FMT" = true ]; then | ||
if [ "$NIGHTLY" = false ]; then | ||
echo "DO_FMT requires a nightly toolchain (consider using RUSTUP_TOOLCHAIN)" | ||
exit 1 | ||
fi | ||
rustup component add rustfmt | ||
cargo fmt --check || exit 1 | ||
fi | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
|
||
REPO_DIR=$(git rev-parse --show-toplevel) | ||
DEPS="recent minimal" | ||
|
||
for dep in $DEPS | ||
do | ||
cp "Cargo-$dep.lock" Cargo.lock | ||
$REPO_DIR/contrib/_test.sh | ||
|
||
if [ "$dep" = recent ]; | ||
then | ||
# We always test committed dependencies but we want to warn if they could've been updated | ||
cargo update | ||
if diff Cargo-recent.lock Cargo.lock; | ||
then | ||
echo "Dependencies are up to date" | ||
else | ||
echo "::warning file=Cargo-recent.lock::Dependencies could be updated" | ||
fi | ||
fi | ||
done | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Update the minimal/recent lock file | ||
|
||
set -euo pipefail | ||
|
||
for file in Cargo-minimal.lock Cargo-recent.lock; do | ||
cp --force "$file" Cargo.lock | ||
cargo check | ||
cp --force Cargo.lock "$file" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
default: | ||
@just --list | ||
|
||
# Cargo build everything. | ||
build: | ||
cargo build --all-targets | ||
|
||
# Cargo check everything. | ||
check: | ||
cargo check --all-targets | ||
|
||
# Lint everything. | ||
lint: | ||
cargo clippy --all-targets -- --deny warnings | ||
|
||
# Check the formatting | ||
format: | ||
cargo +nightly fmt --all --check | ||
|
||
# Update the recent and minimal lock files. | ||
update-lock-files: | ||
contrib/update-lock-files.sh |