gradio/.circleci/config.yml
Freddy Boulton e0a55df7dc
Modify CI to check for unused imports (#2555)
* Add lint script + remove unused imports

* Add lint file to sc
2022-10-28 10:56:18 -04:00

79 lines
2.1 KiB
YAML

version: 2.1
orbs:
codecov: codecov/codecov@3.2.2
node: circleci/node@5.0.2
jobs:
test:
parameters:
test-type:
type: string
python-version:
type: string
environment:
NODE_OPTIONS: --max-old-space-size=4096
docker:
- image: cimg/python:<< parameters.python-version >>-browsers
steps:
- checkout
- run: mkdir test-reports
- restore_cache:
key: deps4-{{ .Branch }}-{{ checksum "requirements.txt" }}-<< parameters.python-version >>
- run:
name: Install ffmpeg
command: |
sudo apt update
sudo apt install ffmpeg -y
- run:
name: Upgrade virtual environment tools
command: |
python -m pip install --upgrade pip virtualenv
- run:
name: Install Python deps in a venv
command: |
python -m virtualenv venv
. venv/bin/activate
bash scripts/install_gradio.sh
bash scripts/install_test_requirements.sh
- save_cache:
key: deps4-{{ .Branch }}-{{ checksum "requirements.txt" }}-<< parameters.python-version >>
paths:
- "venv"
- node/install:
node-version: "16"
- run:
name: Build frontend
command: |
npm i pnpm@6 -g
cd ui
pnpm i --frozen-lockfile
pnpm build
- run:
command: |
mkdir screenshots
- run:
command: |
. venv/bin/activate
bash scripts/lint_backend.sh
- run:
command: |
. venv/bin/activate
coverage run -m pytest -m "<< parameters.test-type >>"
coverage xml
- codecov/upload:
file: "coverage.xml"
- store_artifacts:
path: /home/circleci/project/test/tmp
destination: screenshots
- store_test_results:
path: test-reports/
workflows:
backend:
jobs:
- test:
matrix:
parameters:
test-type: ["not flaky", "flaky"]
python-version: ["3.9.2", "3.7.13"]