Skip to content

Commit e17a1bf

Browse files
authored
CI: Build GMT dev source code with OpenMP enabled on Linux and GThreads enabled on Linux/macOS (#3011)
1 parent eaca67d commit e17a1bf

File tree

1 file changed

+32
-10
lines changed

1 file changed

+32
-10
lines changed

.github/workflows/ci_tests_dev.yaml

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
# installed by fetching the latest source codes from the GMT master branch and
77
# compiling.
88
#
9-
# It is triggered when a pull request is marked as "ready as review", or labeled with
10-
# 'run/test-gmt-dev'. It is also scheduled to run on Monday, Wednesday, and Friday on
11-
# the main branch.
9+
# It is triggered in a pull request if labeled with 'run/test-gmt-dev'.
10+
# It is also scheduled to run on Monday, Wednesday, and Friday on the main branch.
1211
#
1312
name: GMT Dev Tests
1413

@@ -87,18 +86,42 @@ jobs:
8786
pcre
8887
zlib
8988
90-
# Build and install latest GMT from GitHub
91-
- name: Install GMT ${{ matrix.gmt_git_ref }} branch (Linux/macOS)
92-
run: curl https://raw.githubusercontent.com/GenericMappingTools/gmt/master/ci/build-gmt.sh | bash
89+
# Checkout current GMT repository
90+
- name: Checkout the GMT source from ${{ matrix.gmt_git_ref }} branch
91+
uses: actions/[email protected]
92+
with:
93+
repository: 'GenericMappingTools/gmt'
94+
ref: ${{ matrix.gmt_git_ref }}
95+
path: 'gmt'
96+
97+
# Build GMT from source on Linux/macOS, script is adapted from
98+
# https://github.com/GenericMappingTools/gmt/blob/6.5.0/ci/build-gmt.sh
99+
- name: Build GMT on Linux/macOS
100+
run: |
101+
if [ "$RUNNER_OS" == "macOS" ]; then
102+
GMT_ENABLE_OPENMP=FALSE
103+
else
104+
GMT_ENABLE_OPENMP=TRUE
105+
fi
106+
cd gmt/
107+
mkdir build
108+
cd build
109+
cmake -G Ninja .. \
110+
-DCMAKE_INSTALL_PREFIX=${{ env.GMT_INSTALL_DIR }} \
111+
-DCMAKE_BUILD_TYPE=Release \
112+
-DGMT_ENABLE_OPENMP=${GMT_ENABLE_OPENMP} \
113+
-DGMT_USE_THREADS=TRUE
114+
cmake --build .
115+
cmake --build . --target install
116+
cd ..
117+
rm -rf gmt/
93118
env:
94-
GMT_GIT_REF: ${{ matrix.gmt_git_ref }}
95119
GMT_INSTALL_DIR: ${{ runner.temp }}/gmt-install-dir
96120
if: runner.os != 'Windows'
97121

98-
- name: Install GMT ${{ matrix.gmt_git_ref }} branch (Windows)
122+
- name: Build GMT on Windows
99123
shell: cmd
100124
run: |
101-
git clone --depth=1 --single-branch --branch ${{ env.GMT_GIT_REF }} https://github.com/GenericMappingTools/gmt
102125
cd gmt/
103126
mkdir build
104127
cd build
@@ -114,7 +137,6 @@ jobs:
114137
cd ..
115138
rm -rf gmt/
116139
env:
117-
GMT_GIT_REF: ${{ matrix.gmt_git_ref }}
118140
GMT_INSTALL_DIR: ${{ runner.temp }}/gmt-install-dir
119141
if: runner.os == 'Windows'
120142

0 commit comments

Comments
 (0)