Publish Doc #1168
This file contains hidden or 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
# 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: Publish Doc | |
on: | |
push: | |
branches: [main] | |
schedule: | |
- cron: '0 */2 * * *' # every 2 hours | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: write | |
env: | |
# This env var is used by Swatinem/rust-cache@v2 for the cache | |
# key, so we set it to make sure it is always consistent. | |
CARGO_TERM_COLOR: always | |
# Disable full debug symbol generation to speed up CI build and keep memory down | |
# "1" means line tables only, which is useful for panic tracebacks. | |
RUSTFLAGS: "-C debuginfo=1" | |
RUST_BACKTRACE: "1" | |
# according to: https://matklad.github.io/2021/09/04/fast-rust-builds.html | |
# CI builds are faster with incremental disabled. | |
CARGO_INCREMENTAL: "0" | |
CARGO_BUILD_JOBS: "1" | |
jobs: | |
build-and-deploy: | |
# scheduled run should only happen on main repo not forked ones. | |
if: | | |
github.event_name != 'schedule' || github.repository == 'lancedb/lance-python-doc' | |
runs-on: ubuntu-24.04 | |
timeout-minutes: 60 | |
strategy: | |
matrix: | |
python-version: [ 3.11 ] # Ray does not support 3.12 yet. | |
steps: | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y protobuf-compiler libssl-dev | |
# pin the toolchain version to avoid surprises | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: stable | |
- uses: rui314/setup-mold@v1 | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: Checkout lance-python-doc repo | |
uses: actions/checkout@v4 | |
- name: Checkout lance repo | |
uses: actions/checkout@v4 | |
with: | |
repository: lancedb/lance | |
path: lance | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: lance/python | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: Copy docs to Lance | |
run: | | |
mv docs lance/python/docs | |
- name: Set up Python virtual environment | |
run: | | |
python -m venv venv | |
source venv/bin/activate | |
pip install maturin | |
pip install -r lance/python/docs/requirements.txt | |
- name: Build Doc | |
working-directory: lance/python | |
run: | | |
source ../../venv/bin/activate | |
maturin develop | |
sphinx-build -b html docs docs/_build/html | |
- name: Add .nojekyll | |
run: | | |
touch lance/python/docs/_build/html/.nojekyll | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: lance/python/docs/_build/html |