Skip to content

Commit b13ab0d

Browse files
committed
ci: Added nightly reprobuild test
1 parent 82fff3c commit b13ab0d

File tree

2 files changed

+178
-113
lines changed

2 files changed

+178
-113
lines changed

.github/workflows/repro.yaml

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
---
2+
name: Reproducible Build Verification
3+
on:
4+
schedule:
5+
- cron: "0 0 * * *" # Daily at midnight UTC
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
build-base-image:
14+
name: Build jammy Docker Image
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 60
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Build base image
22+
run: |
23+
echo "Building base image for jammy"
24+
docker run --rm -v $(pwd):/build ubuntu:jammy \
25+
bash -c "apt-get update && apt-get install -y debootstrap && debootstrap jammy /build/jammy"
26+
tar -C jammy -c . | docker import - jammy
27+
echo "Verifying jammy base image:"
28+
docker run jammy cat /etc/lsb-release
29+
30+
- name: Build builder image
31+
run: |
32+
echo "Building CL repro jammy:"
33+
docker build -t cl-repro-jammy - < contrib/reprobuild/Dockerfile.jammy
34+
35+
- name: Save Docker image
36+
run: |
37+
mkdir -p docker-images
38+
docker save cl-repro-jammy | gzip > docker-images/cl-repro-jammy.tar.gz
39+
40+
- name: Upload Docker image
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: docker-images
44+
path: docker-images/
45+
retention-days: 1
46+
47+
build-ubuntu:
48+
name: Build CLN on Ubuntu
49+
runs-on: ubuntu-latest
50+
timeout-minutes: 120
51+
needs: build-base-image
52+
steps:
53+
- name: Checkout
54+
uses: actions/checkout@v4
55+
56+
- name: Download Docker image
57+
uses: actions/download-artifact@v4
58+
with:
59+
name: docker-images
60+
path: docker-images/
61+
62+
- name: Load Docker image
63+
run: |
64+
docker load --input docker-images/cl-repro-jammy.tar.gz
65+
66+
- name: Create release directory
67+
run: |
68+
mkdir -p release
69+
70+
- name: Build with jammy
71+
run: |
72+
docker run --rm -v $(pwd):/repo cl-repro-jammy
73+
74+
- name: Generate checksums
75+
run: |
76+
cd release
77+
sha256sum *.xz > SHA256SUMS-ubuntu
78+
cat SHA256SUMS-ubuntu
79+
80+
- name: Upload artifacts
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: ubuntu-artifacts
84+
path: release/
85+
retention-days: 1
86+
87+
build-debian:
88+
name: Build CLN on Debian
89+
runs-on: debian-latest
90+
timeout-minutes: 120
91+
needs: build-base-image
92+
steps:
93+
- name: Checkout
94+
uses: actions/checkout@v4
95+
96+
- name: Download Docker image
97+
uses: actions/download-artifact@v4
98+
with:
99+
name: docker-images
100+
path: docker-images/
101+
102+
- name: Load Docker image
103+
run: |
104+
docker load --input docker-images/cl-repro-jammy.tar.gz
105+
106+
- name: Create release directory
107+
run: |
108+
mkdir -p release
109+
110+
- name: Build with jammy
111+
run: |
112+
docker run --rm -v $(pwd):/repo cl-repro-jammy
113+
114+
- name: Generate checksums
115+
run: |
116+
cd release
117+
sha256sum *.xz > SHA256SUMS-debian
118+
cat SHA256SUMS-debian
119+
120+
- name: Upload artifacts
121+
uses: actions/upload-artifact@v4
122+
with:
123+
name: debian-artifacts
124+
path: release/
125+
retention-days: 1
126+
127+
verify-reproducibility:
128+
name: Verify Reproducibility
129+
runs-on: ubuntu-latest
130+
timeout-minutes: 10
131+
needs: [build-ubuntu, build-debian]
132+
if: always()
133+
steps:
134+
- name: Download Ubuntu artifacts
135+
uses: actions/download-artifact@v4
136+
with:
137+
name: ubuntu-artifacts
138+
path: ubuntu-release/
139+
140+
- name: Download Debian artifacts
141+
uses: actions/download-artifact@v4
142+
with:
143+
name: debian-artifacts
144+
path: debian-release/
145+
146+
- name: Compare artifacts
147+
run: |
148+
echo "=== Ubuntu checksums ==="
149+
cat ubuntu-release/SHA256SUMS-ubuntu || echo "Ubuntu checksums not found"
150+
echo ""
151+
echo "=== Debian checksums ==="
152+
cat debian-release/SHA256SUMS-debian || echo "Debian checksums not found"
153+
echo ""
154+
echo "=== Comparing binary reproducibility ==="
155+
156+
# Extract just the hashes and filenames for comparison
157+
if [ -f ubuntu-release/SHA256SUMS-ubuntu ] && [ -f debian-release/SHA256SUMS-debian ]; then
158+
# Get just the hash and filename parts, sort them for comparison
159+
ubuntu_hashes=$(grep -v SHA256SUMS ubuntu-release/SHA256SUMS-ubuntu | sort || true)
160+
debian_hashes=$(grep -v SHA256SUMS debian-release/SHA256SUMS-debian | sort || true)
161+
162+
if [ -z "$ubuntu_hashes" ] || [ -z "$debian_hashes" ]; then
163+
echo "Checksums are empty, builds may have failed"
164+
exit 1
165+
fi
166+
167+
# Compare the hashes
168+
if diff <(echo "$ubuntu_hashes") <(echo "$debian_hashes"); then
169+
echo "✓ Builds are reproducible! Checksums match between Ubuntu and Debian runners."
170+
exit 0
171+
else
172+
echo "✗ Builds are NOT reproducible. Checksums differ between Ubuntu and Debian runners."
173+
exit 1
174+
fi
175+
else
176+
echo "Could not find checksum files from both builds"
177+
exit 1
178+
fi

.github/workflows/repro.yml

Lines changed: 0 additions & 113 deletions
This file was deleted.

0 commit comments

Comments
 (0)