From b3ce5d3d46424fec8f18e6a9532bb3b4d4ef7a21 Mon Sep 17 00:00:00 2001 From: Lynne Date: Wed, 28 Apr 2021 16:09:11 +1000 Subject: [PATCH] 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 --- .gitlab-ci.yml | 45 ++++++++++++++++++++++++++++++++------------- clippy.sh | 15 +++++++++++++-- 2 files changed, 45 insertions(+), 15 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 983b022..caa1527 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 \ No newline at end of file + - 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 \ No newline at end of file diff --git a/clippy.sh b/clippy.sh index 46f01fe..6b7f463 100755 --- a/clippy.sh +++ b/clippy.sh @@ -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