mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-06 10:25:17 +08:00
dccf68d914
* wip pr * update client version * update space fetcher * changelog, workflow * fix not flaky tests * lint * v2
150 lines
4.0 KiB
YAML
150 lines
4.0 KiB
YAML
name: gradio-backend
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "main"
|
|
pull_request:
|
|
|
|
concurrency:
|
|
group: backend-${{ github.ref }}-${{ github.event_name == 'push' || github.event.inputs.fire != null }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
NODE_OPTIONS: "--max-old-space-size=4096"
|
|
|
|
jobs:
|
|
client-test:
|
|
needs: [client-lint]
|
|
strategy:
|
|
matrix:
|
|
os: ["ubuntu-latest", "windows-latest"]
|
|
test-type: ["not flaky", "flaky"]
|
|
python-version: ["3.9"]
|
|
runs-on: ${{ matrix.os }}
|
|
continue-on-error: ${{ matrix.test-type == 'flaky' }}
|
|
defaults:
|
|
run:
|
|
working-directory: client/python
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Install Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
cache: pip
|
|
cache-dependency-path: |
|
|
client/python/requirements.txt
|
|
requirements.txt
|
|
test/requirements-37.txt
|
|
test/requirements.txt
|
|
- name: Install Client
|
|
run: |
|
|
pip install -e .
|
|
pip install -r test/requirements.txt
|
|
- name: Tests
|
|
shell: bash
|
|
run: |
|
|
python -m pytest -m "${{ matrix.test-type }}"
|
|
client-lint:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: client/python
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Install Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.9"
|
|
cache: pip
|
|
cache-dependency-path: |
|
|
client/python/requirements.txt
|
|
requirements.txt
|
|
test/requirements-37.txt
|
|
test/requirements.txt
|
|
- name: Install Client
|
|
run: |
|
|
pip install -e .
|
|
pip install -r test/requirements.txt
|
|
- name: Lint
|
|
run: bash scripts/lint.sh
|
|
test:
|
|
needs: [lint]
|
|
strategy:
|
|
matrix:
|
|
os: ["ubuntu-latest", "windows-latest"]
|
|
test-type: ["not flaky", "flaky"]
|
|
python-version: ["3.9", "3.7"]
|
|
runs-on: ${{ matrix.os }}
|
|
continue-on-error: ${{ matrix.test-type == 'flaky' }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Install Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
cache: pip
|
|
cache-dependency-path: |
|
|
client/python/requirements.txt
|
|
requirements.txt
|
|
test/requirements-37.txt
|
|
test/requirements.txt
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v2.2.2
|
|
with:
|
|
version: 7
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 16
|
|
cache: pnpm
|
|
cache-dependency-path: pnpm-lock.yaml
|
|
- name: Install Gradio
|
|
shell: bash
|
|
run: |
|
|
pip install -e .
|
|
python -m pip install --upgrade pip
|
|
- name: Install 3.9 Test Dependencies
|
|
shell: bash
|
|
if: ${{ matrix.python-version == '3.9' }}
|
|
run: |
|
|
pip install -r test/requirements.txt
|
|
- name: Install 3.7 Test Dependencies
|
|
shell: bash
|
|
if: ${{ matrix.python-version == '3.7' }}
|
|
run: |
|
|
pip install -r test/requirements-37.txt
|
|
- name: Build frontend
|
|
shell: bash
|
|
run: |
|
|
pnpm i --frozen-lockfile
|
|
pnpm build
|
|
- name: Install ffmpeg
|
|
uses: FedericoCarboni/setup-ffmpeg@v2
|
|
- name: Run tests
|
|
shell: bash
|
|
run: |
|
|
mkdir -p test-reports
|
|
coverage run -m pytest -m "${{ matrix.test-type }}" --ignore=client
|
|
coverage xml
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Install Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.9"
|
|
cache: pip
|
|
cache-dependency-path: |
|
|
client/python/requirements.txt
|
|
requirements.txt
|
|
test/requirements-37.txt
|
|
test/requirements.txt
|
|
- name: Install Test Dependencies
|
|
run: pip install -e . -r test/requirements.txt
|
|
- name: Lint
|
|
run: bash scripts/lint_backend.sh
|
|
- name: Typecheck
|
|
run: bash scripts/type_check_backend.sh
|