Skip to content

Commit ad32007

Browse files
committed
chore: add hermiticity CI check and finalize hermetic builds
Add CI workflow to verify hermiticity on every PR and complete hermetic build configuration for all Go tools. - ci: add hermiticity-check job with execution log analysis - build: enable pure Go builds (CGO disabled) for all tools - build: update MODULE.bazel.lock for rules_cc fork - docs: remove draft status and update RFC with implementation details All Go binaries now use pure="on" for hermetic builds without CGO dependencies, preventing system linker detection.
1 parent ea9af77 commit ad32007

File tree

7 files changed

+54
-35
lines changed

7 files changed

+54
-35
lines changed

.github/workflows/ci.yml

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,46 @@ jobs:
3636
# Show warnings but don't fail the CI
3737
bazel run //:buildifier -- --lint=warn --mode=check -r . || true
3838
39+
hermiticity-check:
40+
name: Hermiticity Check
41+
runs-on: ubuntu-latest
42+
needs: lint
43+
44+
steps:
45+
- uses: actions/checkout@v5
46+
47+
- name: Install Bazelisk
48+
run: |
49+
curl -LO https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64
50+
chmod +x bazelisk-linux-amd64
51+
sudo mv bazelisk-linux-amd64 /usr/local/bin/bazel
52+
53+
- name: Install Python
54+
uses: actions/setup-python@v5
55+
with:
56+
python-version: '3.x'
57+
58+
- name: Build with Execution Log
59+
run: |
60+
echo "🔍 Building with execution logging to analyze hermiticity..."
61+
bazel build --execution_log_json_file=/tmp/exec.json //examples/go_component:calculator_component
62+
63+
- name: Analyze Hermiticity
64+
run: |
65+
echo "📊 Analyzing build hermiticity..."
66+
python3 tools/hermetic_test/analyze_exec_log.py /tmp/exec.json
67+
68+
- name: Upload Execution Log (on failure)
69+
if: failure()
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: hermiticity-execution-log
73+
path: /tmp/exec.json
74+
3975
test-linux:
4076
name: Test on ubuntu-latest
4177
runs-on: ubuntu-latest
42-
needs: lint # Run tests only after lint passes
78+
needs: [lint, hermiticity-check]
4379

4480
services:
4581
registry:
@@ -148,7 +184,7 @@ jobs:
148184
test-macos:
149185
name: Test on macos-latest
150186
runs-on: macos-latest
151-
needs: lint # Run tests only after lint passes
187+
needs: [lint, hermiticity-check]
152188

153189
steps:
154190
- uses: actions/checkout@v5
@@ -261,7 +297,7 @@ jobs:
261297
bcr-docker-test:
262298
name: BCR Docker Environment Test
263299
runs-on: ubuntu-latest
264-
needs: lint # Run in parallel with regular tests
300+
needs: [lint, hermiticity-check]
265301

266302
steps:
267303
- uses: actions/checkout@v5
@@ -433,7 +469,7 @@ jobs:
433469
release:
434470
name: Release
435471
runs-on: ubuntu-latest
436-
needs: [test-linux, test-macos, integration, bcr-docker-test]
472+
needs: [test-linux, test-macos, integration, bcr-docker-test, hermiticity-check]
437473
if: github.ref == 'refs/heads/main'
438474

439475
steps:

MODULE.bazel.lock

Lines changed: 1 addition & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/RFC_RULES_CC_AUTO_DETECT.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# RFC: Add Optional Auto-Detection Control to rules_cc cc_configure Extension
22

3-
## Status: DRAFT
4-
53
## Target: [bazelbuild/rules_cc](https://github.com/bazelbuild/rules_cc)
64

75
## Summary
@@ -222,21 +220,20 @@ Consider making `auto_detect = False` the default in a major version (2.0.0), wi
222220

223221
## Proof of Concept
224222

225-
A working implementation will be available at:
223+
Working implementation:
226224
- Fork: https://github.com/avrabe/rules_cc
227-
- Branch: `feature/optional-auto-detect` (to be created)
228-
- PR: [To be submitted to bazelbuild/rules_cc]
225+
- Branch: `feature/optional-cc-toolchain-auto-detect`
226+
- Commit: `7215331f9e53f80070dc01c4a95a0f9c53ea477b`
227+
- RFC Issue: https://github.com/avrabe/rules_cc/issues/1
229228

230229
## Next Steps
231230

232-
1. Get feedback from rules_cc maintainers
231+
1. Gather feedback from rules_cc maintainers
233232
2. Refine API based on feedback
234-
3. Implement proof-of-concept
235-
4. Submit PR with tests and documentation
236-
5. Iterate based on code review
233+
3. Submit PR to bazelbuild/rules_cc
234+
4. Iterate based on code review
237235

238236
---
239237

240-
**Author**: [Your name/handle]
241-
**Date**: 2025-10-12
242-
**Discussion**: [Link to GitHub issue when created]
238+
**Date**: 2025-10-13
239+
**Discussion**: https://github.com/avrabe/rules_cc/issues/1

tools/generate_schemas/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ go_binary(
66
"comprehensive_schemas.go",
77
"main.go",
88
],
9+
pure = "on", # Disable CGO for hermetic builds
910
visibility = ["//visibility:public"],
1011
)

tools/wac_deps/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ load("@rules_go//go:def.bzl", "go_binary")
33
go_binary(
44
name = "wac_deps",
55
srcs = ["main.go"],
6+
pure = "on", # Disable CGO for hermetic builds
67
visibility = ["//visibility:public"],
78
)

tools/wit_dependency_analyzer/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ load("@rules_go//go:def.bzl", "go_binary")
33
go_binary(
44
name = "wit_dependency_analyzer",
55
srcs = ["main.go"],
6+
pure = "on", # Disable CGO for hermetic builds
67
visibility = ["//visibility:public"],
78
)

tools/wit_structure/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ load("@rules_go//go:def.bzl", "go_binary")
33
go_binary(
44
name = "wit_structure",
55
srcs = ["main.go"],
6+
pure = "on", # Disable CGO for hermetic builds
67
visibility = ["//visibility:public"],
78
)

0 commit comments

Comments
 (0)