Skip to content

Commit

Permalink
Use workspace for xtask (#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajeetdsouza authored Oct 11, 2021
1 parent 8ec3a8b commit 0791356
Show file tree
Hide file tree
Showing 12 changed files with 309 additions and 281 deletions.
2 changes: 1 addition & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[alias]
xtask = "run --manifest-path ./xtask/Cargo.toml --"
xtask = "run --package xtask --"
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:
if: ${{ matrix.os != 'windows-latest' }}
with:
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/20.09.tar.gz
- run: cargo xtask --nix=${{ matrix.os != 'windows-latest' }} ci
- run: cargo xtask ci
157 changes: 145 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 11 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ license = "MIT"
keywords = ["cli"]
categories = ["command-line-utilities", "filesystem"]

[badges]
maintenance = { status = "actively-developed" }

[workspace]
members = ["xtask/"]

[dependencies]
anyhow = "1.0.32"
askama = { version = "0.10.3", default-features = false }
Expand All @@ -27,17 +33,17 @@ rand = { version = "0.8.4", features = [
"small_rng",
], default-features = false }

[dev-dependencies]
assert_cmd = "2.0.0"
rstest = "0.11.0"

[build-dependencies]
clap = "=3.0.0-beta.4"
clap_generate = "=3.0.0-beta.4"

[dev-dependencies]
assert_cmd = "2.0.0"
rstest = "0.11.0"

[features]
default = []
nix_tests = []
nix = []

[profile.release]
codegen-units = 1
Expand Down
11 changes: 7 additions & 4 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
let
rust = import (builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/ad311f5bb5c5ef475985f1e0f264e831470a8510.tar.gz");
rust = import (builtins.fetchTarball
"https://github.com/oxalica/rust-overlay/archive/ad311f5bb5c5ef475985f1e0f264e831470a8510.tar.gz");
pkgs = import <nixpkgs> { overlays = [ rust ]; };
pkgs-latest = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/b4692e4197869c42c46d77e31af7e687e1892f55.tar.gz") {};
in
pkgs.mkShell {
pkgs-latest = import (fetchTarball
"https://github.com/NixOS/nixpkgs/archive/b4692e4197869c42c46d77e31af7e687e1892f55.tar.gz")
{ };
in pkgs.mkShell {
buildInputs = [
# Rust
pkgs.rust-bin.stable.latest.default
Expand All @@ -21,6 +23,7 @@ pkgs.mkShell {
# Tools
pkgs-latest.cargo-audit
pkgs-latest.mandoc
pkgs-latest.nixfmt
pkgs-latest.nodePackages.markdownlint-cli
pkgs-latest.python3Packages.black
pkgs-latest.python3Packages.mypy
Expand Down
13 changes: 2 additions & 11 deletions src/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ make_template!(Powershell, "powershell.txt");
make_template!(Xonsh, "xonsh.txt");
make_template!(Zsh, "zsh.txt");

#[cfg(feature = "nix_tests")]
#[cfg(feature = "nix")]
#[cfg(test)]
mod tests {
use askama::Template;
Expand Down Expand Up @@ -321,16 +321,7 @@ mod tests {
let mut source = Xonsh(&opts).render().unwrap();
source.push('\n');

let tempdir = tempfile::tempdir().unwrap();
let tempdir = tempdir.path().to_str().unwrap();

Command::new("pylint")
.args(&["--from-stdin", "zoxide"])
.env("HOME", tempdir)
.write_stdin(source)
.assert()
.success()
.stderr("");
Command::new("pylint").args(&["--from-stdin", "zoxide"]).write_stdin(source).assert().success().stderr("");
}

#[rstest]
Expand Down
Loading

0 comments on commit 0791356

Please sign in to comment.