-
Notifications
You must be signed in to change notification settings - Fork 416
126 lines (110 loc) · 4.11 KB
/
docs.yml
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
name: Build Docs
# We don't want pushes (or PRs) to gh-pages to kick anything off
on:
push:
branches:
- main
- '[0-9]+.[0-9]+.x'
tags:
- v[0-9]+.[0-9]+.[0-9]+
pull_request:
release:
types: [published]
permissions:
contents: write
jobs:
#
# Build our docs on Linux against multiple Pythons
#
Docs:
name: ${{ matrix.python-version }} ${{ matrix.dep-versions }}
runs-on: ubuntu-20.04
env:
DOC_VERSION: dev
environment:
name: github-pages
strategy:
fail-fast: false
matrix:
include:
- python-version: 3.8
check-links: false
dep-versions: requirements.txt
- python-version: 3.9
check-links: true
dep-versions: requirements.txt
steps:
# We check out only a limited depth and then pull tags to save time
- name: Checkout source
uses: actions/[email protected]
with:
fetch-depth: 100
- name: Get tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
# This uses pip to find the right cache dir and then sets up caching for it
- name: Get pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"
- name: Setup pip cache
uses: actions/[email protected]
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: pip-docs-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('ci/*') }}
restore-keys: |
pip-docs-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('ci/*') }}
pip-docs-${{ runner.os }}-${{ matrix.python-version }}-
pip-docs-${{ runner.os }}-
pip-docs-
# This installs the stuff needed to build and install Shapely and CartoPy from source.
- name: Install dependencies (PyPI)
run: |
sudo apt-get install libgeos-dev libproj-dev proj-bin
python -m pip install --upgrade pip setuptools
python -m pip install --no-binary :all: shapely
python -m pip install -r ci/doc_requirements.txt -r ci/extra_requirements.txt -c ci/${{ matrix.dep-versions }}
- name: Download Cartopy Maps
run: ci/download_cartopy_maps.py
- name: Install self
run: python -m pip install -c ci/${{ matrix.dep-versions }} .
- name: Build docs
run: |
export TEST_DATA_DIR=$GITHUB_WORKSPACE/staticdata
pushd docs
make overridecheck html O=-W
popd
- name: Enable linkchecker for PRs
# Doing the linkchecker separately so that we avoid problems with vendored LICENSE
# files in the build directory
if: ${{ github.event_name == 'pull_request' && matrix.check-links == true }}
run: |
pushd docs
find build/html/_static -name LICENSE.md -delete
make linkcheck
popd
- name: Upload docs as artifact
if: ${{ github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.python-version }}-${{ matrix.dep-versions }}-docs
path: |
docs/build/html
!docs/_static/*.pdf
# This overrides the version "dev" with the proper version if we're building off a
# branch that's not main (which is confined to n.nn.x above) or on a tag.
- name: Set doc version
if: ${{ github.event_name != 'push' || !contains(github.ref, 'main') }}
run: echo "DOC_VERSION=v$(python -c 'import metpy,re; print(re.search(r"(\d+\.\d+)", metpy.__version__)[0])')" >> $GITHUB_ENV
- name: Upload to GitHub Pages
if: ${{ github.event_name != 'pull_request' && matrix.python-version == '3.9' }}
uses: peaceiris/[email protected]
with:
deploy_key: ${{ secrets.GHPAGES_DEPLOY_KEY }}
publish_dir: ./docs/build/html
exclude_assets: '.buildinfo,_static/jquery-*.js,_static/underscore-*.js'
destination_dir: ./${{ env.DOC_VERSION }}
keep_files: false
full_commit_message: Deploy ${{ env.DOC_VERSION }} to GitHub Pages