Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ And for each crate there should exist a directory `REPO_DIR/CRATE/contrib/` cont

If the repository is not a workspace then per crate files go directly in `REPO_ROOT/contrib/`.

(See [Crates`](#crates) below.)
(See [Crates](#crates) below.)

## Lock file

Expand Down Expand Up @@ -102,22 +102,22 @@ EXAMPLES=""
#### The `EXAMPLES` variable

```bash
EXAPMLES="example:feature"
EXAMPLES="example:feature"
```

```bash
EXAPMLES="example:feature1,feature2"
EXAMPLES="example:feature1,feature2"
```

```bash
EXAPMLES="example_a:feature1,feature2 example_b:feature1"
EXAMPLES="example_a:feature1,feature2 example_b:feature1"
```


Tip: if your example does not require any features consider using "default".

```bash
EXAPMLES="example_a:default"
EXAMPLES="example_a:default"
```

### Additional crate specific tests
Expand Down Expand Up @@ -212,8 +212,7 @@ jobs:
- name: "Checkout maintainer tools"
uses: actions/checkout@v4
with:
repository: tcharding/rust-bitcoin-maintainer-tools
ref: 05-02-ci
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
path: maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@v1
Expand Down
48 changes: 31 additions & 17 deletions ci/run_task.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,23 @@
# Shellcheck can't search dynamic paths
# shellcheck source=/dev/null

set -euox pipefail
set -euo pipefail

REPO_DIR=$(git rev-parse --show-toplevel)

# Make all cargo invocations verbose.
export CARGO_TERM_VERBOSE=true

# Set to false to turn off verbose output.
flag_verbose=true
# Make cargo invocations verbose unless in quiet mode.
# Also control bash debug output based on log level.
case "${MAINTAINER_TOOLS_LOG_LEVEL:-verbose}" in
quiet)
export CARGO_TERM_VERBOSE=false
export CARGO_TERM_QUIET=true
;;
*)
export CARGO_TERM_VERBOSE=true
export CARGO_TERM_QUIET=false
set -x
;;
esac

# Use the current `Cargo.lock` file without updating it.
cargo="cargo --locked"
Expand All @@ -22,7 +30,7 @@ usage() {
cat <<EOF
Usage:

./run_task.sh CRATE TASK
./run_task.sh TASK

TASK
- stable Run tests with stable toolchain.
Expand All @@ -32,6 +40,11 @@ TASK
- docs Build docs with stable toolchain.
- docsrs Build docs with nightly toolchain.
- bench Run the bench tests.

Environment Variables:
MAINTAINER_TOOLS_LOG_LEVEL Control script and cargo output verbosity.
verbose (default) Show all script and cargo messages.
quiet Suppress script messages, reduce cargo output.
EOF
}

Expand Down Expand Up @@ -161,7 +174,7 @@ do_test() {

if [ -e ./contrib/extra_tests.sh ];
then
./contrib/extra_tests.sh
. ./contrib/extra_tests.sh
fi
}

Expand Down Expand Up @@ -241,7 +254,7 @@ do_lint_crates() {
for crate in $CRATES; do
pushd "$REPO_DIR/$crate" > /dev/null
if [ -e ./contrib/extra_lints.sh ]; then
./contrib/extra_lints.sh
. ./contrib/extra_lints.sh
fi
popd > /dev/null
done
Expand Down Expand Up @@ -285,7 +298,7 @@ do_dup_deps() {

if [ "$duplicate_dependencies" -ne 0 ]; then
cargo tree --target=all --all-features --duplicates
say_err "Dependency tree is broken, contains duplicates"
err "Dependency tree is broken, contains duplicates"
fi

set -o pipefail
Expand Down Expand Up @@ -332,14 +345,15 @@ say() {
echo "run_task: $1"
}

say_err() {
say "$1" >&2
}

verbose_say() {
if [ "$flag_verbose" = true ]; then
say "$1"
fi
case "${MAINTAINER_TOOLS_LOG_LEVEL:-verbose}" in
quiet)
# Suppress verbose output.
;;
*)
say "$1"
;;
esac
}

err() {
Expand Down