From bbcd92f387814000eb54ba6a794a7a8278deef08 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Sun, 10 Sep 2023 05:21:06 -0400 Subject: [PATCH] Update workflow --- .github/workflows/release-rust.yaml | 11 +--- .github/workflows/validation-rust.yaml | 75 ++++++-------------------- udf-uuid/src/convert.rs | 4 +- udf-uuid/src/valid.rs | 2 +- 4 files changed, 20 insertions(+), 72 deletions(-) diff --git a/.github/workflows/release-rust.yaml b/.github/workflows/release-rust.yaml index c8233b4..2b484bc 100644 --- a/.github/workflows/release-rust.yaml +++ b/.github/workflows/release-rust.yaml @@ -43,19 +43,10 @@ jobs: # Retreive git files - uses: actions/checkout@v2 # Set cache configuration - - uses: actions/cache@v3 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - # Install cargo - uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.target }} + - uses: Swatinem/rust-cache@v2 - name: Show commands run: | echo pwd: diff --git a/.github/workflows/validation-rust.yaml b/.github/workflows/validation-rust.yaml index e24f86a..44aba92 100644 --- a/.github/workflows/validation-rust.yaml +++ b/.github/workflows/validation-rust.yaml @@ -15,7 +15,7 @@ name: Rust Validation env: RUSTDOCFLAGS: -D warnings - RUSTFLAGS: "-D warnings --cfg uuid_unstable" + RUSTFLAGS: -D warnings --cfg uuid_unstable -C debuginfo=1 CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse jobs: @@ -24,18 +24,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/cache@v3 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - uses: dtolnay/rust-toolchain@nightly + - uses: dtolnay/rust-toolchain@1.72.0 with: components: clippy + - uses: Swatinem/rust-cache@v2 - run: cargo clippy --all-features --all-targets -- -D warnings - run: cargo clippy --no-default-features --all-targets -- -D warnings @@ -66,16 +58,8 @@ jobs: run: | pwd ls - - uses: actions/cache@v3 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - uses: dtolnay/rust-toolchain@1.65.0 + - uses: dtolnay/rust-toolchain@1.68.0 + - uses: Swatinem/rust-cache@v2 - run: cargo test integration: @@ -83,16 +67,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/cache@v3 - id: cache-cargo - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Cache Docker layers uses: actions/cache@v2 id: cache-docker @@ -142,19 +116,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/cache@v3 - id: cache-cargo - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - uses: dtolnay/rust-toolchain@nightly with: components: miri + - uses: Swatinem/rust-cache@v2 - env: # Can't use chrono for time in isolation MIRIFLAGS: -Zmiri-disable-isolation @@ -165,18 +130,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/cache@v3 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - uses: dtolnay/rust-toolchain@nightly with: components: rustfmt + - uses: Swatinem/rust-cache@v2 - run: cargo fmt --all -- --check - uses: actions/setup-python@v3 - name: Validate pre-commit @@ -187,16 +144,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/cache@v3 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - uses: dtolnay/rust-toolchain@nightly + - uses: Swatinem/rust-cache@v2 - run: cargo doc @@ -209,3 +158,11 @@ jobs: - uses: actions/checkout@v3 - uses: dtolnay/install@cargo-outdated - run: cargo outdated --workspace --exit-code 1 --ignore lipsum + + security_audit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: rustsec/audit-check@v1.4.1 + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/udf-uuid/src/convert.rs b/udf-uuid/src/convert.rs index bfd35e9..f0b85c8 100644 --- a/udf-uuid/src/convert.rs +++ b/udf-uuid/src/convert.rs @@ -43,8 +43,8 @@ impl BasicUdf for UuidToBin { ) -> Result, ProcessError> { let input = args.get(0).unwrap().value(); let in_str = input.as_bytes().unwrap(); - let Ok(uuid) = Uuid::try_parse_ascii(in_str) else { - return Ok(None) + let Ok(uuid) = Uuid::try_parse_ascii(in_str) else { + return Ok(None); }; let bytes = uuid.as_bytes(); diff --git a/udf-uuid/src/valid.rs b/udf-uuid/src/valid.rs index 79312b9..c7ab4a9 100644 --- a/udf-uuid/src/valid.rs +++ b/udf-uuid/src/valid.rs @@ -25,7 +25,7 @@ impl BasicUdf for UuidIsValid { ) -> Result, ProcessError> { let input = args.get(0).unwrap().value(); let Some(in_str) = input.as_string() else { - return Ok(0) + return Ok(0); }; let in_rep = in_str.replace('-', ""); // Remove hyphens