@@ -115,77 +115,8 @@ package-local: ## Build packages locally for testing
115115
116116.PHONY : package-test-reproducible
117117package-test-reproducible : # # Test reproducible builds
118- @echo " 🔄 Testing reproducible builds..."
119- @mkdir -p ./test-reproducible
120- @echo " Building first version (with packages)..."
121- @if goreleaser release --snapshot --clean > /dev/null 2>&1 ; then \
122- echo " ✅ First build completed" ; \
123- cp -r ./dist ./test-reproducible/build1; \
124- else \
125- echo " ❌ First build failed" ; \
126- echo " Running with verbose output:" ; \
127- goreleaser release --snapshot --clean; \
128- rm -rf ./test-reproducible; \
129- exit 1; \
130- fi
131- @sleep 2
132- @echo " Building second version (with packages)..."
133- @if goreleaser release --snapshot --clean > /dev/null 2>&1 ; then \
134- echo " ✅ Second build completed" ; \
135- cp -r ./dist ./test-reproducible/build2; \
136- else \
137- echo " ❌ Second build failed" ; \
138- echo " Running with verbose output:" ; \
139- goreleaser release --snapshot --clean; \
140- rm -rf ./test-reproducible; \
141- exit 1; \
142- fi
143- @echo " Comparing packages and binaries..."
144- @BUILD1_DEBS=$$(find ./test-reproducible/build1 -name "*.deb" | wc -l ) ; \
145- BUILD2_DEBS=$$(find ./test-reproducible/build2 -name "*.deb" | wc -l ) ; \
146- BUILD1_BINS=$$(find ./test-reproducible/build1 -type f -name "go-template-*" | wc -l ) ; \
147- BUILD2_BINS=$$(find ./test-reproducible/build2 -type f -name "go-template-*" | wc -l ) ; \
148- echo " Found $$ BUILD1_DEBS .deb packages and $$ BUILD1_BINS binaries in first build" ; \
149- echo " Found $$ BUILD2_DEBS .deb packages and $$ BUILD2_BINS binaries in second build" ; \
150- if [ " $$ BUILD1_DEBS" -eq 0 ] && [ " $$ BUILD1_BINS" -eq 0 ]; then \
151- echo " ❌ No build artifacts found in first build" ; \
152- find ./test-reproducible/build1 -type f | head -10; \
153- rm -rf ./test-reproducible; \
154- exit 1; \
155- fi
156- @echo " Comparing binary checksums..."
157- @find ./test-reproducible/build1 -type f -name " go-template-*" -exec sha256sum {} \; | sed ' s|./test-reproducible/build1/||' | sort > ./test-reproducible/checksums1_bins.txt
158- @find ./test-reproducible/build2 -type f -name " go-template-*" -exec sha256sum {} \; | sed ' s|./test-reproducible/build2/||' | sort > ./test-reproducible/checksums2_bins.txt
159- @echo " Comparing package checksums..."
160- @find ./test-reproducible/build1 -name " *.deb" -exec sha256sum {} \; | sed ' s|./test-reproducible/build1/||' | sort > ./test-reproducible/checksums1_debs.txt
161- @find ./test-reproducible/build2 -name " *.deb" -exec sha256sum {} \; | sed ' s|./test-reproducible/build2/||' | sort > ./test-reproducible/checksums2_debs.txt
162- @if diff ./test-reproducible/checksums1_bins.txt ./test-reproducible/checksums2_bins.txt > /dev/null 2>&1 ; then \
163- BINS_MATCH=true; \
164- else \
165- BINS_MATCH=false; \
166- fi ; \
167- if diff ./test-reproducible/checksums1_debs.txt ./test-reproducible/checksums2_debs.txt > /dev/null 2>&1 ; then \
168- DEBS_MATCH=true; \
169- else \
170- DEBS_MATCH=false; \
171- fi ; \
172- if [ " $$ BINS_MATCH" = " true" ] && [ " $$ DEBS_MATCH" = " true" ]; then \
173- echo " ✅ Both binaries and packages are reproducible!" ; \
174- else \
175- echo " ❌ Builds are NOT reproducible!" ; \
176- if [ " $$ BINS_MATCH" = " false" ]; then \
177- echo " Binary differences:" ; \
178- diff ./test-reproducible/checksums1_bins.txt ./test-reproducible/checksums2_bins.txt || true ; \
179- fi ; \
180- if [ " $$ DEBS_MATCH" = " false" ]; then \
181- echo " Package differences:" ; \
182- diff ./test-reproducible/checksums1_debs.txt ./test-reproducible/checksums2_debs.txt || true ; \
183- fi ; \
184- rm -rf ./test-reproducible; \
185- exit 1; \
186- fi
187- @rm -rf ./test-reproducible
188- @echo " 🎉 Reproducibility test passed"
118+ @chmod +x scripts/test-reproducible.sh
119+ @./scripts/test-reproducible.sh
189120
190121.PHONY : package-install-local
191122package-install-local : package-local # # Install locally built package
0 commit comments