From 671a9257c96cc3a9ea07ef3988c69f5e91456944 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Wed, 2 Jan 2019 20:18:42 -0500 Subject: [PATCH] Check clippy and fmt in travis --- .travis.yml | 2 +- shell.nix | 35 +++++++++++++++++++---------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index f2c6bb4..a38cef7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,4 +10,4 @@ matrix: - name: checkPhase - Nix 1 script: nix-shell --run checkPhase --arg useNix1 true - name: cargo pedantry - script: nix-shell --run pedantryPhase --arg useNix1 false -A mozilla-rust-overlay + script: nix-shell --run checkPhase --arg useNix1 false -A mozilla-rust-overlay diff --git a/shell.nix b/shell.nix index 5322088..c12151f 100644 --- a/shell.nix +++ b/shell.nix @@ -36,33 +36,35 @@ let }; mozilla-rust-overlay = stdenv.mkDerivation (rec { - name = "gh-event-forwarder"; + name = "mozilla-rust-overlay"; buildInputs = with pkgs; [ - bash - nix-prefetch-git - rust.rustc - rust.cargo - #rustfmt - #carnix - openssl.dev - pkgconfig + latest.rustChannels.stable.rust git + pkgconfig + openssl.dev ] - ++ stdenv.lib.optional useNix1 oldpkgs.nix1 ++ stdenv.lib.optional stdenv.isDarwin pkgs.darwin.Security; postHook = '' - checkPhase() { - ( cd "${builtins.toString ./.}/ofborg" && cargo build && cargo test) - } + checkPhase() ( + cd "${builtins.toString ./.}/ofborg" + + cargo fmt + git diff --exit-code + cargofmtexit=$? + + cargo clippy + cargoclippyexit=$? + + + sum=$((cargofmtexit + cargoclippyexit)) + exit $sum + ) ''; - HISTFILE = "${toString ./.}/.bash_hist"; RUSTFLAGS = "-D warnings"; RUST_BACKTRACE = "1"; - RUST_LOG = "ofborg=debug"; NIX_PATH = "nixpkgs=${pkgs.path}"; - passthru.phpEnv = phpEnv; } // stdenv.lib.optionalAttrs stdenv.isLinux { LOCALE_ARCHIVE_2_21 = "${oldpkgs.glibcLocales}/lib/locale/locale-archive"; @@ -97,6 +99,7 @@ let RUST_LOG = "ofborg=debug"; NIX_PATH = "nixpkgs=${pkgs.path}"; passthru.phpEnv = phpEnv; + passthru.mozilla-rust-overlay = mozilla-rust-overlay; } // stdenv.lib.optionalAttrs stdenv.isLinux { LOCALE_ARCHIVE_2_21 = "${oldpkgs.glibcLocales}/lib/locale/locale-archive";