Skip to content

Commit fba6e83

Browse files
seismanweiji14
andauthored
CI: Combine the steps for building GMT source code in the 'GMT Dev Tests' workflow (#4353)
Co-authored-by: Wei Ji <[email protected]>
1 parent 8623382 commit fba6e83

File tree

1 file changed

+9
-23
lines changed

1 file changed

+9
-23
lines changed

.github/workflows/ci_tests_dev.yaml

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -103,44 +103,30 @@ jobs:
103103

104104
# Build GMT from source on Linux/macOS, script is adapted from
105105
# https://github.com/GenericMappingTools/gmt/blob/6.5.0/ci/build-gmt.sh
106-
- name: Build GMT on Linux/macOS
107-
run: |
108-
cd gmt/
109-
mkdir build
110-
cd build
111-
cmake -G Ninja .. \
112-
-DCMAKE_INSTALL_PREFIX=${GMT_INSTALL_DIR} \
113-
-DCMAKE_BUILD_TYPE=Release \
114-
-DGMT_ENABLE_OPENMP=TRUE \
115-
-DGMT_USE_THREADS=TRUE
116-
cmake --build .
117-
cmake --build . --target install
118-
cd ..
119-
rm -rf gmt/
120-
env:
121-
GMT_INSTALL_DIR: ${{ runner.temp }}/gmt-install-dir
122-
if: runner.os != 'Windows'
123-
124-
- name: Build GMT on Windows
106+
- name: Build GMT from source
125107
shell: bash
126108
run: |
127109
cd gmt/
128110
mkdir build
129111
cd build
130-
cmd.exe /c "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
112+
if [[ "$RUNNER_OS" == "Windows" ]]; then
113+
cmd.exe /c "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
114+
CMAKE_PREFIX_PATH="$MAMBA_ROOT_PREFIX/envs/pygmt/Library"
115+
else
116+
CMAKE_PREFIX_PATH="$MAMBA_ROOT_PREFIX/envs/pygmt"
117+
fi
131118
cmake -G Ninja .. \
119+
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
132120
-DCMAKE_INSTALL_PREFIX="$GMT_INSTALL_DIR" \
133121
-DCMAKE_BUILD_TYPE=Release \
134-
-DCMAKE_PREFIX_PATH="$MAMBA_ROOT_PREFIX/envs/pygmt/Library" \
135122
-DGMT_ENABLE_OPENMP=TRUE \
136123
-DGMT_USE_THREADS=TRUE
137124
cmake --build .
138125
cmake --build . --target install
139126
cd ..
140-
rm -rf gmt/
127+
rm -rf build
141128
env:
142129
GMT_INSTALL_DIR: ${{ runner.temp }}/gmt-install-dir
143-
if: runner.os == 'Windows'
144130

145131
- name: Add GMT's bin to PATH
146132
run: echo '${{ runner.temp }}/gmt-install-dir/bin' >> $GITHUB_PATH

0 commit comments

Comments
 (0)