33# This workflow runs regular PyGMT tests with the GMT dev version, and also
44# pre-release versions of several dependencies like NumPy, Pandas, Xarray, etc.
55# If any tests fail, it also uploads the diff images as workflow artifacts.
6- # On Linux/macOS, GMT dev version is installed by fetching the latest source
7- # codes from the GMT master branch and compiling.
8- # On Windows, GMT dev version is installed from the conda-forge's dev channel
9- # due to the complexity of building GMT source codes on Windows.
6+ # The GMT dev version is installed by fetching the latest source codes from
7+ # the GMT master branch and compiling.
108#
119# It is triggered when a pull request is marked as "ready as review", or using
1210# the slash command `/test-gmt-dev`. It is also scheduled to run on Monday,
8078 fetch-depth : 0
8179
8280 - name : Show job URL
83- uses : peter-evans/create-or-update-comment@v3.0.2
81+ uses : peter-evans/create-or-update-comment@v3.1.0
8482 if : github.event_name == 'repository_dispatch' && (matrix.os == 'ubuntu-latest')
8583 with :
8684 token : ${{ steps.generate-token.outputs.token }}
@@ -116,6 +114,38 @@ jobs:
116114 pcre
117115 zlib
118116
117+ # Build and install latest GMT from GitHub
118+ - name : Install GMT ${{ matrix.gmt_git_ref }} branch (Linux/macOS)
119+ run : curl https://raw.githubusercontent.com/GenericMappingTools/gmt/master/ci/build-gmt.sh | bash
120+ env :
121+ GMT_GIT_REF : ${{ matrix.gmt_git_ref }}
122+ GMT_INSTALL_DIR : ${{ github.workspace }}/gmt-install-dir
123+ if : runner.os != 'Windows'
124+
125+ - name : Install GMT ${{ matrix.gmt_git_ref }} branch (Windows)
126+ shell : cmd
127+ run : |
128+ git clone --depth=1 --single-branch --branch ${{ env.GMT_GIT_REF }} https://github.com/GenericMappingTools/gmt
129+ cd gmt/
130+ mkdir build
131+ cd build
132+ call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
133+ cmake -G Ninja .. ^
134+ -DCMAKE_INSTALL_PREFIX=${{ env.GMT_INSTALL_DIR }} ^
135+ -DCMAKE_BUILD_TYPE=Release ^
136+ -DCMAKE_PREFIX_PATH=${{ env.MAMBA_ROOT_PREFIX }}\envs\pygmt\Library ^
137+ -DGMT_ENABLE_OPENMP=TRUE ^
138+ -DGMT_USE_THREADS=TRUE
139+ cmake --build .
140+ cmake --build . --target install
141+ env :
142+ GMT_GIT_REF : ${{ matrix.gmt_git_ref }}
143+ GMT_INSTALL_DIR : ${{ github.workspace }}/gmt-install-dir
144+ if : runner.os == 'Windows'
145+
146+ - name : Add GMT's bin to PATH
147+ run : echo '${{ github.workspace }}/gmt-install-dir/bin' >> $GITHUB_PATH
148+
119149 # Install dependencies from PyPI
120150 - name : Install dependencies
121151 run : |
@@ -136,18 +166,6 @@ jobs:
136166 dvc pull
137167 ls -lhR pygmt/tests/baseline/
138168
139- # Build and install latest GMT from GitHub
140- - name : Install GMT ${{ matrix.gmt_git_ref }} branch (Linux/macOS)
141- run : curl https://raw.githubusercontent.com/GenericMappingTools/gmt/master/ci/build-gmt.sh | bash
142- env :
143- GMT_GIT_REF : ${{ matrix.gmt_git_ref }}
144- GMT_INSTALL_DIR : ${{ github.workspace }}/gmt-install-dir
145- if : runner.os != 'Windows'
146-
147- - name : Install GMT dev version from conda-forge (Windows)
148- run : micromamba install -c conda-forge/label/dev gmt
149- if : runner.os == 'Windows'
150-
151169 # Download cached remote files (artifacts) from GitHub
152170 - name : Download remote data from GitHub
153171 uses : dawidd6/action-download-artifact@v2.28.0
@@ -170,21 +188,11 @@ jobs:
170188 - name : Install the package
171189 run : make install
172190
173- - name : Add GMT's bin to PATH (Linux/macOS)
174- run : echo ${GITHUB_WORKSPACE}/gmt-install-dir/bin >> $GITHUB_PATH
175- if : runner.os != 'Windows'
176-
177191 # Run the tests
178- - name : Test with pytest (Linux/macOS)
192+ - name : Test with pytest
179193 run : make test PYTEST_EXTRA="-r P"
180194 env :
181195 GMT_LIBRARY_PATH : ${{ github.workspace }}/gmt-install-dir/lib
182- if : runner.os != 'Windows'
183-
184- # Run the tests
185- - name : Test with pytest (Windows)
186- run : make test PYTEST_EXTRA="-r P"
187- if : runner.os == 'Windows'
188196
189197 # Upload diff images on test failure
190198 - name : Upload diff images if any test fails
0 commit comments