|
| 1 | +# ******************************************************************************* |
| 2 | +# Copyright (c) 2026 Contributors to the Eclipse Foundation |
| 3 | +# |
| 4 | +# See the NOTICE file(s) distributed with this work for additional |
| 5 | +# information regarding copyright ownership. |
| 6 | +# |
| 7 | +# This program and the accompanying materials are made available under the |
| 8 | +# terms of the Apache License Version 2.0 which is available at |
| 9 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# SPDX-License-Identifier: Apache-2.0 |
| 12 | +# ******************************************************************************* |
| 13 | +name: Bazel Lockfile Check |
| 14 | +on: |
| 15 | + pull_request: |
| 16 | + paths: |
| 17 | + - 'MODULE.bazel' |
| 18 | + - 'MODULE.bazel.lock' |
| 19 | + - '**/Cargo.toml' |
| 20 | + - '**/Cargo.lock' |
| 21 | +jobs: |
| 22 | + validate-lockfile: |
| 23 | + name: Verify Lockfile Correctness |
| 24 | + runs-on: ubuntu-latest |
| 25 | + steps: |
| 26 | + - name: Checkout Source Code |
| 27 | + uses: actions/checkout:v4 |
| 28 | + - name: Setup Bazel |
| 29 | + uses: bazel-contrib/setup-bazel@v0.13.0 |
| 30 | + with: |
| 31 | + bazelisk-version: true |
| 32 | + repository-cache: true |
| 33 | + - name: Assert Lockfile matches Cargo State |
| 34 | + id: run-check |
| 35 | + run: bazel mod deps --lockfile_mode=error |
| 36 | + - name: Instructions on Failure |
| 37 | + if: failure() && steps.run-check.outcome == 'failure' |
| 38 | + run: | |
| 39 | + echo "::error title=Lockfile Out of Sync::Your MODULE.bazel.lock does not match your Cargo configuration changes!" |
| 40 | + echo "==============================================================================" |
| 41 | + echo " HOW TO FIX THIS BUILD:" |
| 42 | + echo "==============================================================================" |
| 43 | + echo " Your recent Cargo dependency changes broke the Bazel lockfile state." |
| 44 | + echo " Please run the following command locally in your repository root:" |
| 45 | + echo "" |
| 46 | + echo " bazel mod deps --lockfile_mode=update" |
| 47 | + echo "" |
| 48 | + echo " Once completed, commit and push the updated 'MODULE.bazel.lock'." |
| 49 | + echo "==============================================================================" |
0 commit comments