chore: import upstream snapshot with attribution
publish / version_or_publish (push) Has been cancelled
storybook-build / changes (push) Has been cancelled
storybook-build / :storybook-build (push) Has been cancelled
Sync Gradio Skills to Hugging Face / sync-skills (push) Has been cancelled
functional / changes (push) Has been cancelled
functional / build-frontend (push) Has been cancelled
functional / functional-test-SSR=false (push) Has been cancelled
functional / functional-reload (push) Has been cancelled
js / changes (push) Has been cancelled
js / js-test (push) Has been cancelled
docs-build / changes (push) Has been cancelled
docs-build / docs-build (push) Has been cancelled
docs-build / website-build (push) Has been cancelled
functional / functional-test-SSR=true (push) Has been cancelled
hygiene / hygiene-test (push) Has been cancelled
python / changes (push) Has been cancelled
python / build (push) Has been cancelled
python / test-ubuntu-latest-flaky (push) Has been cancelled
python / test-ubuntu-latest-not-flaky (push) Has been cancelled
python / test-windows-latest-flaky (push) Has been cancelled
python / test-windows-latest-not-flaky (push) Has been cancelled
publish / version_or_publish (push) Has been cancelled
storybook-build / changes (push) Has been cancelled
storybook-build / :storybook-build (push) Has been cancelled
Sync Gradio Skills to Hugging Face / sync-skills (push) Has been cancelled
functional / changes (push) Has been cancelled
functional / build-frontend (push) Has been cancelled
functional / functional-test-SSR=false (push) Has been cancelled
functional / functional-reload (push) Has been cancelled
js / changes (push) Has been cancelled
js / js-test (push) Has been cancelled
docs-build / changes (push) Has been cancelled
docs-build / docs-build (push) Has been cancelled
docs-build / website-build (push) Has been cancelled
functional / functional-test-SSR=true (push) Has been cancelled
hygiene / hygiene-test (push) Has been cancelled
python / changes (push) Has been cancelled
python / build (push) Has been cancelled
python / test-ubuntu-latest-flaky (push) Has been cancelled
python / test-ubuntu-latest-not-flaky (push) Has been cancelled
python / test-windows-latest-flaky (push) Has been cancelled
python / test-windows-latest-not-flaky (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,161 @@
|
||||
name: "python"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, edited, labeled, unlabeled]
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
concurrency:
|
||||
group: "${{ github.event.pull_request.number }}-${{ github.ref_name }}-${{ github.workflow }}"
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
HF_TOKEN: ${{ vars.HF_TOKEN }}
|
||||
UV_EXCLUDE_NEWER: 7 days
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
name: "changes"
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
should_run: ${{ steps.changes.outputs.should_run }}
|
||||
sha: ${{ steps.changes.outputs.sha }}
|
||||
pr_number: ${{ steps.changes.outputs.pr_number }}
|
||||
source_branch: ${{ steps.changes.outputs.source_branch }}
|
||||
source_repo: ${{ steps.changes.outputs.source_repo }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: "gradio-app/gradio/.github/actions/changes@main"
|
||||
id: changes
|
||||
with:
|
||||
filter: "gradio"
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
build:
|
||||
permissions:
|
||||
contents: read
|
||||
name: "build"
|
||||
needs: changes
|
||||
if: needs.changes.outputs.should_run == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: install dependencies
|
||||
id: install_deps
|
||||
uses: "gradio-app/gradio/.github/actions/install-all-deps@main"
|
||||
with:
|
||||
python_version: "3.10"
|
||||
os: "ubuntu-latest"
|
||||
test: true
|
||||
skip_docs_gen: true
|
||||
- name: Lint
|
||||
run: |
|
||||
. venv/bin/activate
|
||||
./scripts/lint_backend.sh
|
||||
- name: Typecheck
|
||||
run: |
|
||||
. venv/bin/activate
|
||||
./scripts/type_check_backend.sh
|
||||
- name: Build wheel
|
||||
run: |
|
||||
. venv/bin/activate
|
||||
uv pip install build
|
||||
python -m build
|
||||
- name: Build gradio_client wheel
|
||||
run: |
|
||||
. venv/bin/activate
|
||||
cd client/python
|
||||
python -m build
|
||||
- name: Upload gradio wheel
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: gradio-wheel
|
||||
path: dist/*.whl
|
||||
- name: Upload gradio_client wheel
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: gradio-client-wheel
|
||||
path: client/python/dist/*.whl
|
||||
test:
|
||||
permissions:
|
||||
contents: read
|
||||
name: "test-${{ matrix.os }}-${{ matrix.test-type == 'flaky' && 'flaky' || 'not-flaky'}}"
|
||||
needs: [changes, build]
|
||||
if: needs.changes.outputs.should_run == 'true'
|
||||
strategy:
|
||||
matrix:
|
||||
os: ["ubuntu-latest", "windows-latest"]
|
||||
test-type: ["not flaky", "flaky"]
|
||||
exclude:
|
||||
- os: ${{ github.event_name == 'pull_request' && contains( github.event.pull_request.labels.*.name, 'windows-tests') && 'dummy' || 'windows-latest' }}
|
||||
- test-type: ${{ github.event_name == 'pull_request' && contains( github.event.pull_request.labels.*.name, 'flaky-tests') && 'dummy' || 'flaky' }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
continue-on-error: true
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Download gradio wheel
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: gradio-wheel
|
||||
path: dist/
|
||||
- name: Download gradio_client wheel
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: gradio-client-wheel
|
||||
path: client-dist/
|
||||
- name: install dependencies
|
||||
id: install_deps
|
||||
uses: "gradio-app/gradio/.github/actions/install-all-deps@main"
|
||||
with:
|
||||
python_version: "3.10"
|
||||
os: ${{ matrix.os }}
|
||||
test: true
|
||||
skip_build: true
|
||||
skip_gradio_install: true
|
||||
skip_docs_gen: true
|
||||
- name: Install gradio_client wheel
|
||||
shell: bash
|
||||
run: |
|
||||
. ${{steps.install_deps.outputs.venv_activate}}
|
||||
uv pip install client-dist/*.whl
|
||||
- name: Install gradio wheel
|
||||
shell: bash
|
||||
run: |
|
||||
. ${{steps.install_deps.outputs.venv_activate}}
|
||||
uv pip install "$(ls dist/*.whl)[oauth,mcp]"
|
||||
- name: uv pip freeze
|
||||
shell: bash
|
||||
run: |
|
||||
. ${{steps.install_deps.outputs.venv_activate}}
|
||||
uv pip freeze
|
||||
- name: Generate .pyi files
|
||||
shell: bash
|
||||
run: |
|
||||
. ${{steps.install_deps.outputs.venv_activate}}
|
||||
python -c "import gradio"
|
||||
- name: Copy wheels for docker tests
|
||||
shell: bash
|
||||
run: |
|
||||
cp dist/*.whl test/test_docker/
|
||||
cp client-dist/*.whl test/test_docker/
|
||||
- name: Remove local gradio source to use installed wheel
|
||||
shell: bash
|
||||
run: |
|
||||
find gradio -name "__init__.py" -delete
|
||||
- name: Run parallel tests
|
||||
shell: bash
|
||||
run: |
|
||||
. ${{steps.install_deps.outputs.venv_activate}}
|
||||
python -m pytest -n auto -m "${{ matrix.test-type }} and not serial"
|
||||
- name: Run non-flaky serial tests
|
||||
if: matrix.test-type == 'not flaky'
|
||||
shell: bash
|
||||
run: |
|
||||
. ${{steps.install_deps.outputs.venv_activate}}
|
||||
python -m pytest -m "${{ matrix.test-type }} and serial"
|
||||
Reference in New Issue
Block a user