gradio/.github/actions/install-all-deps/action.yml
pngwn d30432e9c6
harden CI (#8965)
* test pr

* conditional

* conditional

* conditional

* conditional

* conditional

* changes

* changes

* add changeset

* changes

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-08-05 15:27:26 +01:00

96 lines
3.1 KiB
YAML

name: "install all deps"
description: "Install all deps"
inputs:
always_install_pnpm:
description: "Dictates whether or not we should install pnpm & dependencies, regardless of the cache"
default: "false"
skip_build:
description: "Skip build"
default: "false"
build_lite:
description: "Build lite"
default: "false"
test:
description: "Test"
default: "false"
python_version:
description: "Python version"
default: "3.8"
os:
description: "OS"
default: "ubuntu-latest"
outputs:
venv_activate:
description: "Venv activate"
value: ${{ steps.venv.outputs.venv_activate }}
runs:
using: "composite"
steps:
- 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
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python_version }}
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
- uses: actions/cache@v4
id: cache
with:
path: |
venv/*
client/python/venv
restore-keys: |
gradio-lib-${{inputs.os}}-latest-pip-
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' || ''}}"
- name: Install ffmpeg
uses: FedericoCarboni/setup-ffmpeg@v2
- 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
- name: Install Gradio and Client Libraries Locally (Linux)
shell: bash
run: |
. ${{ env.VENV_ACTIVATE }}
python -m pip install -e client/python
python -m pip install -e ".[oauth]"
- name: install-frontend
uses: "gradio-app/gradio/.github/actions/install-frontend-deps@main"
with:
always_install_pnpm: ${{ inputs.always_install_pnpm }}
skip_build: ${{ inputs.skip_build }}
build_lite: ${{ inputs.build_lite }}
- name: generate json
shell: bash
if: inputs.os == 'ubuntu-latest'
run: |
. ${{ env.VENV_ACTIVATE }}
python js/_website/generate_jsons/generate.py