numerous CI improvements =u=

- run clippy before all other tasks
- deny on clippy warnings when running in CI
- build and test both xdg and infer backends
- make sure "fif -V" actually works
This commit is contained in:
Lynne Megido 2021-04-28 16:09:11 +10:00
parent b12c42adbb
commit b3ce5d3d46
Signed by: lynnesbian
GPG Key ID: F0A184B5213D9F90
2 changed files with 45 additions and 15 deletions

View File

@ -10,24 +10,43 @@ cache:
default:
before_script:
- rustc --version
- rustc --version
- cargo version
stages:
- lint
- build
- test
build:
stage: build
script:
- cargo build --verbose --locked
cargo-test:
stage: test
script:
cargo test --verbose --locked
- version
clippy:
stage: test
stage: lint
script:
- rustup component add clippy
- ./clippy.sh
- cargo clippy --version
- ./clippy.sh ci
xdg-backend:
stage: build
script:
- cargo build --features=xdg-mime-backend --locked
mime-backend:
stage: build
script:
cargo build --features=infer-backend --locked
cargo-test-xdg:
stage: test
script:
cargo test --features=xdg-mime-backend --verbose --locked
cargo-test-infer:
stage: test
script:
cargo test --features=infer-backend --verbose --locked
fif-version:
stage: version
script:
cargo run -- -V

View File

@ -1,5 +1,15 @@
#!/bin/bash
fd -e rs -x touch {}
set -e
_extra=""
if [ "$1" == "ci" ]; then
# deny on warnings when running in CI
_extra="-Dwarnings"
fi
# allow find to fail
find . -name '*.rs' -exec touch "{}" \; || true
cargo clippy --all-features --tests -- \
-W clippy::nursery \
-W clippy::perf \
@ -14,7 +24,8 @@ cargo clippy --all-features --tests -- \
-A clippy::unused_io_amount \
-A clippy::redundant_closure_for_method_calls \
-A clippy::shadow_unrelated \
-A clippy::option_if_let_else
-A clippy::option_if_let_else \
"$_extra"
# ALLOWS:
# unused_io_amount: there are two places where i want to read up to X bytes and i'm fine with getting less than that