Skip to content

Commit a744915

Browse files
authored
Add Vercel for Continuous Documentation (#4872)
Changes in this PR: - Add a script `ci/vercel-docs.sh` to build docs for Vercel - Add Vercel configuration file `package.json` - Update `CMakeLists.txt` to exclude `pacakge.json` and `vercel.json` in release tarballs
1 parent e26c4fe commit a744915

File tree

3 files changed

+52
-1
lines changed

3 files changed

+52
-1
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,9 @@ if (GIT_FOUND AND HAVE_GIT_VERSION)
112112
COMMAND ${CMAKE_COMMAND} -E remove_directory ${GMT_RELEASE_PREFIX}/admin
113113
COMMAND ${CMAKE_COMMAND} -E remove_directory ${GMT_RELEASE_PREFIX}/ci
114114
COMMAND ${CMAKE_COMMAND} -E remove_directory ${GMT_RELEASE_PREFIX}/test
115-
COMMAND ${CMAKE_COMMAND} -E remove ${GMT_RELEASE_PREFIX}/.azure-pipelines.yml
116115
COMMAND ${CMAKE_COMMAND} -E remove ${GMT_RELEASE_PREFIX}/.gitignore
116+
COMMAND ${CMAKE_COMMAND} -E remove ${GMT_RELEASE_PREFIX}/package.json
117+
COMMAND ${CMAKE_COMMAND} -E remove ${GMT_RELEASE_PREFIX}/vercel.json
117118
)
118119
add_depend_to_target (gmt_release git_export_release)
119120
find_program (GNUTAR NAMES gnutar gtar tar)

ci/vercel-docs.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Build the GMT documentation for Vercel.
4+
#
5+
6+
set -x -e
7+
8+
# Install GMT dependencies
9+
# Vercel uses Amazon Linux 2
10+
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
11+
yum install cmake3 ninja-build libcurl-devel netcdf-devel
12+
pip install sphinx
13+
14+
# Install latest gs
15+
curl -SLO https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs9533/ghostscript-9.53.3-linux-x86_64.tgz
16+
tar -xvf ghostscript-9.53.3-linux-x86_64.tgz ghostscript-9.53.3-linux-x86_64/gs-9533-linux-x86_64
17+
mv ghostscript-9.53.3-linux-x86_64/gs-9533-linux-x86_64 /usr/bin/gs
18+
gs --version
19+
20+
# Following variables can be modified via environment variables
21+
GMT_INSTALL_DIR=${HOME}/gmt-install-dir
22+
23+
# Configure GMT
24+
cat > cmake/ConfigUser.cmake << EOF
25+
set (CMAKE_INSTALL_PREFIX "${GMT_INSTALL_DIR}")
26+
set (CMAKE_C_FLAGS "-Wall -Wdeclaration-after-statement \${CMAKE_C_FLAGS}")
27+
set (CMAKE_C_FLAGS "-Wextra \${CMAKE_C_FLAGS}")
28+
EOF
29+
30+
# Build and install GMT
31+
mkdir build
32+
cd build
33+
cmake3 .. -G Ninja
34+
cmake3 --build .
35+
cmake3 --build . --target docs_depends
36+
#cmake3 --build . --target optimize_images
37+
cmake3 --build . --target docs_html
38+
# cmake3 --build . --target docs_man
39+
# cmake3 --build . --target install
40+
cd ..
41+
42+
mv build/doc/rst/html/ public/
43+
44+
set -x -e

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"scripts": {
3+
"build:docs": "curl https://raw.githubusercontent.com/GenericMappingTools/gmt/vercel-deployment/ci/vercel-docs.sh | bash",
4+
"build": "npm run build:docs"
5+
}
6+
}

0 commit comments

Comments
 (0)