forked from facebookincubator/velox
-
Notifications
You must be signed in to change notification settings - Fork 2
160 lines (139 loc) · 5.13 KB
/
docs.yml
File metadata and controls
160 lines (139 loc) · 5.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# 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