-
Notifications
You must be signed in to change notification settings - Fork 361
162 lines (142 loc) · 4.64 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
156
157
158
159
160
161
162
#
# Build GMT documentation and deploy
#
name: Docs
on:
# pull_request:
push:
branches:
- master
- 6.[0-9]+
paths:
- 'ci/**'
- 'doc/**'
- '**/CMakeLists.txt'
- '.github/workflows/docs.yml'
release:
types:
- published
defaults:
run:
# default to use bash shell
shell: bash -el {0}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
jobs:
docs:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 45
env:
# directories
COASTLINEDIR: ${{ github.workspace }}/coastline
INSTALLDIR: ${{ github.workspace }}/gmt-install-dir
# disable auto-display of GMT plots
GMT_END_SHOW: off
# Build documentation
BUILD_DOCS : true
PACKAGE : true
RUN_TESTS : false
strategy:
fail-fast: false
matrix:
include:
- name: Linux
os: ubuntu-latest
- name: macOS
os: macos-latest
- name: Windows
os: windows-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Setup vcpkg (Windows)
run: gh run download -n vcpkg-cache -D C:/vcpkg/installed/
if: runner.os == 'Windows'
env:
GH_TOKEN: ${{ github.token }}
- name: Setup conda (macOS)
uses: conda-incubator/setup-miniconda@v3
if: runner.os == 'macOS'
- name: Install GMT dependencies
run: |
# $RUNNER_OS can be Linux, macOS or Windows
# The following command converts $RUNNER_OS to lowercase
os=$(echo "$RUNNER_OS" | tr '[:upper:]' '[:lower:]')
bash ci/install-dependencies-${os}.sh
- name: Download GSHHG and DCW data
run: gh run download -n coastline-cache -D coastline
env:
GH_TOKEN: ${{ github.token }}
- name: Pull baseline image data from dvc remote
run: dvc pull --no-run-cache
- name: Configure GMT
run: |
if [ "$RUNNER_OS" != "Windows" ]; then
bash ci/config-gmt-unix.sh
else
bash ci/config-gmt-windows.sh
fi
- name: Compile GMT (Linux/macOS)
run: |
mkdir build
cd build
cmake -G Ninja ..
cmake --build .
if: runner.os != 'Windows'
- name: Compile GMT (Windows)
shell: cmd
run: |
mkdir build
cd build
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cmake -G Ninja .. -DCMAKE_TOOLCHAIN_FILE=%VCPKG_INSTALLATION_ROOT%\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Release
cmake --build .
if: runner.os == 'Windows'
- name: Build documentation
run: |
set -x -e
cd build
cmake --build . --target docs_depends
if [ -x "$(command -v pngquant)" ]; then # optional step
cmake --build . --target optimize_images
fi
cmake --build . --target docs_html
# if html.log isn't empty (i.e., sphinx raise warnings), return 1
! [ -s doc/rst/html.log ]
cmake --build . --target docs_man
# Show warnings saved in html.log and man.log but filter out "duplicate label" warnings.
# See https://github.com/GenericMappingTools/gmt/issues/7253
grep -v 'WARNING: duplicate label -' doc/rst/html.log
- name: Install GMT
run: |
cd build
cmake --build . --target install
# Add GMT PATH to bin
echo "${INSTALLDIR}/bin" >> $GITHUB_PATH
- name: Checkout the gh-pages branch in a separate folder
uses: actions/[email protected]
with:
ref: gh-pages
# Checkout to this folder instead of the current one
path: deploy
# Download the entire history
fetch-depth: 0
if: github.event_name != 'pull_request' && matrix.os == 'ubuntu-latest'
- name: Deploy documentation to GitHub
run: bash ci/deploy-gh-pages.sh
if: github.event_name != 'pull_request' && matrix.os == 'ubuntu-latest'
- name: Package GMT
run: |
set -x -e
cd build
cmake --build . --target gmt_release
cmake --build . --target gmt_release_tar
if [ "$RUNNER_OS" = "macOS" ]; then
# Create macOS bundle
cpack -G Bundle
elif [ "$RUNNER_OS" = "Windows" ]; then
# Don't use cpack here. Chocolatey also provides a cpack command.
cmake --build . --target package
fi