diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 417175e..4ec5117 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,73 +1,29 @@ -# Based on https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md - name: CI + on: - push: - branches: - - "**" + push: { branches: ["**"] } + pull_request: { branches: ["**"] } jobs: - check: - name: Check + ci: + name: Rust CI runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v2 - - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - - name: Run cargo check - uses: actions-rs/cargo@v1 - with: - command: check - test: - name: Test Suite - runs-on: ubuntu-latest steps: - - name: Checkout sources - uses: actions/checkout@v2 - - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true + - name: Checkout + uses: actions/checkout@v4 - - name: Run cargo test - uses: actions-rs/cargo@v1 - with: - command: test + - name: Install Rust (stable) + uses: dtolnay/rust-toolchain@stable - lints: - name: Lints - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v2 + - name: Cache Cargo + uses: Swatinem/rust-cache@v2 - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - components: rustfmt, clippy + - name: Format check + run: cargo fmt --all -- --check - - name: Run cargo fmt - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + - name: Clippy (deny warnings) + run: cargo clippy --all-targets --all-features -- -D warnings - - name: Run cargo clippy - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -- -D warnings + - name: Unit tests + run: cargo test --all --all-features --verbose diff --git a/src/lib.rs b/src/lib.rs index bfdf14f..a4ef376 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -173,7 +173,7 @@ impl Loader { /// Read file data into string from path fn read_file(path: &str) -> Result { - let mut file = File::open(&path)?; + let mut file = File::open(path)?; let mut data_file = String::new(); file.read_to_string(&mut data_file)?; Ok(data_file)