Merge pull request #1392 from rtfeldman/edit

Add a CI step to verify no untracked git changes
This commit is contained in:
Richard Feldman 2021-06-07 22:12:01 -04:00 committed by GitHub
commit 571401f0ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 10 deletions

View File

@ -110,12 +110,24 @@ test-rust:
RUN --mount=type=cache,target=$SCCACHE_DIR \
cargo test --release && sccache --show-stats
verify-no-git-changes:
FROM +test-rust
# If running tests caused anything to be changed or added (without being
# included in a .gitignore somewhere), fail the build!
#
# How it works: the `git ls-files` command lists all the modified or
# uncommitted files in the working tree, the `| grep -E .` command returns a
# zero exit code if it listed any files and nonzero otherwise (which is the
# opposite of what we want), and the `!` at the start inverts the exit code.
RUN ! git ls-files --deleted --modified --others --exclude-standard | grep -E .
test-all:
BUILD +test-zig
BUILD +check-rustfmt
BUILD +check-clippy
BUILD +check-typos
BUILD +test-rust
BUILD +verify-no-git-changes
bench-roc:
FROM +copy-dirs-and-cache

View File

@ -30,7 +30,7 @@ pub const DIRECTORY_OR_FILES: &str = "DIRECTORY_OR_FILES";
pub const ARGS_FOR_APP: &str = "ARGS_FOR_APP";
pub fn build_app<'a>() -> App<'a> {
App::new("roc")
let app = App::new("roc")
.version(crate_version!())
.subcommand(App::new(CMD_BUILD)
.about("Build a program")
@ -81,15 +81,6 @@ pub fn build_app<'a>() -> App<'a> {
.subcommand(App::new(CMD_REPL)
.about("Launch the interactive Read Eval Print Loop (REPL)")
)
.subcommand(App::new(CMD_EDIT)
.about("Launch the Roc editor")
.arg(Arg::with_name(DIRECTORY_OR_FILES)
.index(1)
.multiple(true)
.required(false)
.help("(optional) The directory or files to open on launch.")
)
)
.subcommand(
App::new(CMD_DOCS)
.about("Generate documentation for Roc modules")
@ -100,7 +91,21 @@ pub fn build_app<'a>() -> App<'a> {
.help("The directory or files to build documentation for")
)
);
if cfg!(feature = "edit") {
app.subcommand(
App::new(CMD_EDIT).about("Launch the Roc editor").arg(
Arg::with_name(DIRECTORY_OR_FILES)
.index(1)
.multiple(true)
.required(false)
.help("(optional) The directory or files to open on launch."),
),
)
} else {
app
}
}
pub fn docs(files: Vec<PathBuf>) {