Check clippy and fmt in travis

This commit is contained in:
Graham Christensen 2019-01-02 20:18:42 -05:00
parent 87974028d1
commit 671a9257c9
No known key found for this signature in database
GPG key ID: ACA1C1D120C83D5C
2 changed files with 20 additions and 17 deletions

View file

@ -10,4 +10,4 @@ matrix:
- name: checkPhase - Nix 1 - name: checkPhase - Nix 1
script: nix-shell --run checkPhase --arg useNix1 true script: nix-shell --run checkPhase --arg useNix1 true
- name: cargo pedantry - 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

View file

@ -36,33 +36,35 @@ let
}; };
mozilla-rust-overlay = stdenv.mkDerivation (rec { mozilla-rust-overlay = stdenv.mkDerivation (rec {
name = "gh-event-forwarder"; name = "mozilla-rust-overlay";
buildInputs = with pkgs; [ buildInputs = with pkgs; [
bash latest.rustChannels.stable.rust
nix-prefetch-git
rust.rustc
rust.cargo
#rustfmt
#carnix
openssl.dev
pkgconfig
git git
pkgconfig
openssl.dev
] ]
++ stdenv.lib.optional useNix1 oldpkgs.nix1
++ stdenv.lib.optional stdenv.isDarwin pkgs.darwin.Security; ++ stdenv.lib.optional stdenv.isDarwin pkgs.darwin.Security;
postHook = '' postHook = ''
checkPhase() { checkPhase() (
( cd "${builtins.toString ./.}/ofborg" && cargo build && cargo test) 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"; RUSTFLAGS = "-D warnings";
RUST_BACKTRACE = "1"; RUST_BACKTRACE = "1";
RUST_LOG = "ofborg=debug";
NIX_PATH = "nixpkgs=${pkgs.path}"; NIX_PATH = "nixpkgs=${pkgs.path}";
passthru.phpEnv = phpEnv;
} }
// stdenv.lib.optionalAttrs stdenv.isLinux { // stdenv.lib.optionalAttrs stdenv.isLinux {
LOCALE_ARCHIVE_2_21 = "${oldpkgs.glibcLocales}/lib/locale/locale-archive"; LOCALE_ARCHIVE_2_21 = "${oldpkgs.glibcLocales}/lib/locale/locale-archive";
@ -97,6 +99,7 @@ let
RUST_LOG = "ofborg=debug"; RUST_LOG = "ofborg=debug";
NIX_PATH = "nixpkgs=${pkgs.path}"; NIX_PATH = "nixpkgs=${pkgs.path}";
passthru.phpEnv = phpEnv; passthru.phpEnv = phpEnv;
passthru.mozilla-rust-overlay = mozilla-rust-overlay;
} }
// stdenv.lib.optionalAttrs stdenv.isLinux { // stdenv.lib.optionalAttrs stdenv.isLinux {
LOCALE_ARCHIVE_2_21 = "${oldpkgs.glibcLocales}/lib/locale/locale-archive"; LOCALE_ARCHIVE_2_21 = "${oldpkgs.glibcLocales}/lib/locale/locale-archive";