From 3c9a8ee44b586f9a8a419e6840580f7c8ee0fad8 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 16 Jun 2026 15:40:21 +0800 Subject: [PATCH 1/9] CI: Set GMT_DATA_SERVER to the USTC mirror in CI workflows --- .github/workflows/benchmarks.yml | 2 ++ .github/workflows/cache_data.yaml | 2 ++ .github/workflows/ci_docs.yml | 7 +++++++ .github/workflows/ci_doctests.yaml | 2 ++ .github/workflows/ci_tests.yaml | 3 +++ .github/workflows/ci_tests_dev.yaml | 1 + .github/workflows/ci_tests_legacy.yaml | 2 ++ 7 files changed, 19 insertions(+) diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 0bd37628fa5..d1cb0e91a22 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -85,6 +85,8 @@ jobs: # Run the benchmark tests - name: Run benchmarks uses: CodSpeedHQ/action@9d332c4d90b43981c3e55ae8e38e68709996240f # v4.17.0 + env: + GMT_DATA_SERVER: https://mirrors.ustc.edu.cn/gmtdata/ with: mode: "instrumentation" # 'bash -el -c' is needed to use the custom shell. diff --git a/.github/workflows/cache_data.yaml b/.github/workflows/cache_data.yaml index 8f83f9f4559..f961c6ed17b 100644 --- a/.github/workflows/cache_data.yaml +++ b/.github/workflows/cache_data.yaml @@ -70,6 +70,8 @@ jobs: # Download remote files - name: Download remote data + env: + GMT_DATA_SERVER: https://mirrors.ustc.edu.cn/gmtdata/ run: | python -c "from pygmt.helpers.caching import cache_data; cache_data()" diff --git a/.github/workflows/ci_docs.yml b/.github/workflows/ci_docs.yml index c769ff76408..1a47cec54ee 100644 --- a/.github/workflows/ci_docs.yml +++ b/.github/workflows/ci_docs.yml @@ -68,6 +68,9 @@ jobs: run: shell: bash -l {0} + env: + GMT_DATA_SERVER: https://mirrors.ustc.edu.cn/gmtdata/ + steps: # Checkout current git repository - name: Checkout @@ -135,6 +138,8 @@ jobs: python -m pip install dist/* - name: Build the HTML documentation + env: + GMT_DATA_SERVER: https://mirrors.ustc.edu.cn/gmtdata/ run: | log_file="${RUNNER_TEMP}/sphinx-html.log" make -C doc clean html 2>&1 | tee "${log_file}" @@ -146,6 +151,8 @@ jobs: exit "${exit_code}" - name: Build the PDF documentation + env: + GMT_DATA_SERVER: https://mirrors.ustc.edu.cn/gmtdata/ run: | log_file="${RUNNER_TEMP}/sphinx-pdf.log" make -C doc pdf 2>&1 | tee "${log_file}" diff --git a/.github/workflows/ci_doctests.yaml b/.github/workflows/ci_doctests.yaml index c4a8d6cdbed..ccf375e616e 100644 --- a/.github/workflows/ci_doctests.yaml +++ b/.github/workflows/ci_doctests.yaml @@ -84,6 +84,8 @@ jobs: # Run the doctests - name: Run doctests + env: + GMT_DATA_SERVER: https://mirrors.ustc.edu.cn/gmtdata/ run: | log_file="${RUNNER_TEMP}/pytest.log" make doctest PYTEST_EXTRA="-r P" 2>&1 | tee "${log_file}" diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 9d838bfdc91..58bbce4e56c 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -100,6 +100,7 @@ jobs: # Environment variables used by codecov env: + GMT_DATA_SERVER: https://mirrors.ustc.edu.cn/gmtdata/ OS: ${{ matrix.os }} PYTHON: ${{ matrix.python-version }} NUMPY: ${{ matrix.numpy-version }} @@ -189,6 +190,8 @@ jobs: # Run the regular tests - name: Run tests + env: + GMT_DATA_SERVER: https://mirrors.ustc.edu.cn/gmtdata/ run: | log_file="${RUNNER_TEMP}/pytest.log" make test PYTEST_EXTRA="-r P --reruns 2" 2>&1 | tee "${log_file}" diff --git a/.github/workflows/ci_tests_dev.yaml b/.github/workflows/ci_tests_dev.yaml index f185b087a27..f3feb5372fc 100644 --- a/.github/workflows/ci_tests_dev.yaml +++ b/.github/workflows/ci_tests_dev.yaml @@ -184,6 +184,7 @@ jobs: - name: Test with pytest run: make test PYTEST_EXTRA="-r P --reruns 2" env: + GMT_DATA_SERVER: https://mirrors.ustc.edu.cn/gmtdata/ GMT_LIBRARY_PATH: ${{ runner.temp }}/gmt-install-dir/lib # Upload diff images on test failure diff --git a/.github/workflows/ci_tests_legacy.yaml b/.github/workflows/ci_tests_legacy.yaml index ea73fe1bef1..051583fb404 100644 --- a/.github/workflows/ci_tests_legacy.yaml +++ b/.github/workflows/ci_tests_legacy.yaml @@ -95,4 +95,6 @@ jobs: # Run the tests but skip images - name: Run tests + env: + GMT_DATA_SERVER: https://mirrors.ustc.edu.cn/gmtdata/ run: make test_no_images PYTEST_EXTRA="-r P" From bcc7c9ec6cffbc60caf3dcbad52a13b7163add85 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 16 Jun 2026 15:57:31 +0800 Subject: [PATCH 2/9] Revert "Add a workaround for internet issues that fails test_dataset_to_strings_with_none_values (#4394)" This reverts commit 4610d884f881892b57615c73e2970615814e31f9. --- pygmt/tests/test_datatypes_dataset.py | 32 ++++++++++----------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/pygmt/tests/test_datatypes_dataset.py b/pygmt/tests/test_datatypes_dataset.py index f170e22d7bf..1e6ab838d9c 100644 --- a/pygmt/tests/test_datatypes_dataset.py +++ b/pygmt/tests/test_datatypes_dataset.py @@ -156,25 +156,17 @@ def test_dataset_to_strings_with_none_values(): See the bug report at https://github.com/GenericMappingTools/pygmt/issues/3170. """ - # Sometimes, the test may fail in CI due to intermittent internet connection issue. - # Catch the FileNotFoundError exception so that we can focus on the bug. tiles = ["@N30E060.earth_age_01m_g.nc", "@N30E090.earth_age_01m_g.nc"] - try: - paths = which(fname=tiles, download="auto") - assert len(paths) == 2 - # 'paths' may contain an empty string or not, depending on if tiles are cached. - if "" not in paths: # Contains two valid paths. - # Delete the cached tiles and try again. - for path in paths: - Path(path).unlink() - with pytest.warns(expected_warning=RuntimeWarning) as record: # noqa: PT031 - try: - paths = which(fname=tiles, download="auto") - assert len(record) == 1 - assert len(paths) == 2 - assert "" in paths - except FileNotFoundError: - pass - except FileNotFoundError: - pass + paths = which(fname=tiles, download="auto") + assert len(paths) == 2 + # 'paths' may contain an empty string or not, depending on if the tiles are cached. + if "" not in paths: # Contains two valid paths. + # Delete the cached tiles and try again. + for path in paths: + Path(path).unlink() + with pytest.warns(expected_warning=RuntimeWarning) as record: + paths = which(fname=tiles, download="auto") + assert len(record) == 1 + assert len(paths) == 2 + assert "" in paths From 94197a1eaca12563247ff23d080ed04de0fb078b Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 16 Jun 2026 16:01:17 +0800 Subject: [PATCH 3/9] Temporarily disable cache in the Tests workflow --- .github/workflows/ci_tests.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 58bbce4e56c..2cbcdb1fa9a 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -144,15 +144,15 @@ jobs: pytest-rerunfailures # Download cached remote files (artifacts) from GitHub - - name: Download remote data from GitHub - run: | - # Download files to ~/.gmt directory and list them - gh run download --name gmt-cache --dir ~/.gmt/ - # Change modification times of the two files, so GMT won't refresh it - touch ~/.gmt/gmt_data_server.txt ~/.gmt/gmt_hash_server.txt - ls -lhR ~/.gmt - env: - GH_TOKEN: ${{ github.token }} + #- name: Download remote data from GitHub + # run: | + # # Download files to ~/.gmt directory and list them + # gh run download --name gmt-cache --dir ~/.gmt/ + # # Change modification times of the two files, so GMT won't refresh it + # touch ~/.gmt/gmt_data_server.txt ~/.gmt/gmt_hash_server.txt + # ls -lhR ~/.gmt + # env: + # GH_TOKEN: ${{ github.token }} - name: Install uv uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 From fd49c18ef397d736c162142ae1eaa129860c1cfb Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 16 Jun 2026 16:35:25 +0800 Subject: [PATCH 4/9] Remove the workaround for downloading remote data --- pygmt/tests/test_which.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pygmt/tests/test_which.py b/pygmt/tests/test_which.py index 40f6eb31ccc..fd07b32b94b 100644 --- a/pygmt/tests/test_which.py +++ b/pygmt/tests/test_which.py @@ -68,10 +68,7 @@ def test_which_nonascii_path(monkeypatch): # Start a new session begin() # GMT should download the remote file under the new home directory. - try: - fname = which(fname="@static_earth_relief.nc", download="cache") - except FileNotFoundError: - pytest.skip("Failed to download the file, skipping the test.") + fname = which(fname="@static_earth_relief.nc", download="cache") assert fname.startswith(fakehome) assert fname.endswith("static_earth_relief.nc") end() From 37a445d614a972a967a2b2289738d846ecd11284 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 16 Jun 2026 16:57:10 +0800 Subject: [PATCH 5/9] Revert "Temporarily disable cache in the Tests workflow" This reverts commit 94197a1eaca12563247ff23d080ed04de0fb078b. --- .github/workflows/ci_tests.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 2cbcdb1fa9a..58bbce4e56c 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -144,15 +144,15 @@ jobs: pytest-rerunfailures # Download cached remote files (artifacts) from GitHub - #- name: Download remote data from GitHub - # run: | - # # Download files to ~/.gmt directory and list them - # gh run download --name gmt-cache --dir ~/.gmt/ - # # Change modification times of the two files, so GMT won't refresh it - # touch ~/.gmt/gmt_data_server.txt ~/.gmt/gmt_hash_server.txt - # ls -lhR ~/.gmt - # env: - # GH_TOKEN: ${{ github.token }} + - name: Download remote data from GitHub + run: | + # Download files to ~/.gmt directory and list them + gh run download --name gmt-cache --dir ~/.gmt/ + # Change modification times of the two files, so GMT won't refresh it + touch ~/.gmt/gmt_data_server.txt ~/.gmt/gmt_hash_server.txt + ls -lhR ~/.gmt + env: + GH_TOKEN: ${{ github.token }} - name: Install uv uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 From f411a509a4a6f8bdd98c46637041d48f9b2d2ed5 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 16 Jun 2026 16:59:57 +0800 Subject: [PATCH 6/9] Remove the workflow-level env setting --- .github/workflows/ci_docs.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci_docs.yml b/.github/workflows/ci_docs.yml index 1a47cec54ee..e84872f3fa3 100644 --- a/.github/workflows/ci_docs.yml +++ b/.github/workflows/ci_docs.yml @@ -68,9 +68,6 @@ jobs: run: shell: bash -l {0} - env: - GMT_DATA_SERVER: https://mirrors.ustc.edu.cn/gmtdata/ - steps: # Checkout current git repository - name: Checkout From deecf7728307f7b7a6a5fbb686cf5645fa58d178 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 16 Jun 2026 17:00:45 +0800 Subject: [PATCH 7/9] Remove the workflow-level env setting --- .github/workflows/ci_tests.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 58bbce4e56c..39f043afe00 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -100,7 +100,6 @@ jobs: # Environment variables used by codecov env: - GMT_DATA_SERVER: https://mirrors.ustc.edu.cn/gmtdata/ OS: ${{ matrix.os }} PYTHON: ${{ matrix.python-version }} NUMPY: ${{ matrix.numpy-version }} From f09b45023e154f74b9b26a63978cd9cbc15923f2 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 16 Jun 2026 17:38:16 +0800 Subject: [PATCH 8/9] Use image from github not GMT data server --- examples/tutorials/advanced/draping_on_3d_surface.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/tutorials/advanced/draping_on_3d_surface.py b/examples/tutorials/advanced/draping_on_3d_surface.py index 4479df5a06d..db5228f94ca 100644 --- a/examples/tutorials/advanced/draping_on_3d_surface.py +++ b/examples/tutorials/advanced/draping_on_3d_surface.py @@ -99,7 +99,9 @@ # The original image is available on Wikimedia Commons at # https://commons.wikimedia.org/wiki/File:Flag_of_Europe.svg # but we use a cached version on the GMT data server. -url_to_image = "https://oceania.generic-mapping-tools.org/cache/euflag.png" +url_to_image = ( + "https://github.com/GenericMappingTools/gmtserver-admin/raw/master/cache/euflag.png" +) with rasterio.open(url_to_image) as dataset: data = dataset.read() drape_grid = xr.DataArray(data, dims=("band", "y", "x")) From 29c6eb7b24fcfd240c1a148786c7a0df2ce091b4 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 16 Jun 2026 17:58:35 +0800 Subject: [PATCH 9/9] Set GMT_DATA_SERVER to OpenTopography mirror in CI workflows --- .github/workflows/benchmarks.yml | 2 +- .github/workflows/cache_data.yaml | 2 +- .github/workflows/ci_docs.yml | 4 ++-- .github/workflows/ci_doctests.yaml | 2 +- .github/workflows/ci_tests.yaml | 2 +- .github/workflows/ci_tests_dev.yaml | 2 +- .github/workflows/ci_tests_legacy.yaml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index d1cb0e91a22..3f7049a1a5b 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -86,7 +86,7 @@ jobs: - name: Run benchmarks uses: CodSpeedHQ/action@9d332c4d90b43981c3e55ae8e38e68709996240f # v4.17.0 env: - GMT_DATA_SERVER: https://mirrors.ustc.edu.cn/gmtdata/ + GMT_DATA_SERVER: https://opentopography.s3.sdsc.edu/gmtdata with: mode: "instrumentation" # 'bash -el -c' is needed to use the custom shell. diff --git a/.github/workflows/cache_data.yaml b/.github/workflows/cache_data.yaml index f961c6ed17b..a0c14d874bb 100644 --- a/.github/workflows/cache_data.yaml +++ b/.github/workflows/cache_data.yaml @@ -71,7 +71,7 @@ jobs: # Download remote files - name: Download remote data env: - GMT_DATA_SERVER: https://mirrors.ustc.edu.cn/gmtdata/ + GMT_DATA_SERVER: https://opentopography.s3.sdsc.edu/gmtdata run: | python -c "from pygmt.helpers.caching import cache_data; cache_data()" diff --git a/.github/workflows/ci_docs.yml b/.github/workflows/ci_docs.yml index e84872f3fa3..62cf388cb7d 100644 --- a/.github/workflows/ci_docs.yml +++ b/.github/workflows/ci_docs.yml @@ -136,7 +136,7 @@ jobs: - name: Build the HTML documentation env: - GMT_DATA_SERVER: https://mirrors.ustc.edu.cn/gmtdata/ + GMT_DATA_SERVER: https://opentopography.s3.sdsc.edu/gmtdata run: | log_file="${RUNNER_TEMP}/sphinx-html.log" make -C doc clean html 2>&1 | tee "${log_file}" @@ -149,7 +149,7 @@ jobs: - name: Build the PDF documentation env: - GMT_DATA_SERVER: https://mirrors.ustc.edu.cn/gmtdata/ + GMT_DATA_SERVER: https://opentopography.s3.sdsc.edu/gmtdata run: | log_file="${RUNNER_TEMP}/sphinx-pdf.log" make -C doc pdf 2>&1 | tee "${log_file}" diff --git a/.github/workflows/ci_doctests.yaml b/.github/workflows/ci_doctests.yaml index ccf375e616e..bda06d0491d 100644 --- a/.github/workflows/ci_doctests.yaml +++ b/.github/workflows/ci_doctests.yaml @@ -85,7 +85,7 @@ jobs: # Run the doctests - name: Run doctests env: - GMT_DATA_SERVER: https://mirrors.ustc.edu.cn/gmtdata/ + GMT_DATA_SERVER: https://opentopography.s3.sdsc.edu/gmtdata run: | log_file="${RUNNER_TEMP}/pytest.log" make doctest PYTEST_EXTRA="-r P" 2>&1 | tee "${log_file}" diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 39f043afe00..117b1229837 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -190,7 +190,7 @@ jobs: # Run the regular tests - name: Run tests env: - GMT_DATA_SERVER: https://mirrors.ustc.edu.cn/gmtdata/ + GMT_DATA_SERVER: https://opentopography.s3.sdsc.edu/gmtdata run: | log_file="${RUNNER_TEMP}/pytest.log" make test PYTEST_EXTRA="-r P --reruns 2" 2>&1 | tee "${log_file}" diff --git a/.github/workflows/ci_tests_dev.yaml b/.github/workflows/ci_tests_dev.yaml index f3feb5372fc..01745d921f5 100644 --- a/.github/workflows/ci_tests_dev.yaml +++ b/.github/workflows/ci_tests_dev.yaml @@ -184,7 +184,7 @@ jobs: - name: Test with pytest run: make test PYTEST_EXTRA="-r P --reruns 2" env: - GMT_DATA_SERVER: https://mirrors.ustc.edu.cn/gmtdata/ + GMT_DATA_SERVER: https://opentopography.s3.sdsc.edu/gmtdata GMT_LIBRARY_PATH: ${{ runner.temp }}/gmt-install-dir/lib # Upload diff images on test failure diff --git a/.github/workflows/ci_tests_legacy.yaml b/.github/workflows/ci_tests_legacy.yaml index 051583fb404..dabad490531 100644 --- a/.github/workflows/ci_tests_legacy.yaml +++ b/.github/workflows/ci_tests_legacy.yaml @@ -96,5 +96,5 @@ jobs: # Run the tests but skip images - name: Run tests env: - GMT_DATA_SERVER: https://mirrors.ustc.edu.cn/gmtdata/ + GMT_DATA_SERVER: https://opentopography.s3.sdsc.edu/gmtdata run: make test_no_images PYTEST_EXTRA="-r P"