Skip to content

Commit 41d6849

Browse files
committed
try fix
1 parent 23d48a3 commit 41d6849

File tree

3 files changed

+39
-46
lines changed

3 files changed

+39
-46
lines changed

.github/workflows/v1-sample-rebuild.yaml

Lines changed: 28 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,6 @@ jobs:
189189
steps:
190190
- name: Checkout code
191191
uses: actions/checkout@v4
192-
with:
193-
token: ${{ secrets.GITHUB_TOKEN }}
194192

195193
- uses: prefix-dev/setup-pixi@v0.8.1
196194
with:
@@ -209,56 +207,46 @@ jobs:
209207
continue-on-error: true
210208
with:
211209
pattern: v1-diff-*
212-
path: docs/diffs/
210+
path: diffs_staging/
213211
merge-multiple: true
214212

215-
- name: List downloaded diffs
213+
- name: Upload diffs to release
214+
if: github.ref == 'refs/heads/main'
215+
run: |
216+
# Create diffs release if it doesn't exist
217+
gh release view diffs || gh release create diffs --title "Diffoscope Reports" --notes "Auto-updated diffoscope HTML reports for non-reproducible packages"
218+
219+
# Find and upload all diff HTML files
220+
if [ -d "diffs_staging" ]; then
221+
echo "=== Uploading diffs to release ==="
222+
find diffs_staging -type f -name "*.html" | while read -r file; do
223+
# Get just the filename for the asset name
224+
basename=$(basename "$file")
225+
echo "Uploading: $basename"
226+
gh release upload diffs "$file" --clobber || echo "Failed to upload $file"
227+
done
228+
echo "Done uploading diffs"
229+
else
230+
echo "No diffs to upload"
231+
fi
232+
env:
233+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
234+
235+
- name: List uploaded diffs
216236
continue-on-error: true
217237
run: |
218-
echo "=== Downloaded Diffs ==="
219-
find docs/diffs -type f -name "*.html" 2>/dev/null | head -20 || echo "No diffs found"
220-
echo "Total diff files: $(find docs/diffs -type f -name "*.html" 2>/dev/null | wc -l)"
221-
echo "=== Directory structure ==="
222-
find docs/diffs -type d 2>/dev/null || echo "No dirs"
238+
echo "=== Diffs in release ==="
239+
gh release view diffs --json assets -q '.assets[].name' | head -30 || echo "No diffs release"
240+
env:
241+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
223242

224243
- name: Generate HTML pages
225244
run: |
226245
pixi run repror generate-html
227246
228-
- name: List generated files
229-
run: |
230-
echo "=== Generated HTML files ==="
231-
ls -la docs/
232-
if [ -d "docs/diffs" ]; then
233-
echo "=== Diffs directory ==="
234-
find docs/diffs -type f | head -30
235-
fi
236-
237-
- name: Commit diffs to repository
238-
if: github.ref == 'refs/heads/main'
239-
run: |
240-
git config user.name "github-actions[bot]"
241-
git config user.email "github-actions[bot]@users.noreply.github.com"
242-
243-
# Add the diffs directory if it exists and has files
244-
if [ -d "docs/diffs" ] && [ "$(find docs/diffs -type f -name '*.html' 2>/dev/null | wc -l)" -gt 0 ]; then
245-
git add docs/diffs/
246-
if ! git diff --staged --quiet; then
247-
git commit -m "Update diffoscope HTML reports"
248-
git push
249-
echo "Diffs committed and pushed"
250-
else
251-
echo "No changes to commit"
252-
fi
253-
else
254-
echo "No diff files to commit"
255-
fi
256-
257247
- name: Update remote docs via API
258248
if: github.ref == 'refs/heads/main'
259249
run: |
260-
# Pull latest changes (including diffs we just pushed)
261-
git pull --rebase || true
262250
REPROR_UPDATE_TOKEN=${{ secrets.GITHUB_TOKEN }} pixi run repror generate-html --update-remote
263251
264252
summarize-results:

src/repror/cli/templates/v1.html.jinja

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,10 @@
165165

166166
<!-- Diff link (if not reproducible and state is success) -->
167167
{% if not rebuild.is_reproducible and rebuild.state.value == 'success' %}
168-
{% set diff_filename = rebuild.package_name ~ "_diff.html" %}
169-
<a href="diffs/{{ rebuild.platform_name }}/{{ diff_filename }}"
168+
{% set diff_filename = rebuild.package_name ~ "-" ~ rebuild.version ~ "_diff.html" %}
169+
{% set diff_url = "https://github.com/prefix-dev/reproducible-builds/releases/download/diffs/" ~ diff_filename %}
170+
<a href="https://htmlpreview.github.io/?{{ diff_url }}"
171+
target="_blank"
170172
class="inline-flex items-center gap-1 px-3 py-1.5 text-xs font-medium text-purple-700 bg-purple-50 rounded-lg hover:bg-purple-100 transition-colors"
171173
title="View detailed diff">
172174
<i class="fa-solid fa-code-compare"></i>

src/repror/cli/v1_sampler.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,17 +462,19 @@ def run_diffoscope(
462462
original: Path,
463463
rebuilt: Path,
464464
package_name: str,
465+
version: str,
465466
platform_name: str,
466467
) -> Optional[Path]:
467468
"""Run diffoscope to compare two packages.
468469
469-
Saves the HTML diff to build_info/v1/diffs/{platform}/{package}_diff.html
470+
Saves the HTML diff to build_info/v1/diffs/{platform}/{package}-{version}_diff.html
470471
and prints a text summary to the log.
471472
472473
Args:
473474
original: Path to the original .conda package
474475
rebuilt: Path to the rebuilt .conda package
475476
package_name: Name of the package (for output filename)
477+
version: Version of the package (for unique filename)
476478
platform_name: Platform name (for output directory)
477479
478480
Returns:
@@ -486,10 +488,11 @@ def run_diffoscope(
486488
return None
487489

488490
# Save to persistent location for artifact upload
491+
# Use name-version for unique identification
489492
output_dir = Path("build_info/v1/diffs") / platform_name
490493
output_dir.mkdir(parents=True, exist_ok=True)
491-
html_output = output_dir / f"{package_name}_diff.html"
492-
text_output = output_dir / f"{package_name}_diff.txt"
494+
html_output = output_dir / f"{package_name}-{version}_diff.html"
495+
text_output = output_dir / f"{package_name}-{version}_diff.txt"
493496

494497
print(f"[dim]Running diffoscope to compare packages...[/dim]")
495498

@@ -834,7 +837,7 @@ def rebuild_v1_package(
834837
# Run diffoscope if not reproducible
835838
diff_path: Optional[Path] = None
836839
if not is_reproducible:
837-
diff_path = run_diffoscope(original_file, rebuilt_file, pkg_info.name, platform)
840+
diff_path = run_diffoscope(original_file, rebuilt_file, pkg_info.name, pkg_info.version, platform)
838841

839842
# Save successful rebuild
840843
v1_rebuild = V1Rebuild(

0 commit comments

Comments
 (0)