Skip to content

Commit 5ebf799

Browse files
authored
CI: Merge two docs CIs to one (#1183)
* simplify a bit * Update to artifact * Merge `docs-preview.yml` and `docs.yml` * not installed mkdocs will skip * remove name * use editable mode to avoid _pytest.pathlib.ImportPathMismatchError * adjust block * use better steps name * Update CHANGELOG.md * simplify name * lint codes * adjust block sequences
1 parent 36de148 commit 5ebf799

File tree

5 files changed

+47
-62
lines changed

5 files changed

+47
-62
lines changed

.github/workflows/docs-preview.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.

.github/workflows/docs.yml

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
name: Build documentation
1+
name: documentation
22

33
on:
44
push:
55
branches:
66
- dev
7+
pull_request:
8+
branches:
9+
- dev
710

811
jobs:
9-
build-docs:
12+
build:
1013
runs-on: ubuntu-latest
11-
name: Build documentation
1214

1315
# https://github.com/marketplace/actions/setup-miniconda#use-a-default-shell
1416
defaults:
@@ -25,19 +27,43 @@ jobs:
2527
with:
2628
auto-update-conda: true
2729
miniforge-variant: Mambaforge
28-
channels: conda-forge
29-
activate-environment: pyjanitor-dev
3030
environment-file: environment-dev.yml
3131
use-mamba: true
3232

33+
- name: Install pyjanitor
34+
# use editable mode to avoid _pytest.pathlib.ImportPathMismatchError
35+
run: pip install -e .
36+
3337
- name: Build docs
34-
run: |
35-
conda activate pyjanitor-dev
36-
python -m ipykernel install --user --name pyjanitor-dev
37-
pip install -e .
38-
mkdocs build
38+
run: mkdocs build
39+
40+
- uses: actions/upload-artifact@v3
41+
with:
42+
name: website
43+
path: site/
44+
45+
- name: Test docs
46+
run: pytest -m "documentation"
47+
48+
- name: Docs preview
49+
if: ${{ github.event_name == 'pull_request' }}
50+
uses: nwtgck/[email protected]
51+
with:
52+
publish-dir: "./site"
53+
production-deploy: false
54+
github-token: ${{ secrets.GHPAGES_TOKEN }}
55+
deploy-message: "Deploy from GitHub Actions"
56+
enable-pull-request-comment: true
57+
enable-commit-comment: false
58+
overwrites-pull-request-comment: true
59+
alias: deploy-preview-${{ github.event.number }}
60+
env:
61+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
62+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
63+
timeout-minutes: 1
3964

4065
- name: Deploy website
66+
if: ${{ github.event_name == 'push' }}
4167
uses: peaceiris/actions-gh-pages@v3
4268
with:
4369
# https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-set-personal-access-token-personal_token

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
- [ENH] Add explicit default parameter to `case_when` function. Issue #1159 @samukweku
3131
- [BUG] pandas 1.5.x `_MergeOperation` doesn't have `copy` keyword anymore. Issue #1174 @Zeroto521
3232
- [TST] Compat with macos and window, to fix `FailedHealthCheck` Issue #1181 @Zeroto521
33+
- [INF] Merge two docs CIs (`docs-preview.yml` and `docs.yml`) to one. And add `documentation` pytest mark. PR #1183 @Zeroto521
3334

3435
## [v0.23.1] - 2022-05-03
3536

pytest.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ markers =
1212
spark_functions: tests for pyspark functions
1313
xarray: tests for xarray functions
1414
timeseries: tests for timeseries
15+
documentation: tests for documentation
1516
turtle: tests that take more than 5 seconds to execute

tests/test_documentation_build.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@
22

33
import os
44

5+
import pytest
56

7+
8+
# If `mkdocs` wasn't installed in environment, just skip.
9+
# Can't use `pytest.importorskip("mkdocs")`, 'mkdocs' is also
10+
# a folder name to pyjanitor project.
11+
pytest.importorskip("mkdocstrings")
12+
13+
14+
@pytest.mark.documentation
615
def test_docs_general_functions_present():
716
"""Test that all docs pages build correctly.
817

0 commit comments

Comments
 (0)