forked from the-distro/ofborg
Remove the usage of the mozilla rust overlay
By switching to the tools bundled within nixpkgs we can provide a much more "pure" development environment that doesn't randomly change over time. Previously we would be using the latest and greatest version of the formatting and linting tools while our development environment only offered whatever was in the (old) nixpkgs pin. Nowadays we have all the tools we need in nixpkgs and can thus use those instead. By following nixpkgs more closely we can make sure to make use of those tools in this project as well. Hopefully removing the "yearly churn" of doing big migrations. For the meantime I allowed the upper case acronyms check (and a few other minor lints) in the clippy configuration. This will allow a smoother transition towards the newer clippy code that is decoupled from the actual linting changes.
This commit is contained in:
parent
b29f146bd7
commit
986be3ceb7
15
.github/workflows/ci.yml
vendored
15
.github/workflows/ci.yml
vendored
|
@ -6,17 +6,6 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
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:
|
checkPhase:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
@ -30,8 +19,8 @@ jobs:
|
||||||
git config --global user.email "ofborg@example.com"
|
git config --global user.email "ofborg@example.com"
|
||||||
git config --global user.name "ofborg"
|
git config --global user.name "ofborg"
|
||||||
- name: checkPhase
|
- name: checkPhase
|
||||||
run: nix-shell --run checkPhase
|
run: nix-shell --pure --run checkPhase
|
||||||
|
|
||||||
nix-build:
|
nix-build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
|
@ -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:
|
can run the following commands from the root of your checkout:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ nix-shell --run checkPhase -A mozilla-rust-overlay # checks rustfmt and clippy
|
$ nix-shell --pure --run checkPhase # checks rustfmt, clippy & runs the test suite
|
||||||
$ nix-shell --run checkPhase # runs the test suite
|
|
||||||
$ nix-build -A ofborg.rs # build ofborg
|
$ nix-build -A ofborg.rs # build ofborg
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
67
shell.nix
67
shell.nix
|
@ -1,7 +1,6 @@
|
||||||
{ pkgs ? import ./nix {
|
{ pkgs ? import ./nix {
|
||||||
overlays = [
|
overlays = [
|
||||||
(import ./nix/overlay.nix)
|
(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";
|
# HISTFILE = "${src}/.bash_hist";
|
||||||
};
|
};
|
||||||
|
|
||||||
mozilla-rust-overlay = stdenv.mkDerivation {
|
rustEnv = stdenv.mkDerivation {
|
||||||
name = "mozilla-rust-overlay";
|
name = "gh-event-forwarder";
|
||||||
buildInputs = with pkgs; [
|
nativeBuildInputs = with pkgs; [
|
||||||
latest.rustChannels.stable.rust
|
nix # so in --pure mode we actually find the "correct" nix
|
||||||
git
|
bash
|
||||||
|
nix-prefetch-git
|
||||||
|
rustPackages.cargo
|
||||||
|
rustPackages.clippy
|
||||||
|
rustPackages.rustfmt
|
||||||
pkg-config
|
pkg-config
|
||||||
|
git
|
||||||
|
];
|
||||||
|
buildInputs = with pkgs; [
|
||||||
openssl
|
openssl
|
||||||
]
|
]
|
||||||
++ lib.optional stdenv.isDarwin pkgs.darwin.Security;
|
++ lib.optional stdenv.isDarwin pkgs.darwin.Security;
|
||||||
|
|
||||||
postHook = ''
|
postHook = ''
|
||||||
checkPhase() (
|
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
|
sum=$((cargofmtexit + cargoclippyexit + cargotestexit))
|
||||||
git diff --exit-code
|
exit $sum
|
||||||
cargofmtexit=$?
|
|
||||||
|
|
||||||
cargo clippy
|
|
||||||
cargoclippyexit=$?
|
|
||||||
|
|
||||||
sum=$((cargofmtexit + cargoclippyexit))
|
|
||||||
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";
|
HISTFILE = "${toString ./.}/.bash_hist";
|
||||||
RUSTFLAGS = "-D warnings";
|
RUSTFLAGS = "-D warnings";
|
||||||
RUST_BACKTRACE = "1";
|
RUST_BACKTRACE = "1";
|
||||||
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;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
in rustEnv
|
in rustEnv
|
||||||
|
|
Loading…
Reference in a new issue