Skip to content

feat(ci): Use Claude to analyze CI failures and post diagnostic PR co… #288

feat(ci): Use Claude to analyze CI failures and post diagnostic PR co…

feat(ci): Use Claude to analyze CI failures and post diagnostic PR co… #288

Workflow file for this run

# Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Update Documentation
on:
push:
paths:
- velox/docs/**
- .github/workflows/docs.yml
pull_request:
paths:
- velox/docs/**
- .github/workflows/docs.yml
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.repository }}-${{ github.head_ref || github.sha }}
cancel-in-progress: true
jobs:
build_docs:
name: Build and Push
runs-on: 16-core-ubuntu
container: ghcr.io/facebookincubator/velox-dev:centos9
env:
CCACHE_DIR: /tmp/ccache
CCACHE_NOHASHDIR: true # build isolation leads to cache misses
steps:
- name: Restore ccache
if: false
uses: apache/infrastructure-actions/stash/restore@3354c1565d4b0e335b78a76aedd82153a9e144d4
id: restore-cache
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-docs-16-core-ubuntu
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
persist-credentials: true
- name: Configure git safe directory
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Install System Dependencies
run: |
dnf install -y --setopt=install_weak_deps=False pandoc
- name: CCache Stats Before
run: ccache -sz
- name: Install uv
run: |
pip install --upgrade uv
uv --version
- name: Check for pyvelox changes
id: check-pyvelox
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
CHANGED=$(git diff --name-only ${{ github.event.pull_request.base.sha }}..HEAD)
else
CHANGED=$(git diff --name-only HEAD~1..HEAD)
fi
if echo "$CHANGED" | grep -qE '^(python/|velox/python/)'; then
echo "Building pyvelox: python/ files changed."
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "Skipping pyvelox build: no python/ files changed."
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Install Python Dependencies
timeout-minutes: 30
env:
PYVELOX_CHANGED: ${{ steps.check-pyvelox.outputs.changed }}
run: |
# When python/ files haven't changed, skip building pyvelox
# from C++ source (slow) and only install doc dependencies.
EXTRA_FLAGS=""
if [ "$PYVELOX_CHANGED" != "true" ]; then
echo "Skipping pyvelox C++ build (no changes in python/)."
EXTRA_FLAGS="--no-install-project"
fi
# Retry up to 3 times to handle transient network issues
# (pip/uv hangs, registry timeouts).
for attempt in 1 2 3; do
echo "Attempt $attempt of 3..."
if uv sync --extra docs $EXTRA_FLAGS --verbose; then
echo "Python dependencies installed successfully."
exit 0
fi
echo "Attempt $attempt failed. Cleaning up and retrying in 10 seconds..."
rm -rf .venv uv.lock
sleep 10
done
echo "All 3 attempts failed."
exit 1
- name: CCache Stats After
run: ccache -s
- name: Save ccache
uses: apache/infrastructure-actions/stash/save@3354c1565d4b0e335b78a76aedd82153a9e144d4
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-docs-16-core-ubuntu
- name: Build Documentation
run: |
source .venv/bin/activate
cd velox/docs
make clean
# pyvelox
mkdir -p bindings/python
pandoc ../../python/README.md --from markdown --to rst -s -o bindings/python/README_generated_pyvelox.rst
# velox
make html
- name: Setup Git User
run: |
git config --global user.email "velox@users.noreply.github.com"
git config --global user.name "velox"
- name: Push Documentation
if: ${{ github.event_name == 'push' && github.repository == 'facebookincubator/velox'}}
run: |
git checkout gh-pages
cp -R velox/docs/_build/html/* docs
git add docs
if [ -n "$(git status --porcelain --untracked-files=no)" ]
then
git commit -m "Update documentation"
git push
fi
- name: Upload Documentation
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
path: velox/docs/_build/html
retention-days: 3