Skip to content

[dedup] Replace side-effect mutation with reduce in fuzzy dedup map #82

[dedup] Replace side-effect mutation with reduce in fuzzy dedup map

[dedup] Replace side-effect mutation with reduce in fuzzy dedup map #82

Workflow file for this run

name: Dupekit - Build Wheels
on:
workflow_dispatch: {}
push:
branches: [main]
tags:
- "dupekit-v*"
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: write # for creating releases
pull-requests: write # for create-pull-request
jobs:
changes:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
should_run: ${{ steps.filter.outputs.relevant }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
relevant:
- 'rust/dupekit/**'
- '.github/workflows/dupekit-wheels.yaml'
build:
needs: changes
if: needs.changes.outputs.should_run == 'true'
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64
- os: ubuntu-latest
target: aarch64
- os: macos-latest
target: x86_64
- os: macos-14
target: aarch64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: PyO3/maturin-action@v1
with:
command: build
args: --release --out dist --manifest-path rust/dupekit/Cargo.toml
target: ${{ matrix.target }}
manylinux: 2_28
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-${{ matrix.target }}
path: dist/*.whl
sdist:
needs: changes
if: needs.changes.outputs.should_run == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist --manifest-path rust/dupekit/Cargo.toml
- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
release:
if: needs.changes.outputs.should_run == 'true' && startsWith(github.ref, 'refs/tags/dupekit-v')
needs: [changes, build, sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- uses: softprops/action-gh-release@v2
with:
files: dist/*
update-release:
if: needs.changes.outputs.should_run == 'true' && github.ref == 'refs/heads/main'
needs: [changes, build, sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Compute release metadata
id: meta
run: |
VERSION=$(grep '^version' rust/dupekit/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "short_sha=${SHORT_SHA}" >> "$GITHUB_OUTPUT"
echo "pinned_tag=dupekit-${VERSION}-${SHORT_SHA}" >> "$GITHUB_OUTPUT"
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
# Rolling release (convenience alias)
- uses: softprops/action-gh-release@v2
with:
tag_name: dupekit-latest
name: "dupekit (latest wheels)"
prerelease: true
make_latest: false
files: dist/*
# Commit-pinned release for reproducibility
- uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.meta.outputs.pinned_tag }}
name: "dupekit ${{ steps.meta.outputs.version }} (${{ steps.meta.outputs.short_sha }})"
prerelease: true
make_latest: false
files: dist/*
update-pyproject:
if: needs.changes.outputs.should_run == 'true' && github.ref == 'refs/heads/main'
needs: [changes, update-release]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v7
- name: Update pyproject.toml and uv.lock with pinned dupekit release
run: |
set -euo pipefail
VERSION=$(grep '^version' rust/dupekit/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
PINNED_TAG="dupekit-${VERSION}-${SHORT_SHA}"
echo "Dupekit version: $VERSION, tag: $PINNED_TAG"
FIND_LINKS_URL="https://github.com/marin-community/marin/releases/expanded_assets/${PINNED_TAG}"
# Update find-links to point to the pinned release
sed -i "s|find-links = \[\"https://github.com/marin-community/marin/releases/expanded_assets/dupekit-[^\"]*\"\]|find-links = [\"${FIND_LINKS_URL}\"]|" pyproject.toml
# Update dupekit version pin in dependencies
sed -i 's|^\(\s*\)"dupekit[^"]*"| "dupekit >= '"${VERSION}"'"|' pyproject.toml
# Regenerate uv.lock so devs don't get dirty lockfile diffs
uv lock
- uses: peter-evans/create-pull-request@v7
with:
branch: auto/update-dupekit-wheels
title: "chore: update dupekit wheels"
body: "Auto-generated: updates pyproject.toml to pin dupekit wheels from commit ${{ github.sha }}."
labels: agent-generated
commit-message: "chore: pin dupekit wheels to ${{ github.sha }}"