From 15919ad33dbf640e50f6c4d0cd13485be86f7421 Mon Sep 17 00:00:00 2001 From: laruh Date: Fri, 27 Dec 2024 18:43:01 +0700 Subject: [PATCH 1/3] Validate Cargo.lock --- .github/workflows/fmt-and-lint.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/fmt-and-lint.yml b/.github/workflows/fmt-and-lint.yml index b5212320dd..7d53652d3b 100644 --- a/.github/workflows/fmt-and-lint.yml +++ b/.github/workflows/fmt-and-lint.yml @@ -29,6 +29,9 @@ jobs: - name: Build cache uses: ./.github/actions/build-cache + - name: Backup Cargo.lock + run: cp Cargo.lock Cargo.lock.bak + - name: fmt check # Format checks aren't OS dependant. if: matrix.os == 'ubuntu-latest' @@ -37,6 +40,14 @@ jobs: - name: clippy lint run: cargo clippy --all-targets --all-features -- --D warnings + - name: Validate Cargo.lock + run: | + if ! diff Cargo.lock Cargo.lock.bak; then + echo "Error: Cargo.lock has changed during the workflow. Ensure Cargo.lock is up-to-date and committed." + exit 1 + fi + shell: bash + wasm-lint: name: Wasm Lint Checks timeout-minutes: 45 From 4d83f94eadb7ea042875797955e3b0c2f8d4ba98 Mon Sep 17 00:00:00 2001 From: laruh Date: Sat, 28 Dec 2024 18:26:55 +0700 Subject: [PATCH 2/3] Revert "Validate Cargo.lock" and add validate-cargo-lock.yml --- .github/workflows/fmt-and-lint.yml | 11 ----------- .github/workflows/validate-cargo-lock.yml | 24 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/validate-cargo-lock.yml diff --git a/.github/workflows/fmt-and-lint.yml b/.github/workflows/fmt-and-lint.yml index 7d53652d3b..b5212320dd 100644 --- a/.github/workflows/fmt-and-lint.yml +++ b/.github/workflows/fmt-and-lint.yml @@ -29,9 +29,6 @@ jobs: - name: Build cache uses: ./.github/actions/build-cache - - name: Backup Cargo.lock - run: cp Cargo.lock Cargo.lock.bak - - name: fmt check # Format checks aren't OS dependant. if: matrix.os == 'ubuntu-latest' @@ -40,14 +37,6 @@ jobs: - name: clippy lint run: cargo clippy --all-targets --all-features -- --D warnings - - name: Validate Cargo.lock - run: | - if ! diff Cargo.lock Cargo.lock.bak; then - echo "Error: Cargo.lock has changed during the workflow. Ensure Cargo.lock is up-to-date and committed." - exit 1 - fi - shell: bash - wasm-lint: name: Wasm Lint Checks timeout-minutes: 45 diff --git a/.github/workflows/validate-cargo-lock.yml b/.github/workflows/validate-cargo-lock.yml new file mode 100644 index 0000000000..eac82d5c0a --- /dev/null +++ b/.github/workflows/validate-cargo-lock.yml @@ -0,0 +1,24 @@ +name: Validate Cargo.lock +on: [push] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + validate-cargo-lock: + name: Validate Cargo.lock Consistency + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install Rust toolchain + run: | + rustup toolchain install nightly-2023-06-01 --no-self-update --profile=minimal + rustup default nightly-2023-06-01 + + - name: Validate Cargo.lock + run: | + echo "Checking if Cargo.lock is up-to-date..." + cargo update -w --locked From e9ad8f8b38c41d9fcfd736854ea176f5d6981b3e Mon Sep 17 00:00:00 2001 From: laruh Date: Tue, 7 Jan 2025 18:03:57 +0700 Subject: [PATCH 3/3] review: run only `cargo update` and simplify yml --- .github/workflows/validate-cargo-lock.yml | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/.github/workflows/validate-cargo-lock.yml b/.github/workflows/validate-cargo-lock.yml index eac82d5c0a..eb59173d28 100644 --- a/.github/workflows/validate-cargo-lock.yml +++ b/.github/workflows/validate-cargo-lock.yml @@ -7,18 +7,10 @@ concurrency: jobs: validate-cargo-lock: - name: Validate Cargo.lock Consistency + name: Checking Cargo.lock file runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Install Rust toolchain - run: | - rustup toolchain install nightly-2023-06-01 --no-self-update --profile=minimal - rustup default nightly-2023-06-01 + - uses: actions/checkout@v3 - name: Validate Cargo.lock - run: | - echo "Checking if Cargo.lock is up-to-date..." - cargo update -w --locked + run: cargo update -w --locked