Skip to content

Commit

Permalink
ci[rust,python]: Improve docs workflows (#4806)
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego committed Sep 11, 2022
1 parent 4df9877 commit 4ee581b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
name: Docs check
name: Check documentation

on:
pull_request:
paths:
- 'py-polars/**'
- '.github/workflows/docs_check.yaml'
- '.github/workflows/docs-check.yaml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: Docs check
main:
runs-on: ubuntu-latest
defaults:
run:
working-directory: py-polars/docs

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: 'py-polars/docs/requirements-docs.txt'
- name: Install dependencies

- name: Install Python dependencies
run: |
pip install --upgrade pip
pip install -r requirements-docs.txt
- name: Build Python reference
- name: Build Python documentation
env:
SPHINXOPTS: -W
run: make html
43 changes: 27 additions & 16 deletions .github/workflows/docs.yaml → .github/workflows/docs-deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,44 +1,55 @@
name: Docs
name: Deploy documentation

on:
push:
branches:
- master
- docs

jobs:
test:
name: Docs
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2022-08-22
components: rust-docs

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: 'py-polars/docs/requirements-docs.txt'
- name: Install dependencies

- name: Install Python dependencies
working-directory: py-polars/docs
run: |
pip install --upgrade pip
pip install -r requirements-docs.txt
- name: Build python reference
- name: Build Python documentation
working-directory: py-polars/docs
run: make html
- name: deploy docs

- name: Set up Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2022-08-22
components: rust-docs

- name: Cache Rust
uses: Swatinem/rust-cache@v2

- name: Build Rust documentation
env:
RUSTFLAGS: --cfg docsrs
run: cargo doc --features=docs-selection --package polars

- name: Prepare deployment
run: |
set -e
cargo doc --features=docs-selection --package polars && \
echo '<meta http-equiv=refresh content=0;url=polars/index.html>' > target/doc/index.html && \
echo '<meta http-equiv=refresh content=0;url=polars/index.html>' > target/doc/index.html
mkdir target/doc/py-polars
cp -r py-polars/docs/build/html target/doc/py-polars
echo ghp-import step
ghp-import -n target/doc && \
- name: Deploy
run: |
ghp-import -n target/doc
git push -qf https://${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git gh-pages

0 comments on commit 4ee581b

Please sign in to comment.