| name: gradio-ui |
|
|
| on: |
| push: |
| branches: |
| - "main" |
| pull_request: |
|
|
| env: |
| CI: true |
| PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" |
| NODE_OPTIONS: "--max-old-space-size=4096" |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} |
| 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-22.04 |
| steps: |
| - uses: actions/checkout@v3 |
| - name: install dependencies |
| uses: "./.github/actions/install-frontend-deps" |
| with: |
| always-install-pnpm: true |
| - name: build client |
| run: pnpm --filter @gradio/client build |
| - name: build the wasm module |
| run: pnpm --filter @gradio/wasm build |
| - name: lint |
| run: pnpm lint |
| - name: typecheck |
| run: pnpm ts:check |
| - name: unit tests |
| run: pnpm test:run |
| functional-test: |
| runs-on: ubuntu-latest |
| outputs: |
| source_branch: ${{ steps.pr_details.outputs.source_branch }} |
| pr_number: ${{ steps.pr_details.outputs.pr_number }} |
| steps: |
| - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac |
| - name: install dependencies |
| id: install_deps |
| uses: "./.github/actions/install-all-deps" |
| with: |
| always-install-pnpm: true |
| - name: get pr details |
| id: pr_details |
| uses: gradio-app/github/actions/find-pr@main |
| with: |
| github_token: ${{ secrets.GITHUB_TOKEN }} |
| - name: deploy json to aws |
| if: steps.pr_details.outputs.source_branch == 'changeset-release/main' || steps.pr_details.outputs.source_branch == 'changeset-release/v4' |
| run: | |
| export AWS_ACCESS_KEY_ID=${{ secrets.AWSACCESSKEYID }} |
| export AWS_SECRET_ACCESS_KEY=${{ secrets.AWSSECRETKEY }} |
| export AWS_DEFAULT_REGION=us-west-2 |
| version=$(jq -r .version js/_website/src/lib/json/version.json) |
| aws s3 cp ./js/_website/src/lib/json/ s3://gradio-docs-json/$version/ --recursive |
| - name: install outbreak_forecast dependencies |
| run: | |
| . venv/bin/activate |
| python -m pip install -r demo/outbreak_forecast/requirements.txt |
| - run: pnpm exec playwright install chromium |
| - name: run browser tests |
| run: | |
| . venv/bin/activate |
| pnpm test:browser |
| - name: upload screenshots |
| uses: actions/upload-artifact@v3 |
| if: always() |
| with: |
| name: playwright-screenshots |
| path: | |
| ./test-results |
| - name: run browser component tests |
| run: | |
| . venv/bin/activate |
| pnpm run test:ct |
| - name: save artifacts |
| uses: actions/upload-artifact@v3 |
| with: |
| name: website-json-${{ steps.pr_details.outputs.pr_number }} |
| path: | |
| ./js/_website/src/lib/json |
| deploy_to_vercel: |
| uses: "./.github/workflows/deploy-website.yml" |
| needs: functional-test |
| if: always() |
| secrets: |
| gh_token: ${{ secrets.COMMENT_TOKEN }} |
| vercel_token: ${{ secrets.VERCEL_TOKEN }} |
| vercel_org_id: ${{ secrets.VERCEL_ORG_ID }} |
| vercel_project_id: ${{ secrets.VERCEL_PROJECT_ID }} |
| with: |
| branch_name: ${{ needs.functional-test.outputs.source_branch }} |
| pr_number: ${{ needs.functional-test.outputs.pr_number }} |
|
|