diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0a6afd..e7804e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,17 +6,6 @@ on: pull_request: jobs: - pedantry: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Install Nix - uses: cachix/install-nix-action@v12 - with: - nix_path: nixpkgs=channel:nixos-unstable - - name: Cargo Pedantry - run: nix-shell --run checkPhase -A mozilla-rust-overlay - checkPhase: runs-on: ubuntu-latest steps: @@ -30,8 +19,8 @@ jobs: git config --global user.email "ofborg@example.com" git config --global user.name "ofborg" - name: checkPhase - run: nix-shell --run checkPhase - + run: nix-shell --pure --run checkPhase + nix-build: runs-on: ubuntu-latest steps: diff --git a/README.md b/README.md index 789dd89..fc66195 100644 --- a/README.md +++ b/README.md @@ -209,8 +209,7 @@ To test whether or not Continuous Integration will pass with your changes, you can run the following commands from the root of your checkout: ```shell -$ nix-shell --run checkPhase -A mozilla-rust-overlay # checks rustfmt and clippy -$ nix-shell --run checkPhase # runs the test suite +$ nix-shell --pure --run checkPhase # checks rustfmt, clippy & runs the test suite $ nix-build -A ofborg.rs # build ofborg ``` diff --git a/shell.nix b/shell.nix index ff4ddb5..badfdff 100644 --- a/shell.nix +++ b/shell.nix @@ -1,7 +1,6 @@ { pkgs ? import ./nix { overlays = [ (import ./nix/overlay.nix) - (import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz)) ]; } }: @@ -24,65 +23,49 @@ let # HISTFILE = "${src}/.bash_hist"; }; - mozilla-rust-overlay = stdenv.mkDerivation { - name = "mozilla-rust-overlay"; - buildInputs = with pkgs; [ - latest.rustChannels.stable.rust - git + rustEnv = stdenv.mkDerivation { + name = "gh-event-forwarder"; + nativeBuildInputs = with pkgs; [ + nix # so in --pure mode we actually find the "correct" nix + bash + nix-prefetch-git + rustPackages.cargo + rustPackages.clippy + rustPackages.rustfmt pkg-config + git + ]; + buildInputs = with pkgs; [ openssl ] ++ lib.optional stdenv.isDarwin pkgs.darwin.Security; postHook = '' checkPhase() ( - cd "${builtins.toString ./.}/ofborg" + cd "${builtins.toString ./.}/ofborg" + set -x + cargo fmt + git diff --exit-code + cargofmtexit=$? + + cargo clippy + cargoclippyexit=$? + - set -x + cargo build && cargo test + cargotestexit=$? - cargo fmt - git diff --exit-code - cargofmtexit=$? - - cargo clippy - cargoclippyexit=$? - - sum=$((cargofmtexit + cargoclippyexit)) - exit $sum + sum=$((cargofmtexit + cargoclippyexit + cargotestexit)) + exit $sum ) ''; - RUSTFLAGS = "-D warnings"; - RUST_BACKTRACE = "1"; - NIX_PATH = "nixpkgs=${pkgs.path}"; - }; - - rustEnv = stdenv.mkDerivation { - name = "gh-event-forwarder"; - buildInputs = with pkgs; [ - bash - nix-prefetch-git - latest.rustChannels.stable.rust - #rustfmt - openssl - pkg-config - git - ] - ++ lib.optional stdenv.isDarwin pkgs.darwin.Security; - - postHook = '' - checkPhase() { - ( cd "${builtins.toString ./.}/ofborg" && cargo build && cargo test) - } - ''; - HISTFILE = "${toString ./.}/.bash_hist"; RUSTFLAGS = "-D warnings"; RUST_BACKTRACE = "1"; RUST_LOG = "ofborg=debug"; NIX_PATH = "nixpkgs=${pkgs.path}"; passthru.phpEnv = phpEnv; - passthru.mozilla-rust-overlay = mozilla-rust-overlay; }; in rustEnv