Skip to content

Commit c0ed1c4

Browse files
enforce bazel lock checking (#107)
* locking: enforce Bzlmod lockfile consistency - add reusable lockfile check workflow - track MODULE.bazel.lock (remove from .gitignore) - enforce --lockfile_mode=error in CI and scripts Addresses eclipse-score/score#2628 * lock: don't use on info and query Doens't make sense to be so rigurous an all bazel commands Signed-off-by: Dan Calavrezo <195309321+dcalavrezo-qorix@users.noreply.github.com> * lockfile: fixed ran bazel mod tidy Signed-off-by: Dan Calavrezo <195309321+dcalavrezo-qorix@users.noreply.github.com> * fix: Potential fix for code scanning alert no. 13 Workflow does not contain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Signed-off-by: Dan Calavrezo <195309321+dcalavrezo-qorix@users.noreply.github.com> --------- Signed-off-by: Dan Calavrezo <195309321+dcalavrezo-qorix@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 419588e commit c0ed1c4

9 files changed

Lines changed: 38 additions & 9 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ jobs:
4646
4747
- name: Build with Bazel
4848
run: |
49-
bazel build --config x86_64-linux //src/... //examples/...
49+
bazel build --lockfile_mode=error --config x86_64-linux //src/... //examples/...

.github/workflows/bzlmod-lock.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2025 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: Bzlmod Lockfile Check
14+
permissions:
15+
contents: read
16+
on:
17+
pull_request:
18+
types: [opened, reopened, synchronize]
19+
merge_group:
20+
types: [checks_requested]
21+
push:
22+
branches:
23+
- main
24+
jobs:
25+
bzlmod-lock:
26+
uses: eclipse-score/cicd-workflows/.github/workflows/bzlmod-lock-check.yml@main
27+
with:
28+
working-directory: .

.github/workflows/code_coverage.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
- name: Run Bazel Coverage
4646
run: |
4747
bazel coverage \
48+
--lockfile_mode=error \
4849
--test_output=errors \
4950
--nocache_test_results \
5051
--config=x86_64-linux \
@@ -84,6 +85,7 @@ jobs:
8485
run: |
8586
set -euo pipefail
8687
bazel test \
88+
--lockfile_mode=error \
8789
--config=x86_64-linux \
8890
--config=ferrocene-coverage \
8991
--nocache_test_results \
@@ -92,7 +94,7 @@ jobs:
9294
- name: Generate Ferrocene coverage reports
9395
run: |
9496
set -euo pipefail
95-
bazel run //:rust_coverage -- --min-line-coverage 66
97+
bazel run --lockfile_mode=error //:rust_coverage -- --min-line-coverage 66
9698
9799
- name: Locate coverage artifacts
98100
run: |

.github/workflows/copyright.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ jobs:
2121
copyright-check:
2222
uses: eclipse-score/cicd-workflows/.github/workflows/copyright.yml@main
2323
with:
24-
bazel-target: "run //:copyright.check"
24+
bazel-target: "run --lockfile_mode=error //:copyright.check"

.github/workflows/format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ jobs:
2424
formatting-check:
2525
uses: eclipse-score/cicd-workflows/.github/workflows/format.yml@main
2626
with:
27-
bazel-target: "test //:format.check" # optional, this is the default
27+
bazel-target: "test --lockfile_mode=error //:format.check" # optional, this is the default

.github/workflows/license_check.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@ jobs:
2828
uses: eclipse-score/cicd-workflows/.github/workflows/license-check.yml@main
2929
with:
3030
repo-url: "${{ github.server_url }}/${{ github.repository }}"
31+
bazel-target: "run --lockfile_mode=error //:license-check"
3132
secrets:
3233
dash-api-token: ${{ secrets.ECLIPSE_GITLAB_API_TOKEN }}

.github/workflows/test_and_docs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ jobs:
3737
pull-requests: write
3838
contents: read
3939
with:
40-
bazel-docs-verify-target: "//:docs_check"
40+
bazel-docs-verify-target: "--lockfile_mode=error //:docs_check"
4141
run-tests:
4242
uses: eclipse-score/cicd-workflows/.github/workflows/tests.yml@main
4343
permissions:
4444
contents: read
4545
pull-requests: read
4646
with:
47-
bazel-target: 'test //src/... //tests/... --config=x86_64-linux'
47+
bazel-target: 'test --lockfile_mode=error //src/... //tests/... --config=x86_64-linux'
4848
upload-name: 'bazel-testlogs'
4949
packages: 'fakechroot'
5050
build-docs:
@@ -59,6 +59,6 @@ jobs:
5959

6060
with:
6161
# the bazel-target depends on your repo specific docs_targets configuration (e.g. "suffix")
62-
bazel-target: "//:docs -- --github_user=${{ github.repository_owner }} --github_repo=${{ github.event.repository.name }}"
62+
bazel-target: "--lockfile_mode=error //:docs -- --github_user=${{ github.repository_owner }} --github_repo=${{ github.event.repository.name }}"
6363
retention-days: 3
6464
tests-report-artifact: bazel-testlogs

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434

3535
# Bazel
3636
bazel-*
37-
MODULE.bazel.lock
3837
user.bazelrc
3938

4039
# Ruff

MODULE.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ python.toolchain(
116116
is_default = True,
117117
python_version = PYTHON_VERSION,
118118
)
119-
use_repo(python)
120119

121120
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_dependency = True)
122121
pip.parse(

0 commit comments

Comments
 (0)