diff --git a/.gitignore b/.gitignore index 1f4d430..9186345 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ *.log tmp/ result +result-doc +target diff --git a/test-crate/.envrc b/test-crate/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/test-crate/.envrc @@ -0,0 +1 @@ +use flake diff --git a/test-crate/Cargo.lock b/test-crate/Cargo.lock new file mode 100644 index 0000000..a9186e0 --- /dev/null +++ b/test-crate/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "test-crate" +version = "0.1.0" diff --git a/test-crate/Cargo.toml b/test-crate/Cargo.toml new file mode 100644 index 0000000..22ef43c --- /dev/null +++ b/test-crate/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "test-crate" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/test-crate/ci.sh b/test-crate/ci.sh new file mode 100755 index 0000000..49abc39 --- /dev/null +++ b/test-crate/ci.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +### +## This script replicates the same steps as ci, except for cargo audit +### + +# Turn on the guard rails +set -exuo pipefail + +CRATE="test-crate" + +## TODO use subshell magic to make a nice interface here + +# Lint the formatting +nix build .#lints.format.$CRATE -L +# Audit it +nix develop -c cargo audit +# Run clippy +nix build .#lints.clippy.$CRATE -L +# Build it +nix build .#$CRATE -L +# Test it +nix develop -c cargo nextest run +nix develop -c cargo test --doc +# Document it +nix build .#docs.$CRATE.doc -L diff --git a/test-crate/flake.nix b/test-crate/flake.nix new file mode 100644 index 0000000..b1e169b --- /dev/null +++ b/test-crate/flake.nix @@ -0,0 +1,10 @@ +{ + inputs = { rust = { url = "./.."; }; }; + description = "Simple Test Package"; + + outputs = { self, nixpkgs, rust }: + rust.single { + crateName = "test-crate"; + src = ./.; + }; +} diff --git a/test-crate/src/lib.rs b/test-crate/src/lib.rs new file mode 100644 index 0000000..66016b8 --- /dev/null +++ b/test-crate/src/lib.rs @@ -0,0 +1,2 @@ +/// Doc comment +pub fn thing() {} diff --git a/test-crate/src/main.rs b/test-crate/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/test-crate/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +}