Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip generating changelog in tests #492

Merged
merged 1 commit into from
Jan 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,6 @@ jobs:

steps:
- uses: actions/checkout@v2
if: github.event_name == 'pull_request'
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0

- uses: actions/checkout@v2
if: github.event_name != 'pull_request'
with:
fetch-depth: 0

Expand Down Expand Up @@ -115,7 +108,7 @@ jobs:
if: matrix.os == 'macos-latest'
run: |
brew install help2man
cargo run --package gen -- --bin target/debug/imdl all
cargo run --package gen -- --bin target/debug/imdl all --no-changelog
git diff --no-ext-diff --exit-code

- name: Install `mdbook`
Expand All @@ -127,7 +120,7 @@ jobs:
- name: Build Book
if: matrix.os != 'windows-latest'
run: |
cargo run --package gen -- --bin target/debug/imdl book
cargo run --package gen -- --bin target/debug/imdl book --no-changelog
mdbook build book --dest-dir ../www/book

- name: Record Git Revision
Expand Down
32 changes: 12 additions & 20 deletions bin/gen/src/subcommand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,13 @@ use crate::common::*;
pub(crate) enum Subcommand {
#[structopt(about("Update all generated docs"))]
All {
#[structopt(
long = "no-git",
help = "Skip generated outputs that require a Git repository. Currently this only includes \
the changelog."
)]
no_git: bool,
#[structopt(long = "no-changelog", help = "Don't generate the changelog.")]
no_changelog: bool,
},
#[structopt(about("Generate book"))]
Book {
#[structopt(
long = "no-git",
help = "Skip book contents require a Git repository. Currently this only includes the \
changelog."
)]
no_git: bool,
#[structopt(long = "no-changelog", help = "Don't generate the changelog.")]
no_changelog: bool,
},
#[structopt(about("Generate the changelog"))]
Changelog,
Expand Down Expand Up @@ -84,21 +76,21 @@ impl Subcommand {
}
Self::CompletionScripts => Self::completion_scripts(&project)?,
Self::Readme => Self::readme(&project)?,
Self::Book { no_git } => Self::book(&project, no_git)?,
Self::Book { no_changelog } => Self::book(&project, no_changelog)?,
Self::Man => Self::man(&project)?,
Self::Diff => Self::diff(&project)?,
Self::All { no_git } => Self::all(&project, no_git)?,
Self::All { no_changelog } => Self::all(&project, no_changelog)?,
}
}

#[throws]
pub(crate) fn all(project: &Project, no_git: bool) {
if !no_git {
pub(crate) fn all(project: &Project, no_changelog: bool) {
if !no_changelog {
Self::changelog(&project)?;
}
Self::completion_scripts(&project)?;
Self::readme(&project)?;
Self::book(&project, no_git)?;
Self::book(&project, no_changelog)?;
Self::man(&project)?;
}

Expand Down Expand Up @@ -195,7 +187,7 @@ impl Subcommand {
}

#[throws]
pub(crate) fn book(project: &Project, no_git: bool) {
pub(crate) fn book(project: &Project, no_changelog: bool) {
info!("Generating book…");

let gen = project.gen()?;
Expand Down Expand Up @@ -230,11 +222,11 @@ impl Subcommand {

Introduction::new(&project.config).render_to(out.join("introduction.md"))?;

let include_changelog = !no_git;
let include_changelog = !no_changelog;

Summary::new(project, include_changelog).render_to(out.join("SUMMARY.md"))?;

if !no_git {
if !no_changelog {
let changelog = Changelog::new(&project)?;
let dst = out.join("changelog.md");
fs::write(&dst, changelog.render(true)?).context(error::Filesystem { path: dst })?;
Expand Down