2023-06-20 04:02:03 +08:00
|
|
|
name: 'install all deps'
|
|
|
|
description: 'Install all deps'
|
|
|
|
|
|
|
|
inputs:
|
2024-02-01 08:46:55 +08:00
|
|
|
always_install_pnpm:
|
2023-06-20 04:02:03 +08:00
|
|
|
description: 'Dictates whether or not we should install pnpm & dependencies, regardless of the cache'
|
2023-09-26 22:08:12 +08:00
|
|
|
default: 'false'
|
2023-06-29 21:07:14 +08:00
|
|
|
node_auth_token:
|
|
|
|
description: 'Node auth token'
|
|
|
|
default: ""
|
|
|
|
npm_token:
|
|
|
|
description: 'npm token'
|
|
|
|
default: ""
|
|
|
|
skip_build:
|
|
|
|
description: 'Skip build'
|
2023-09-26 22:08:12 +08:00
|
|
|
default: 'false'
|
2024-02-01 08:46:55 +08:00
|
|
|
test:
|
|
|
|
description: 'Test'
|
|
|
|
default: 'false'
|
|
|
|
python_version:
|
|
|
|
description: 'Python version'
|
|
|
|
default: '3.10'
|
|
|
|
os:
|
|
|
|
description: 'OS'
|
|
|
|
default: 'ubuntu-latest'
|
|
|
|
outputs:
|
|
|
|
venv_activate:
|
|
|
|
description: 'Venv activate'
|
|
|
|
value: ${{ steps.venv.outputs.venv_activate }}
|
2023-06-20 04:02:03 +08:00
|
|
|
|
|
|
|
runs:
|
|
|
|
using: "composite"
|
|
|
|
steps:
|
2024-02-01 08:46:55 +08:00
|
|
|
- name: Set venv binary path (linux)
|
|
|
|
if: ${{ inputs.os == 'ubuntu-latest' }}
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
echo "VENV_ACTIVATE=venv/bin/activate" >> $GITHUB_ENV
|
|
|
|
- name: Set venv binary path (windows)
|
|
|
|
if: ${{ inputs.os == 'windows-latest' }}
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
echo "VENV_ACTIVATE=venv\\\Scripts\\\activate" >> $GITHUB_ENV
|
|
|
|
- name: log venv binary path
|
|
|
|
id: venv
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
echo "venv_activate=$VENV_ACTIVATE" >> $GITHUB_OUTPUT
|
2023-06-20 04:02:03 +08:00
|
|
|
- name: Install Python
|
2023-12-08 04:15:36 +08:00
|
|
|
uses: actions/setup-python@v5
|
2023-06-20 04:02:03 +08:00
|
|
|
with:
|
2024-02-01 08:46:55 +08:00
|
|
|
python-version: ${{ inputs.python_version }}
|
2023-06-20 04:02:03 +08:00
|
|
|
cache: pip
|
|
|
|
cache-dependency-path: |
|
|
|
|
client/python/requirements.txt
|
|
|
|
requirements.txt
|
|
|
|
test/requirements.txt
|
|
|
|
- name: Create env
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade virtualenv
|
|
|
|
python -m virtualenv venv
|
2024-01-18 06:13:51 +08:00
|
|
|
- uses: actions/cache@v4
|
2023-06-20 04:02:03 +08:00
|
|
|
id: cache
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
venv/*
|
2024-02-01 08:46:55 +08:00
|
|
|
client/python/venv
|
|
|
|
restore-keys: |
|
|
|
|
gradio-lib-${{inputs.os}}-latest-pip-
|
2024-02-01 19:22:55 +08:00
|
|
|
key: "gradio-lib-${{inputs.os}}-latest-pip-${{ hashFiles('client/python/requirements.txt') }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('test/requirements.txt') }}-${{ hashFiles('client/python/test/requirements.txt') }}${{ inputs.test == 'true' && '-test' || ''}}"
|
2023-08-11 04:59:00 +08:00
|
|
|
- name: Install Gradio and Client Libraries Locally (Linux)
|
2023-06-20 04:02:03 +08:00
|
|
|
shell: bash
|
|
|
|
run: |
|
2024-02-01 08:46:55 +08:00
|
|
|
. ${{ env.VENV_ACTIVATE }}
|
|
|
|
python -m pip install -e client/python
|
|
|
|
python -m pip install -e ".[oauth]"
|
2023-06-20 04:02:03 +08:00
|
|
|
- name: Install ffmpeg
|
2024-01-17 06:07:10 +08:00
|
|
|
uses: FedericoCarboni/setup-ffmpeg@v2
|
2024-02-01 08:46:55 +08:00
|
|
|
- name: Install test dependencies
|
|
|
|
if: inputs.test == 'true' && steps.cache.outputs.cache-hit != 'true'
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
. ${{ env.VENV_ACTIVATE }}
|
|
|
|
python -m pip install -r test/requirements.txt
|
|
|
|
python -m pip install -r client/python/test/requirements.txt
|
2023-06-20 04:02:03 +08:00
|
|
|
- name: install-frontend
|
2024-02-01 18:34:22 +08:00
|
|
|
uses: "gradio-app/gradio/.github/actions/install-frontend-deps@main"
|
2023-06-20 04:02:03 +08:00
|
|
|
with:
|
2024-02-01 08:46:55 +08:00
|
|
|
always_install_pnpm: ${{ inputs.always_install_pnpm }}
|
2023-06-29 21:07:14 +08:00
|
|
|
node_auth_token: ${{ inputs.node_auth_token }}
|
|
|
|
npm_token: ${{ inputs.npm_token }}
|
|
|
|
skip_build: ${{ inputs.skip_build }}
|
2023-08-11 22:54:56 +08:00
|
|
|
- name: generate json
|
|
|
|
shell: bash
|
2024-02-01 08:46:55 +08:00
|
|
|
if: inputs.os == 'ubuntu-latest'
|
2023-08-11 22:54:56 +08:00
|
|
|
run: |
|
2024-02-01 08:46:55 +08:00
|
|
|
. ${{ env.VENV_ACTIVATE }}
|
2023-08-11 22:54:56 +08:00
|
|
|
python js/_website/generate_jsons/generate.py
|