gradio/.github/workflows/build-pr.yml
pngwn 643442e1a5
generate docs json in ci, reimplement main vs release (#5092)
* fixup site

* fix docs versions

* test ci

* test ci some more

* test ci some more

* test ci some more

* asd

* asd

* asd

* asd

* asd

* asd

* asd

* asd

* asd

* test

* fix

* add changeset

* fix

* fix

* fix

* test ci

* test ci

* test ci

* test ci

* test ci

* test ci

* test ci

* test ci

* test ci

* notebook ci

* notebook ci

* more ci

* more ci

* update changeset

* update changeset

* update changeset

* fix site

* fix

* fix

* fix

* fix

* fix ci

* render mising pages

* remove changeset

* fix path

* fix workflows

* fix workflows

* fix workflows

* fix comment

* tweaks

* tweaks

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2023-08-11 15:54:56 +01:00

70 lines
2.6 KiB
YAML

name: Build PR Artifacts
on:
pull_request:
branches:
- main
jobs:
comment-spaces-start:
uses: "./.github/workflows/comment-queue.yml"
secrets:
gh_token: ${{ secrets.COMMENT_TOKEN }}
with:
pr_number: ${{ github.event.pull_request.number }}
message: spaces~pending~null
build_pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install pip
run: python -m pip install build requests
- name: Get PR Number
id: get_pr_number
run: |
python -c "import os;print(os.environ['GITHUB_REF'].split('/')[2])" > pr_number.txt
echo "PR_NUMBER=$(cat pr_number.txt)" >> $GITHUB_OUTPUT
echo "GRADIO_VERSION=$(python -c 'import requests;print(requests.get("https://pypi.org/pypi/gradio/json").json()["info"]["version"])')" >> $GITHUB_OUTPUT
- name: Build pr package
run: |
echo ${{ steps.get_pr_number.outputs.GRADIO_VERSION }} > gradio/version.txt
pnpm i --frozen-lockfile --ignore-scripts
pnpm build
python3 -m build -w
env:
NODE_OPTIONS: --max_old_space_size=8192
- name: Upload wheel
uses: actions/upload-artifact@v3
with:
name: gradio-${{ steps.get_pr_number.outputs.GRADIO_VERSION }}-py3-none-any.whl
path: dist/gradio-${{ steps.get_pr_number.outputs.GRADIO_VERSION }}-py3-none-any.whl
- name: Set up Demos
run: |
python scripts/copy_demos.py https://gradio-builds.s3.amazonaws.com/${{ github.sha }}/gradio-${{ steps.get_pr_number.outputs.GRADIO_VERSION }}-py3-none-any.whl \
"gradio-client @ git+https://github.com/gradio-app/gradio@${{ github.sha }}#subdirectory=client/python"
- name: Upload all_demos
uses: actions/upload-artifact@v3
with:
name: all_demos
path: demo/all_demos
- name: Create metadata artifact
run: |
python -c "import json; json.dump({'gh_sha': '${{ github.sha }}', 'pr_number': ${{ steps.get_pr_number.outputs.pr_number }}, 'version': '${{ steps.get_pr_number.outputs.GRADIO_VERSION }}', 'wheel': 'gradio-${{ steps.get_pr_number.outputs.GRADIO_VERSION }}-py3-none-any.whl'}, open('metadata.json', 'w'))"
- name: Upload metadata
uses: actions/upload-artifact@v3
with:
name: metadata.json
path: metadata.json