Add build emebddings workflow #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Daily Build Embeddings | |
env: | |
DIFFUSERS_SLOW_IMPORT: yes | |
on: | |
push: | |
schedule: | |
- cron: "5 7 * * *" # every day at 07:05 | |
# to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Steps | |
# for i in list: | |
# git clone | |
# install | |
# build embeddings | |
jobs: | |
matrix-job: | |
runs-on: ubuntu-latest | |
env: | |
UV_HTTP_TIMEOUT: 900 # max 15min to install deps (shouldn't take more than 5min) | |
strategy: | |
max-parallel: 1 # run the matrix jobs sequentially | |
matrix: | |
include: | |
- repo_id: huggingface/diffusers | |
doc_folder: docs/source/en | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
timeout-minutes: 360 # Set timeout to 6 hours | |
steps: | |
- name: Checkout the current repository | |
uses: actions/checkout@v2 | |
- name: Setup REPO_NAME | |
shell: bash | |
run: | | |
current_path=$(pwd) | |
repo_id="${{ matrix.repo_id }}" | |
repo_name="${repo_id#*/}" | |
echo "REPO_NAME=${repo_name}" >> $GITHUB_ENV | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
repository: ${{ matrix.repo_id }} | |
path: ${{ env.REPO_NAME }} | |
- name: Export PIP_OR_UV ('pip' or 'uv pip') | |
# Use `uv` only if running on the base runner. | |
# When using a container, `pip` has already been used to installed existing deps | |
# and is therefore quicker to resolve (already have some cached stuff). | |
run: | | |
if [ -z "${{ inputs.custom_container }}" ] | |
then | |
echo "PIP_OR_UV=uv pip" >> $GITHUB_ENV | |
else | |
echo "PIP_OR_UV=pip" >> $GITHUB_ENV | |
fi | |
# Use venv in both cases | |
- name: Install uv | |
run: | | |
pip install -U uv | |
uv venv | |
- name: Setup environment | |
shell: bash | |
run: | | |
current_path=$(pwd) | |
source .venv/bin/activate | |
$PIP_OR_UV install . | |
cd ${{ github.workspace }}/${{ env.REPO_NAME }} | |
$PIP_OR_UV install .[dev] | |
cd $current_path | |
- name: Build embeddings | |
shell: bash | |
run: | | |
source .venv/bin/activate | |
doc-builder | |
cleanup-job: | |
needs: matrix-job | |
runs-on: ubuntu-latest | |
steps: | |
- name: Run cleanup steps | |
run: | | |
echo "Performing cleanup tasks" | |
# Add your cleanup commands here |