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