Skip to content

Commit

Permalink
CI: Building GMT dev
Browse files Browse the repository at this point in the history
  • Loading branch information
seisman committed Apr 16, 2024
1 parent 35ed27a commit 02aa118
Showing 1 changed file with 45 additions and 18 deletions.
63 changes: 45 additions & 18 deletions .github/workflows/ci_tests_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
# installed by fetching the latest source codes from the GMT master branch and
# compiling.
#
# It is triggered when a pull request is marked as "ready as review", or labeled with
# 'run/test-gmt-dev'. It is also scheduled to run on Monday, Wednesday, and Friday on
# the main branch.
# It is triggered in a pull request if labeled with 'run/test-gmt-dev'.
# It is also scheduled to run on Monday, Wednesday, and Friday on the main branch.
#
name: GMT Dev Tests

Expand Down Expand Up @@ -81,34 +80,62 @@ jobs:
pcre
zlib
# Build and install latest GMT from GitHub
- name: Install GMT ${{ matrix.gmt_git_ref }} branch (Linux/macOS)
run: curl https://raw.githubusercontent.com/GenericMappingTools/gmt/master/ci/build-gmt.sh | bash
# Checkout current the GMT source codes
- name: Checkout the GMT source codes
uses: actions/[email protected]
with:
repository: 'GenericMappingTools/gmt'
ref: ${{ matrix.gmt_git_ref }}
path: 'gmt'

- name: Make the ConfigUser.cmake file
run: |
cd gmt/
if [ "${RUNNER_OS}" == "macOS"]; then # Can't make macOS support OpenMP now
ENABLE_OPENMP=TRUE
ENABLE_THREAD=TRUE
else
ENABLE_OPENMP=FALSE
ENABLE_THREADS=FALSE
fi
cat >> cmake/ConfigUser.cmake << EOF
set (CMAKE_INSTALL_PREFIX ${{ env.GMT_INSTALL_DIR }})
set (CMAKE_BUILD_TYPE Release)
set (GMT_ENABLE_OPENMP ${ENABLE_OPENMP})
set (GMT_USE_THREADS ${ENABLE_THREADS})
EOF
if [ "${RUNNER_OS}" == "Windows" ]; then
echo "set (CMAKE_PREFIX_PATH ${{ env.MAMBA_ROOT_PREFIX }}\envs\pygmt\Library)" >> cmake/ConfigUser.cmake
fi
cat cmake/ConfigUser.cmake
- name: Compile and install GMT ${{ matrix.gmt_git_ref }} branch (Linux)
run: |
cd gmt/
mkdir build
cd build
cmake -G Ninja ..
cmake --build .
cmake --build . --target install
cd ..
rm -rf gmt/
env:
GMT_GIT_REF: ${{ matrix.gmt_git_ref }}
GMT_INSTALL_DIR: ${{ runner.temp }}/gmt-install-dir
if: runner.os != 'Windows'
if: runner.os != 'Linux'

- name: Install GMT ${{ matrix.gmt_git_ref }} branch (Windows)
- name: Compile and install GMT ${{ matrix.gmt_git_ref }} branch (Windows)
shell: cmd
run: |
git clone --depth=1 --single-branch --branch ${{ env.GMT_GIT_REF }} https://github.com/GenericMappingTools/gmt
cd gmt/
mkdir build
cd build
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cmake -G Ninja .. ^
-DCMAKE_INSTALL_PREFIX=${{ env.GMT_INSTALL_DIR }} ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_PREFIX_PATH=${{ env.MAMBA_ROOT_PREFIX }}\envs\pygmt\Library ^
-DGMT_ENABLE_OPENMP=TRUE ^
-DGMT_USE_THREADS=TRUE
cmake -G Ninja ..
cmake --build .
cmake --build . --target install
cd ..
rm -rf gmt/
env:
GMT_GIT_REF: ${{ matrix.gmt_git_ref }}
GMT_INSTALL_DIR: ${{ runner.temp }}/gmt-install-dir
if: runner.os == 'Windows'

Expand All @@ -122,7 +149,7 @@ jobs:
--extra-index https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \
numpy pandas xarray netCDF4 packaging \
build contextily dvc geopandas ipython pyarrow rioxarray \
'pytest>=6.0' pytest-cov pytest-doctestplus pytest-mpl \
pytest pytest-cov pytest-doctestplus pytest-mpl \
sphinx-gallery
# Show installed pkg information for postmortem diagnostic
Expand Down

0 comments on commit 02aa118

Please sign in to comment.