Skip to content

Commit a49062c

Browse files
authored
Adding a pre-release workflow to test huggingface_hub (#242)
Since changes to xet-core and hf-xet can break huggingface_hub, we're adding automation to test the whole cross-platform huggingface_hub test suite against our RC builds. This uses the same trick that huggingface_hub uses with the transformers, datasets, and diffusers libraries. It creates a ci branch on huggingface_hub which triggers the cross-platform huggingface_hub test suite.
1 parent ea971c0 commit a49062c

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: hf-xet prerelease testing
2+
# This workflow is triggered when a new pre-release build is triggered by the release workflow.
3+
4+
on:
5+
push:
6+
tags:
7+
- v*rc*
8+
workflow_dispatch:
9+
inputs:
10+
tag:
11+
description: "Tag to test (e.g., v1.0.3rc2)"
12+
required: true
13+
jobs:
14+
trigger_rc_testing:
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
target-repo: ["huggingface_hub"]
21+
22+
steps:
23+
- name: Determine version from tag
24+
id: get-version
25+
run: |
26+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
27+
echo "VERSION=${{ inputs.tag }}" >> $GITHUB_OUTPUT
28+
else
29+
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
30+
fi
31+
32+
- name: Checkout target repo
33+
uses: actions/checkout@v4
34+
with:
35+
repository: huggingface/${{ matrix.target-repo }}
36+
path: ${{ matrix.target-repo }}
37+
token: ${{ secrets.TOKEN_HUGGINGFACE_HUB_AUTO_BY_XET }}
38+
39+
- name: Configure Git
40+
run: |
41+
cd ${{ matrix.target-repo }}
42+
git config user.name "Hugging Face Bot (Xet RC Testing)"
43+
git config user.email "[email protected]"
44+
45+
- name: Wait for prerelease to be out on PyPI
46+
run: |
47+
VERSION=${{ steps.get-version.outputs.VERSION }}
48+
echo "Waiting for hf_xet==${VERSION} to be available on PyPI"
49+
while ! pip install hf_xet==${VERSION}; do
50+
echo "hf_xet==${VERSION} not available yet, retrying in 15s"
51+
sleep 15
52+
done
53+
54+
- name: Create test branch and update dependencies
55+
id: create-pr
56+
run: |
57+
cd ${{ matrix.target-repo }}
58+
VERSION=${{ steps.get-version.outputs.VERSION }}
59+
BRANCH_NAME="ci-test-hf-xet-${VERSION}-release"
60+
61+
# Create and checkout new branch
62+
git checkout -b $BRANCH_NAME
63+
64+
# Update dependencies using sed
65+
sed -i -E "s/\"hf_xet>=*\"/\"hf_xet==${VERSION}\"/" setup.py
66+
git add setup.py
67+
68+
# Any line with `uv pip install --prerelease=allow` in the `.github/` folder must be updated with `--prerelease=allow` flag
69+
find .github/workflows/ -type f -exec sed -i 's/uv pip install /uv pip install --prerelease=allow /g' {} +
70+
git add .github/workflows/
71+
72+
# Commit and push changes
73+
git --no-pager diff --staged
74+
git commit -m "Test hfh ${VERSION}"
75+
git push --set-upstream origin $BRANCH_NAME
76+
77+
- name: Print URLs for manual check
78+
run: |
79+
VERSION=${{ steps.get-version.outputs.VERSION }}
80+
echo "https://github.com/xet-core/${{ matrix.target-repo }}/actions"
81+
echo "https://github.com/xet-core/${{ matrix.target-repo }}/compare/main...${BRANCH_NAME}"

0 commit comments

Comments
 (0)