Skip to content

Commit

Permalink
Run actionlint and shellcheck in Rust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
smoelius committed Sep 6, 2024
1 parent 65d6ce4 commit 6253e56
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,6 @@ jobs:
- name: Install dylint-link
run: cargo install --path ./dylint-link --force

- name: Actionlint
run: |
go install github.com/rhysd/actionlint/cmd/actionlint@latest
"$HOME"/go/bin/actionlint
- name: Shellcheck
run: shellcheck --exclude=SC2002 scripts/*

- name: Install tools
run: |
# smoelius: Prettier is still needed for scripts/update_example_READMEs.sh.
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cargo-dylint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ assert_cmd = "2.0"
cargo_metadata = "0.18"
ctor = "0.2"
glob = "0.3"
home = "0.5"
log = "0.4"
once_cell = "1.19"
predicates = "3.1"
Expand Down
27 changes: 27 additions & 0 deletions cargo-dylint/tests/ci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ fn initialize() {
set_var(env::CARGO_TERM_COLOR, "never");
}

#[test]
fn actionlint() {
Command::new("go")
.args([
"install",
"github.com/rhysd/actionlint/cmd/actionlint@latest",
])
.assert()
.success();
let home = home::home_dir().unwrap();
Command::new(home.join("go/bin/actionlint"))
.assert()
.success();
}

#[test]
fn versions_are_equal() {
for package in &METADATA.packages {
Expand Down Expand Up @@ -473,6 +488,18 @@ fn prettier_examples_and_template() {
});
}

#[test]
fn shellcheck() {
for entry in read_dir("scripts").unwrap() {
let entry = entry.unwrap();
let path = entry.path();
Command::new("shellcheck")
.args(["--exclude=SC2002", &path.to_string_lossy()])
.assert()
.success();
}
}

#[test]
fn sort() {
for entry in walkdir(true).with_file_name("Cargo.toml") {
Expand Down

0 comments on commit 6253e56

Please sign in to comment.