Bump vite from 6.2.2 to 7.1.12 in /pyodide-e2e #1135
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | name: Test, Build, and Publish | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| tags: [ "v*" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| permissions: {} | |
| jobs: | |
| test-and-build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 0 # Fetch all history for hatch-vcs to get the correct version | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5.4.2 | |
| - name: "Set up Python" | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version-file: ".python-version" | |
| - name: Install the project | |
| run: uv sync --all-extras --dev | |
| - name: Run Ruff | |
| run: | | |
| uv run ruff check --output-format=github . | |
| uv run ruff format . --check | |
| - name: Type check with mypy | |
| run: uv run mypy . | |
| - name: Build the package | |
| run: uv build | |
| - name: Upload the built files as an artifact | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: transformers_js_py-${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || github.sha }} | |
| path: dist | |
| test-pyodide-e2e: | |
| needs: [test-and-build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 0 # Fetch all history for hatch-vcs to get the correct version | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5.4.2 | |
| - name: "Set up Python" | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version-file: ".python-version" | |
| - name: Install the project | |
| run: uv sync --all-extras --dev | |
| - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| name: transformers_js_py-${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || github.sha }} | |
| path: dist | |
| - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 | |
| with: | |
| version: 9 | |
| run_install: | | |
| cwd: pyodide-e2e | |
| - run: pnpm exec playwright install --with-deps | |
| working-directory: pyodide-e2e | |
| - run: pnpm test | |
| working-directory: pyodide-e2e | |
| deploy-preview-wheel: | |
| runs-on: ubuntu-latest | |
| needs: [test-and-build] | |
| if: github.event_name == 'pull_request' | |
| permissions: | |
| pull-requests: write | |
| name: Deploy wheel file to Cloudflare Pages | |
| outputs: | |
| url: ${{ steps.deploy.outputs.deployment-url }} | |
| steps: | |
| - run: mkdir -p ${{ runner.temp }}/artifacts/ | |
| - name: Download all the dists | |
| if: ${{ ! startsWith(github.ref, 'refs/tags/v') }} | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| name: transformers_js_py-${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || github.sha }} | |
| path: ${{ runner.temp }}/artifacts/transformers_js_py | |
| - name: Deploy | |
| uses: cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65 # v3.14.1 | |
| id: deploy | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| command: >- | |
| pages deploy ${{ runner.temp }}/artifacts/transformers_js_py --project-name=transformers-js-py-preview --branch=${{ github.head_ref || github.ref_name }} --commit-hash=${{ github.sha }} | |
| - name: Comment on the PR to inform the deployment file URLs | |
| uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const fs = require('fs'); | |
| const path = require('path'); | |
| const deploymentUrl = '${{ steps.deploy.outputs.deployment-url }}'; | |
| // Get all files in the artifacts directory | |
| const artifactsDir = '${{ runner.temp }}/artifacts/transformers_js_py'; | |
| const allFiles = fs.readdirSync(artifactsDir); | |
| // Filter to include only wheel (.whl) and source distribution (.tar.gz) files | |
| const files = allFiles.filter(file => file.endsWith('.whl') || file.endsWith('.tar.gz')); | |
| // Create message with links to each file | |
| let fileLinks = files.map(file => { | |
| const installCommand = `pip install ${deploymentUrl}/${file}`; | |
| return `- [${file}](${deploymentUrl}/${file})\n \`\`\`bash\n ${installCommand}\n \`\`\``; | |
| }).join('\n'); | |
| const message = `π¦ Wheel files have been deployed to Cloudflare Pages: | |
| ${fileLinks}`; | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: message | |
| }); | |
| publish-to-pypi: | |
| name: Publish Python π distribution π¦ to PyPI | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: [test-pyodide-e2e] | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/transformers-js-py | |
| permissions: | |
| id-token: write # IMPORTANT: mandatory for trusted publishing | |
| steps: | |
| - name: Download all the dists | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| name: transformers_js_py-${{ github.ref_name }} | |
| path: dist/ | |
| - name: Publish distribution π¦ to PyPI | |
| uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 | |
| github-release: | |
| name: >- | |
| Sign the Python π distribution π¦ with Sigstore | |
| and upload them to GitHub Release | |
| needs: | |
| - publish-to-pypi | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # IMPORTANT: mandatory for making GitHub Releases | |
| id-token: write # IMPORTANT: mandatory for sigstore | |
| steps: | |
| - name: Download all the dists | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| name: transformers_js_py-${{ github.ref_name }} | |
| path: dist/ | |
| - name: Sign the dists with Sigstore | |
| uses: sigstore/gh-action-sigstore-python@f514d46b907ebcd5bedc05145c03b69c1edd8b46 # v3.0.0 | |
| with: | |
| inputs: >- | |
| ./dist/*.tar.gz | |
| ./dist/*.whl | |
| - name: Create GitHub Release | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| run: >- | |
| gh release create | |
| "$GITHUB_REF_NAME" | |
| --repo "$GITHUB_REPOSITORY" | |
| --notes "" | |
| - name: Upload artifact signatures to GitHub Release | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| # Upload to GitHub Release using the `gh` CLI. | |
| # `dist/` contains the built packages, and the | |
| # sigstore-produced signatures and certificates. | |
| run: >- | |
| gh release upload | |
| "$GITHUB_REF_NAME" dist/** | |
| --repo "$GITHUB_REPOSITORY" |