Merge branch 'shellcheck' into 'main'

Add shellcheck to gitlab ci and git hook

See merge request tpo/core/arti!275
This commit is contained in:
Ian Jackson 2022-01-31 13:02:36 +00:00
commit 880d5f2d36
5 changed files with 14 additions and 3 deletions

View File

@ -14,3 +14,5 @@ cargo clippy --all-features --all-targets -- -D warnings
echo '+cargo test --all'
cargo test --all
echo '+./maint/shellcheck_all.sh'
./maint/shellcheck_all.sh

View File

@ -6,6 +6,12 @@ variables:
# We don't need Husky to install the Git hooks for CI.
CARGO_HUSKY_DONT_INSTALL_HOOKS: "true"
shellcheck:
stage: build
image: koalaman/shellcheck-alpine
script:
- ./maint/shellcheck_all.sh
rust-latest:
stage: build
image: rust:latest
@ -78,7 +84,7 @@ minimal-versions:
image: rust:1.53
script:
- rustup install nightly
- ./maint/downgrade_dependencies
- ./maint/downgrade_dependencies.sh
- cargo build --verbose --target x86_64-unknown-linux-gnu --all-features
- cargo test --verbose --target x86_64-unknown-linux-gnu --all-features
tags:

3
maint/shellcheck_all.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
shellcheck ./**/*.sh

View File

@ -72,7 +72,7 @@ echo "Using toolchain +${RUST_COVERAGE_TOOLCHAIN:=nightly}. (Override with \$RUS
cargo "+${RUST_COVERAGE_TOOLCHAIN}" -h >/dev/null
# Validate that grcov is installed.
if [ "$(which grcov 2>/dev/null)" = "" ]; then
if [ "$(command -v grcov 2>/dev/null)" = "" ]; then
echo "grcov appears not to be installed. Try 'cargo install grcov'." >&2
exit 1
fi
@ -145,7 +145,7 @@ fi
cp "$COVERAGE_BASEDIR/$output/index.html" "$COVERAGE_BASEDIR/$output/index_orig.html"
if [ "$(which python3 2>/dev/null)" = "" ]; then
if [ "$(command -v python3 2>/dev/null)" = "" ]; then
echo "python3 not installed; not post-processing the index file."
else
echo "Postprocessing..."