Add a test crate

This commit is contained in:
Nathan McCarty 2023-05-13 15:14:36 -04:00
parent f7df7c43b6
commit 5237226018
Signed by: thatonelutenist
SSH Key Fingerprint: SHA256:hwQEcmak9E6sdU9bXc98RHw/Xd1AhpB5HZT7ZSVJkRM
8 changed files with 59 additions and 0 deletions

2
.gitignore vendored
View File

@ -3,3 +3,5 @@
*.log *.log
tmp/ tmp/
result result
result-doc
target

1
test-crate/.envrc Normal file
View File

@ -0,0 +1 @@
use flake

7
test-crate/Cargo.lock generated Normal file
View File

@ -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"

8
test-crate/Cargo.toml Normal file
View File

@ -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]

26
test-crate/ci.sh Executable file
View File

@ -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

10
test-crate/flake.nix Normal file
View File

@ -0,0 +1,10 @@
{
inputs = { rust = { url = "./.."; }; };
description = "Simple Test Package";
outputs = { self, nixpkgs, rust }:
rust.single {
crateName = "test-crate";
src = ./.;
};
}

2
test-crate/src/lib.rs Normal file
View File

@ -0,0 +1,2 @@
/// Doc comment
pub fn thing() {}

3
test-crate/src/main.rs Normal file
View File

@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}