gradio/.github/workflows/ui.yml
pngwn 26d2c190fc
add test infra + add browser tests to CI (#852)
* add test infra

* improve test setup and utils

* finish a test

* add browser tests to ci

* fix ci

* fix ci

* fix ci

* fix ci

* debug ci

* debug ci

* debug ci

* debug ci

* debug ci

* debug ci

* debug ci

* fix ci

* update lockfile

* fix formatting

* install browser when not cached

* bust cache

* debug test in ci

* fix button label

* generate screenshots for failed tests

* generate screenshots for failed tests

* generate screenshots for failed tests

* fix tests

* clean uip debug logs

* add setuip + teardown to functional tests

* remove build from static checks
2022-03-23 15:19:12 +00:00

77 lines
1.9 KiB
YAML

name: gradio-ui
on:
push:
branches:
- "main"
paths:
- "ui/**"
pull_request:
paths:
- "ui/**"
defaults:
run:
working-directory: ui
env:
CI: true
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1"
concurrency:
group: deploy-${{ github.ref }}-${{ github.event_name == 'push' || github.event.inputs.fire != null }}
cancel-in-progress: true
jobs:
quick-checks:
name: static checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.1
with:
version: 6
- uses: actions/setup-node@v3
with:
node-version: 16
cache: pnpm
cache-dependency-path: ui/pnpm-lock.yaml
- name: install dependencies
run: pnpm i --frozen-lockfile
- name: formatting check
run: pnpm format:check
- name: typecheck
run: pnpm ts:check
continue-on-error: true
- name: unit tests
run: pnpm test:run
functional-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.1
with:
version: 6
- uses: actions/setup-node@v3
with:
node-version: 16
cache: pnpm
cache-dependency-path: ui/pnpm-lock.yaml
- name: Cache browsers
id: browser_cache
uses: actions/cache@main
with:
path: "~/.cache/ms-playwright"
key: chromium-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
- run: pnpm install --frozen-lockfile
- run: pnpx playwright install chromium
- run: pnpm build
- run: pnpm test:browser
- name: Upload failed tests screenshots
if: failure()
uses: actions/upload-artifact@v3
with:
retention-days: 3
name: test-failure-${{ github.run_id }}
path: ui/packages/app/test-results