-
Notifications
You must be signed in to change notification settings - Fork 416
155 lines (136 loc) · 5.26 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
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
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-
- name: Get cached compiled libraries
id: cache-libraries
uses: actions/[email protected]
with:
path: ~/local
key: build-${{ runner.os }}-0
- name: Build compiled libraries
if: steps.cache-libraries.outputs.cache-hit != 'true'
run: |
mkdir proj-build
curl https://download.osgeo.org/proj/proj-8.1.1.tar.gz | tar xzf - --strip-components=1 -C proj-build
pushd proj-build
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=~/local -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release \
-DENABLE_IPO=ON -DENABLE_CURL=OFF -DBUILD_CCT:BOOL=OFF -DBUILD_CS2CS:BOOL=OFF -DBUILD_GEOD:BOOL=OFF \
-DBUILD_GIE:BOOL=OFF -DBUILD_GMOCK:BOOL=OFF -DBUILD_PROJINFO:BOOL=OFF -DBUILD_PROJSYNC:BOOL=OFF -DBUILD_TESTING:BOOL=OFF
cmake --build . -j6
cmake --install .
popd
- name: Set up paths to libraries
run: |
echo "CPATH=$CPATH:$HOME/local/include" >> $GITHUB_ENV
echo "LIBRARY_PATH=$LIBRARY_PATH:$HOME/local/lib" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/local/lib" >> $GITHUB_ENV
echo "$HOME/local/bin" >> $GITHUB_PATH
# 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
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