diff --git a/.github/workflows/ci_tests_dev.yaml b/.github/workflows/ci_tests_dev.yaml index e7c39c43e7f..ef95f2c9f05 100644 --- a/.github/workflows/ci_tests_dev.yaml +++ b/.github/workflows/ci_tests_dev.yaml @@ -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 @@ -87,18 +86,42 @@ 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 GMT repository + - name: Checkout the GMT source from ${{ matrix.gmt_git_ref }} branch + uses: actions/checkout@v4.1.4 + with: + repository: 'GenericMappingTools/gmt' + ref: ${{ matrix.gmt_git_ref }} + path: 'gmt' + + # Build GMT from source on Linux/macOS, script is adapted from + # https://github.com/GenericMappingTools/gmt/blob/6.5.0/ci/build-gmt.sh + - name: Build GMT on Linux/macOS + run: | + if [ "$RUNNER_OS" == "macOS" ]; then + GMT_ENABLE_OPENMP=FALSE + else + GMT_ENABLE_OPENMP=TRUE + fi + cd gmt/ + mkdir build + cd build + cmake -G Ninja .. \ + -DCMAKE_INSTALL_PREFIX=${{ env.GMT_INSTALL_DIR }} \ + -DCMAKE_BUILD_TYPE=Release \ + -DGMT_ENABLE_OPENMP=${GMT_ENABLE_OPENMP} \ + -DGMT_USE_THREADS=TRUE + 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' - - name: Install GMT ${{ matrix.gmt_git_ref }} branch (Windows) + - name: Build GMT on 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 @@ -114,7 +137,6 @@ jobs: cd .. rm -rf gmt/ env: - GMT_GIT_REF: ${{ matrix.gmt_git_ref }} GMT_INSTALL_DIR: ${{ runner.temp }}/gmt-install-dir if: runner.os == 'Windows' diff --git a/doc/api/index.rst b/doc/api/index.rst index 646fb49886a..5cf28bb3ebb 100644 --- a/doc/api/index.rst +++ b/doc/api/index.rst @@ -203,7 +203,6 @@ Miscellaneous :toctree: generated which - print_clib_info show_versions .. currentmodule:: pygmt diff --git a/pygmt/__init__.py b/pygmt/__init__.py index 3eac6ee579d..efc0ea9baa5 100644 --- a/pygmt/__init__.py +++ b/pygmt/__init__.py @@ -77,21 +77,6 @@ _atexit.register(_end) -def print_clib_info(file=sys.stdout): - """ - Print information about the GMT shared library that we can find. - - Includes the GMT version, default values for parameters, the path to the - ``libgmt`` shared library, and GMT directories. - """ - from pygmt.clib import Session - - print("GMT library information:", file=file) - with Session() as ses: - lines = [f" {key}: {ses.info[key]}" for key in sorted(ses.info)] - print("\n".join(lines), file=file) - - def show_versions(file=sys.stdout): """ Print various dependency versions which are useful when submitting bug reports.