Skip to content

Commit

Permalink
Merge pull request #1604 from duthils/gh-actions-linters
Browse files Browse the repository at this point in the history
GitHub Actions linter for Rust formatting
  • Loading branch information
felixfontein authored Sep 12, 2024
2 parents 1f01213 + 6475dae commit 301e350
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Linters

on:
push:
branches:
- main
pull_request:
branches:
- main
# Only run when linted files change
paths:
- 'functional-tests/**/*.rs'

permissions:
contents: read

jobs:
lint:
name: Lint Rust source files
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Install rustup
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain 1.70.0

- name: Run Formatting Check
run: cargo fmt --check
working-directory: ./functional-tests
12 changes: 8 additions & 4 deletions functional-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,10 @@ b: ba"#
#[test]
fn unset_json_file() {
// Test removal of tree branch
let file_path =
prepare_temp_file("test_unset.json", r#"{"a": 2, "b": "ba", "c": [1,2]}"#.as_bytes());
let file_path = prepare_temp_file(
"test_unset.json",
r#"{"a": 2, "b": "ba", "c": [1,2]}"#.as_bytes(),
);
assert!(
Command::new(SOPS_BINARY_PATH)
.arg("encrypt")
Expand Down Expand Up @@ -661,8 +663,10 @@ b: ba"#
#[test]
fn unset_yaml_file() {
// Test removal of tree branch
let file_path =
prepare_temp_file("test_unset.yaml", r#"{"a": 2, "b": "ba", "c": [1,2]}"#.as_bytes());
let file_path = prepare_temp_file(
"test_unset.yaml",
r#"{"a": 2, "b": "ba", "c": [1,2]}"#.as_bytes(),
);
assert!(
Command::new(SOPS_BINARY_PATH)
.arg("encrypt")
Expand Down

0 comments on commit 301e350

Please sign in to comment.