From 8ff1a40cf4796b47d106907131d73058e70adf35 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Fri, 17 Dec 2021 14:28:44 +0100 Subject: [PATCH 01/14] feat: Create Title struct for title line --- src/lib.rs | 71 +++++++++++++++++++++++++++++++++++++++++------- tests/demo.rs | 3 ++ tests/demo.troff | 4 +-- 3 files changed, 66 insertions(+), 12 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 0947e28..ee2a34f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,21 +1,77 @@ use std::fmt::Write; #[derive(PartialEq, Eq)] -pub struct Roff { +/// Title line for a manpage. +pub struct Title { title: String, section: i8, + date: Option, + source: Option, + manual: Option, +} + +impl Title { + pub fn new(title: &str, section: i8) -> Self { + Title { + title: title.into(), + section, + date: None, + source: None, + manual: None, + } + } +} + +impl Troffable for Title { + fn render(&self) -> String { + let manual = self.manual.as_deref().unwrap_or_default(); + let date = self.date.as_deref().unwrap_or_default(); + let source = self.source.as_deref().unwrap_or_default(); + + format!( + r#".TH "{}" "{}" "{}" "{}" "{}""#, + self.title.to_uppercase(), + self.section, + date, + source, + manual + ) + } +} + +#[derive(PartialEq, Eq)] +pub struct Roff { + title: Title, content: Vec
, } impl Roff { pub fn new(title: &str, section: i8) -> Self { Roff { - title: title.into(), - section, + title: Title::new(title, section), content: Vec::new(), } } + /// Date of the last nontrivial change to the manpage. Should be formatted + /// in `YYYY-MM-DD`. + pub fn date(mut self, date: impl Into) -> Self { + self.title.date = Some(date.into()); + self + } + + /// The source of the command, function or system call. + pub fn source(mut self, source: impl Into) -> Self { + self.title.source = Some(source.into()); + self + } + + /// The title of the manual. + pub fn manual(mut self, manual: impl Into) -> Self { + self.title.manual = Some(manual.into()); + self + } + pub fn section<'a, C, I>(mut self, title: &str, content: I) -> Self where I: IntoIterator, @@ -33,13 +89,8 @@ impl Troffable for Roff { fn render(&self) -> String { let mut res = String::new(); - writeln!( - &mut res, - ".TH {} {}", - self.title.to_uppercase(), - self.section - ) - .unwrap(); + writeln!(&mut res, "{}", self.title.render()).unwrap(); + for section in &self.content { writeln!(&mut res, "{}", escape(§ion.render())).unwrap(); } diff --git a/tests/demo.rs b/tests/demo.rs index 2b51994..b6b4793 100644 --- a/tests/demo.rs +++ b/tests/demo.rs @@ -16,6 +16,9 @@ fn demo() { use roff::*; let page = Roff::new("corrupt", 1) + .date("2021-12-25") + .manual("General Commands Manual") + .source("corrupt v1") .section( "name", &["corrupt - modify files by randomly changing bits"], diff --git a/tests/demo.troff b/tests/demo.troff index d02b16d..e3bcd7e 100644 --- a/tests/demo.troff +++ b/tests/demo.troff @@ -1,4 +1,4 @@ -.TH CORRUPT 1 +.TH "CORRUPT" "1" "2021-12-25" "corrupt v1" "General Commands Manual" .SH NAME corrupt \- modify files by randomly changing bits .SH SYNOPSIS @@ -13,4 +13,4 @@ modifies files by toggling a randomly chosen bit. .TP .BR \-n ", " \-\-bits =\fIBITS\fR Set the number of bits to modify. -Default is one bit. \ No newline at end of file +Default is one bit. From 0fb32f2407d8539181c0a02c776711bd41622acd Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Fri, 17 Dec 2021 14:31:15 +0100 Subject: [PATCH 02/14] fix: Wrap section titles in quotes --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index ee2a34f..fdc3101 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -109,7 +109,7 @@ impl Troffable for Section { fn render(&self) -> String { let mut res = String::new(); - writeln!(&mut res, ".SH {}", self.title.to_uppercase()).unwrap(); + writeln!(&mut res, ".SH \"{}\"", self.title.to_uppercase()).unwrap(); res.push_str(&self.content); res From d485bbf8a050e7eb6a7e8919c9830c50d5fca19d Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Fri, 17 Dec 2021 14:31:51 +0100 Subject: [PATCH 03/14] fix: Update demo.troff to match new output --- tests/demo.troff | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/tests/demo.troff b/tests/demo.troff index e3bcd7e..015a066 100644 --- a/tests/demo.troff +++ b/tests/demo.troff @@ -1,16 +1,11 @@ .TH "CORRUPT" "1" "2021-12-25" "corrupt v1" "General Commands Manual" -.SH NAME +.SH "NAME" corrupt \- modify files by randomly changing bits -.SH SYNOPSIS -.B corrupt -[\fB\-n\fR \fIBITS\fR] -[\fB\-\-bits\fR \fIBITS\fR] -.IR file ... -.SH DESCRIPTION -.B corrupt -modifies files by toggling a randomly chosen bit. -.SH OPTIONS +.SH "SYNOPSIS" +\fBcorrupt\fP [\fB\-n\fP \fIBITS\fP] [\fB\-\-bits\fP \fIBITS\fP] \fIfile\fP... +.SH "DESCRIPTION" +\fBcorrupt\fP modifies files by toggling a randomly chosen bit. +.SH "OPTIONS" .TP -.BR \-n ", " \-\-bits =\fIBITS\fR -Set the number of bits to modify. -Default is one bit. +\fB\-n\fP, \fB\-\-bits\fP=\fIBITS\fP +Set the number of bits to modify. Default is one bit. From 5d928a468f4dab53100317e150026c635b5aad14 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Fri, 17 Dec 2021 14:43:29 +0100 Subject: [PATCH 04/14] fix: Clippy lints --- src/lib.rs | 4 ++-- tests/demo.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index fdc3101..b66fd9e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -78,7 +78,7 @@ impl Roff { C: Troffable + 'a, { let title = title.into(); - let content = content.into_iter().map(|x| x.render()).collect(); + let content = content.into_iter().map(Troffable::render).collect(); self.content.push(Section { title, content }); self @@ -152,7 +152,7 @@ pub fn italic(input: &str) -> String { format!(r"\fI{}\fP", input) } -pub fn list(header: &'_ [C1], content: &'_ [C2]) -> String { +pub fn list(header: &[C1], content: &[C2]) -> String { format!(".TP\n{}\n{}", header.render(), content.render()) } diff --git a/tests/demo.rs b/tests/demo.rs index b6b4793..9eb564a 100644 --- a/tests/demo.rs +++ b/tests/demo.rs @@ -67,7 +67,7 @@ fn demo() { // use std::io::Write; // let mut f = ::std::fs::File::create("./tests/demo.generated.troff").unwrap(); - // f.write_all(&page.render().as_bytes()); + // f.write_all(&page.render().as_bytes()).unwrap(); assert_eq!( roff_to_ascii(include_str!("./demo.troff")), From 749f4433498d11504f4255311752d86d17afb5ec Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Fri, 17 Dec 2021 14:46:33 +0100 Subject: [PATCH 05/14] chore: Move to GitHub Actions for CI --- .github/workflows/pipeline.yml | 43 ++++++++++++++++++++++++++++++++++ README.md | 8 ++++--- 2 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/pipeline.yml diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml new file mode 100644 index 0000000..b90c979 --- /dev/null +++ b/.github/workflows/pipeline.yml @@ -0,0 +1,43 @@ +name: pipeline + +on: [push, pull_request] + +jobs: + check: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + components: rustfmt, clippy + + - uses: Swatinem/rust-cache@v1 + + - name: build + uses: actions-rs/cargo@v1 + with: + command: test + args: --no-run + + - name: test + uses: actions-rs/cargo@v1 + with: + command: test + args: -- --nocapture --quiet + + - name: formatting + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + - name: check + uses: actions-rs/cargo@v1 + with: + command: check + diff --git a/README.md b/README.md index cdb5382..294cbd1 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,10 @@ # roff-rs +[![Build Status](https://github.com/rust-cli/roff-rs/workflows/pipeline/badge.svg)][CI] [![Documentation](https://img.shields.io/badge/docs-master-blue.svg)][Documentation] ![License](https://img.shields.io/crates/l/roff.svg) [![crates.io](https://img.shields.io/crates/v/roff.svg)][Crates.io] -[Crates.io]: https://crates.io/crates/roff -[Documentation]: https://docs.rs/roff/ - [Roff](http://man7.org/linux/man-pages/man7/roff.7.html) generation library. ## Examples @@ -98,3 +96,7 @@ Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. + +[CI]: https://github.com/rust-cli/roff-rs/actions +[Crates.io]: https://crates.io/crates/roff +[Documentation]: https://docs.rs/roff/ From c300e9816d2b70c0906bdf9486db81fd2c5d9b4b Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Fri, 17 Dec 2021 14:53:32 +0100 Subject: [PATCH 06/14] chore: Create example --- .github/workflows/pipeline.yml | 6 ++++ examples/demo.rs | 59 ++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 examples/demo.rs diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index b90c979..398d2ad 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -30,6 +30,12 @@ jobs: command: test args: -- --nocapture --quiet + - name: examples + uses: actions-rs/cargo@v1 + with: + command: test + args: --examples -- --nocapture --quiet + - name: formatting uses: actions-rs/cargo@v1 with: diff --git a/examples/demo.rs b/examples/demo.rs new file mode 100644 index 0000000..a028668 --- /dev/null +++ b/examples/demo.rs @@ -0,0 +1,59 @@ +extern crate roff; + +// View this example by running `cargo run --example demo | man -l -`. + +fn main() { + use roff::*; + + let page = Roff::new("corrupt", 1) + .date("2021-12-25") + .manual("General Commands Manual") + .source("corrupt v1") + .section( + "name", + &["corrupt - modify files by randomly changing bits"], + ) + .section( + "SYNOPSIS", + &[ + bold("corrupt"), + " ".into(), + "[".into(), + bold("-n"), + " ".into(), + italic("BITS"), + "]".into(), + " ".into(), + "[".into(), + bold("--bits"), + " ".into(), + italic("BITS"), + "]".into(), + " ".into(), + italic("file"), + "...".into(), + ], + ) + .section( + "description", + &[ + bold("corrupt"), + " modifies files by toggling a randomly chosen bit.".into(), + ], + ) + .section( + "options", + &[list( + &[ + bold("-n"), + ", ".into(), + bold("--bits"), + "=".into(), + italic("BITS"), + ], + &["Set the number of bits to modify. ", "Default is one bit."], + )], + ); + + println!("{}", page.render()); +} From 19d169ae8c904f8a4b094637baf57890193fac9e Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Fri, 17 Dec 2021 15:02:01 +0100 Subject: [PATCH 07/14] feat: Create enum for man page sections --- examples/demo.rs | 2 +- src/lib.rs | 49 ++++++++++++++++++++++++++++++++++++++++++++---- tests/demo.rs | 2 +- 3 files changed, 47 insertions(+), 6 deletions(-) diff --git a/examples/demo.rs b/examples/demo.rs index a028668..ef4850d 100644 --- a/examples/demo.rs +++ b/examples/demo.rs @@ -5,7 +5,7 @@ extern crate roff; fn main() { use roff::*; - let page = Roff::new("corrupt", 1) + let page = Roff::new("corrupt", ManSection::Executable) .date("2021-12-25") .manual("General Commands Manual") .source("corrupt v1") diff --git a/src/lib.rs b/src/lib.rs index b66fd9e..9ca9324 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,14 +4,14 @@ use std::fmt::Write; /// Title line for a manpage. pub struct Title { title: String, - section: i8, + section: ManSection, date: Option, source: Option, manual: Option, } impl Title { - pub fn new(title: &str, section: i8) -> Self { + pub fn new(title: &str, section: ManSection) -> Self { Title { title: title.into(), section, @@ -31,7 +31,7 @@ impl Troffable for Title { format!( r#".TH "{}" "{}" "{}" "{}" "{}""#, self.title.to_uppercase(), - self.section, + self.section.value(), date, source, manual @@ -39,6 +39,47 @@ impl Troffable for Title { } } +/// Manpage sections. +/// +/// The most common is [`ManSection::Executable`], and is the recommended default. +#[derive(PartialEq, Eq)] +pub enum ManSection { + /// Executable programs or shell commands + Executable, + /// System calls (functions provided by the kernel) + SystemCalls, + /// Library calls (functions within program libraries) + LibraryCalls, + /// Special files (usually found in /dev) + SpecialFiles, + /// File formats and conventions, e.g. /etc/passwd + FileFormats, + /// Games + Games, + /// Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7) + Miscellaneous, + /// System administration commands (usually only for root) + SystemAdministrationCommands, + /// Kernel routines [Non standard] + KernelRoutines, +} + +impl ManSection { + pub fn value(&self) -> i8 { + match self { + ManSection::Executable => 1, + ManSection::SystemCalls => 2, + ManSection::LibraryCalls => 3, + ManSection::SpecialFiles => 4, + ManSection::FileFormats => 5, + ManSection::Games => 6, + ManSection::Miscellaneous => 7, + ManSection::SystemAdministrationCommands => 8, + ManSection::KernelRoutines => 9, + } + } +} + #[derive(PartialEq, Eq)] pub struct Roff { title: Title, @@ -46,7 +87,7 @@ pub struct Roff { } impl Roff { - pub fn new(title: &str, section: i8) -> Self { + pub fn new(title: &str, section: ManSection) -> Self { Roff { title: Title::new(title, section), content: Vec::new(), diff --git a/tests/demo.rs b/tests/demo.rs index 9eb564a..bbbff44 100644 --- a/tests/demo.rs +++ b/tests/demo.rs @@ -15,7 +15,7 @@ fn roff_to_ascii(input: &str) -> String { fn demo() { use roff::*; - let page = Roff::new("corrupt", 1) + let page = Roff::new("corrupt", ManSection::Executable) .date("2021-12-25") .manual("General Commands Manual") .source("corrupt v1") From 251d935909f2bb4942788aec07d48954cae76e0c Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Fri, 17 Dec 2021 15:04:12 +0100 Subject: [PATCH 08/14] refactor: Remove uneeded PartialEq, Eq derives --- examples/demo.rs | 4 +--- src/lib.rs | 4 ---- tests/demo.rs | 4 +--- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/examples/demo.rs b/examples/demo.rs index ef4850d..639d75c 100644 --- a/examples/demo.rs +++ b/examples/demo.rs @@ -1,10 +1,8 @@ -extern crate roff; +use roff::*; // View this example by running `cargo run --example demo | man -l -`. fn main() { - use roff::*; - let page = Roff::new("corrupt", ManSection::Executable) .date("2021-12-25") .manual("General Commands Manual") diff --git a/src/lib.rs b/src/lib.rs index 9ca9324..9d6fa45 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,5 @@ use std::fmt::Write; -#[derive(PartialEq, Eq)] /// Title line for a manpage. pub struct Title { title: String, @@ -42,7 +41,6 @@ impl Troffable for Title { /// Manpage sections. /// /// The most common is [`ManSection::Executable`], and is the recommended default. -#[derive(PartialEq, Eq)] pub enum ManSection { /// Executable programs or shell commands Executable, @@ -80,7 +78,6 @@ impl ManSection { } } -#[derive(PartialEq, Eq)] pub struct Roff { title: Title, content: Vec
, @@ -140,7 +137,6 @@ impl Troffable for Roff { } } -#[derive(PartialEq, Eq)] struct Section { title: String, content: String, diff --git a/tests/demo.rs b/tests/demo.rs index bbbff44..22c2223 100644 --- a/tests/demo.rs +++ b/tests/demo.rs @@ -1,5 +1,5 @@ extern crate duct; -extern crate roff; +use roff::*; #[macro_use] extern crate pretty_assertions; @@ -13,8 +13,6 @@ fn roff_to_ascii(input: &str) -> String { #[test] fn demo() { - use roff::*; - let page = Roff::new("corrupt", ManSection::Executable) .date("2021-12-25") .manual("General Commands Manual") From 3d3515f9bc4b868255930f725e3caf3e77f76d3e Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Fri, 17 Dec 2021 15:18:28 +0100 Subject: [PATCH 09/14] chore: Remove devdeps, update .gitignore --- .gitignore | 16 +++++++++++++++- Cargo.toml | 4 ---- tests/demo.rs | 25 +++++++++++++++++-------- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index a9d37c5..f759ce2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,16 @@ -target +### Created by https://www.gitignore.io +### Rust ### +# Generated by Cargo +# will have compiled files and executables +debug/ +target/ + +# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries +# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html Cargo.lock + +# These are backup files generated by rustfmt +**/*.rs.bk + +# MSVC Windows builds of rustc generate these, which store debugging information +*.pdb diff --git a/Cargo.toml b/Cargo.toml index 5ba3f70..d783920 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,3 @@ pre-release-replacements = [ ] [dependencies] - -[dev-dependencies] -pretty_assertions = "1.0.0" -duct = "0.13" diff --git a/tests/demo.rs b/tests/demo.rs index 22c2223..8609397 100644 --- a/tests/demo.rs +++ b/tests/demo.rs @@ -1,14 +1,23 @@ -extern crate duct; +use std::{ + io::Write, + process::{Command, Stdio}, +}; + use roff::*; -#[macro_use] -extern crate pretty_assertions; fn roff_to_ascii(input: &str) -> String { - duct::cmd("troff", &["-a", "-mman"]) - .stdin_bytes(input) - .stdout_capture() - .read() - .unwrap() + let mut cmd = Command::new("troff") + .args(["-a", "-mman"]) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .spawn() + .unwrap(); + + if let Some(ref mut stdin) = cmd.stdin { + stdin.write_all(input.as_bytes()).unwrap(); + } + + String::from_utf8(cmd.wait_with_output().unwrap().stdout).unwrap() } #[test] From 6bb464db76848cf91beba149687607410a3966a3 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Fri, 17 Dec 2021 15:40:38 +0100 Subject: [PATCH 10/14] fix: Make escape function public --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 9d6fa45..2eb7fae 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -193,6 +193,6 @@ pub fn list(header: &[C1], content: &[C2]) -> Stri format!(".TP\n{}\n{}", header.render(), content.render()) } -fn escape(input: &str) -> String { +pub fn escape(input: &str) -> String { input.replace("-", r"\-") } From 9a5ca7f7a4562b4ae6277770a29fccf51da58fbb Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Fri, 17 Dec 2021 15:51:20 +0100 Subject: [PATCH 11/14] feat: Make ManSection derive Clone, Copy --- src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib.rs b/src/lib.rs index 2eb7fae..ceeb7d8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -41,6 +41,7 @@ impl Troffable for Title { /// Manpage sections. /// /// The most common is [`ManSection::Executable`], and is the recommended default. +#[derive(Clone, Copy)] pub enum ManSection { /// Executable programs or shell commands Executable, From d591ca80b23a1ef53dd0874192715749f91e9901 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Fri, 17 Dec 2021 15:59:44 +0100 Subject: [PATCH 12/14] fix: Add some compatibility settings to renderer --- src/lib.rs | 10 ++++++++++ tests/demo.troff | 3 +++ 2 files changed, 13 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index ceeb7d8..71b0d15 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -130,6 +130,16 @@ impl Troffable for Roff { writeln!(&mut res, "{}", self.title.render()).unwrap(); + // Compatibility settings: + // + // Set sentence_space_size to 0 to prevent extra space between sentences separated + // by a newline the alternative is to add \& at the end of the line + writeln!(&mut res, ".ss \\n[.ss] 0").unwrap(); + // Disable hyphenation + writeln!(&mut res, ".nh").unwrap(); + // Disable justification (adjust text to the left margin only) + writeln!(&mut res, ".ad l").unwrap(); + for section in &self.content { writeln!(&mut res, "{}", escape(§ion.render())).unwrap(); } diff --git a/tests/demo.troff b/tests/demo.troff index 015a066..6938c78 100644 --- a/tests/demo.troff +++ b/tests/demo.troff @@ -1,4 +1,7 @@ .TH "CORRUPT" "1" "2021-12-25" "corrupt v1" "General Commands Manual" +.ss \n[.ss] 0 +.nh +.ad l .SH "NAME" corrupt \- modify files by randomly changing bits .SH "SYNOPSIS" From d4a176a6c30da53c863f5e283190fb280b084f19 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Fri, 17 Dec 2021 16:14:45 +0100 Subject: [PATCH 13/14] feat: Add paragraph function --- src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 71b0d15..87835e9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -207,3 +207,7 @@ pub fn list(header: &[C1], content: &[C2]) -> Stri pub fn escape(input: &str) -> String { input.replace("-", r"\-") } + +pub fn paragraph(input: &str) -> String { + format!("\n.sp\n{}", input) +} From 54018979aed7ce313d8d6f7b2abdd95950df5b9d Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sat, 18 Dec 2021 14:55:17 +0100 Subject: [PATCH 14/14] chore: Refactor CI --- .github/workflows/ci.yml | 2 ++ .github/workflows/pipeline.yml | 49 ---------------------------------- 2 files changed, 2 insertions(+), 49 deletions(-) delete mode 100644 .github/workflows/pipeline.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 25f24bd..3f14ab6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,6 +70,8 @@ jobs: run: cargo test --workspace --all-features - name: No-default features run: cargo test --workspace --no-default-features + - name: Examples + run: cargo test --examples msrv: name: "Check MSRV: 1.54.0" needs: smoke diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml deleted file mode 100644 index 398d2ad..0000000 --- a/.github/workflows/pipeline.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: pipeline - -on: [push, pull_request] - -jobs: - check: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - components: rustfmt, clippy - - - uses: Swatinem/rust-cache@v1 - - - name: build - uses: actions-rs/cargo@v1 - with: - command: test - args: --no-run - - - name: test - uses: actions-rs/cargo@v1 - with: - command: test - args: -- --nocapture --quiet - - - name: examples - uses: actions-rs/cargo@v1 - with: - command: test - args: --examples -- --nocapture --quiet - - - name: formatting - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check - - - name: check - uses: actions-rs/cargo@v1 - with: - command: check -