From 618e131cd8aee108b9ba125d2b04cbc31368f0c0 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 25 Aug 2026 11:28:55 +0800 Subject: [PATCH 1/4] POC: Deduplicate the GMT cache download step into a composite action Six workflows (benchmarks, ci_docs, ci_doctests, ci_tests, ci_tests_dev and ci_tests_legacy) each carried their own copy of the step that downloads the 'gmt-cache' artifact into ~/.gmt. All six were functionally identical; the only differences were comment drift. Replace them with a local composite action at .github/actions/download-gmt-cache, which removes 48 lines and adds 6. Note that composite actions do not inherit the job's 'defaults.run.shell', so the action sets 'shell: bash -l {0}' explicitly to match the workflows. Co-Authored-By: Claude Opus 5 --- .github/actions/download-gmt-cache/action.yml | 27 +++++++++++++++++++ .github/workflows/benchmarks.yml | 9 +------ .github/workflows/ci_docs.yml | 9 +------ .github/workflows/ci_doctests.yaml | 9 +------ .github/workflows/ci_tests.yaml | 9 +------ .github/workflows/ci_tests_dev.yaml | 9 +------ .github/workflows/ci_tests_legacy.yaml | 9 +------ 7 files changed, 33 insertions(+), 48 deletions(-) create mode 100644 .github/actions/download-gmt-cache/action.yml diff --git a/.github/actions/download-gmt-cache/action.yml b/.github/actions/download-gmt-cache/action.yml new file mode 100644 index 00000000000..03b146baa3e --- /dev/null +++ b/.github/actions/download-gmt-cache/action.yml @@ -0,0 +1,27 @@ +# Download the cached GMT remote data files +# +# GMT downloads remote data files (e.g. Earth relief grids) on demand. To avoid +# hitting the data servers in every job, the files are cached once by the +# 'cache_data.yaml' workflow and uploaded as the 'gmt-cache' artifact. This action +# downloads that artifact into the ~/.gmt directory. +# +# The job must check out the repository before using this action, and needs the +# 'actions: read' permission to download artifacts from other workflow runs. +name: Download GMT cache +description: Download the cached GMT remote data files into the ~/.gmt directory. + +runs: + using: composite + steps: + - name: Download remote data from GitHub + # The job default shell is not inherited by composite actions, so it's set here to + # match the login shell used by the workflows. + shell: bash -l {0} + run: | + # Download cached 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 }} diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index b8d4ad541f8..f87badc1cb8 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -69,14 +69,7 @@ jobs: # Download cached remote files (artifacts) from GitHub - name: Download remote data from GitHub - run: | - # Download cached 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 }} + uses: ./.github/actions/download-gmt-cache # Install the package that we want to test - name: Install the package diff --git a/.github/workflows/ci_docs.yml b/.github/workflows/ci_docs.yml index 2200d7c35b0..719e8ec5ac7 100644 --- a/.github/workflows/ci_docs.yml +++ b/.github/workflows/ci_docs.yml @@ -123,14 +123,7 @@ jobs: # Download cached remote files (artifacts) from GitHub - name: Download remote data from GitHub - run: | - # Download cached 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 }} + uses: ./.github/actions/download-gmt-cache # Install the package that we want to test - name: Install the package diff --git a/.github/workflows/ci_doctests.yaml b/.github/workflows/ci_doctests.yaml index bad35d2bb1a..c0deb9e483d 100644 --- a/.github/workflows/ci_doctests.yaml +++ b/.github/workflows/ci_doctests.yaml @@ -69,14 +69,7 @@ jobs: # Download cached remote files (artifacts) from GitHub - name: Download remote data from GitHub - run: | - # Download cached 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 }} + uses: ./.github/actions/download-gmt-cache # Install the package that we want to test - name: Install the package diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 68faa79a394..39ef6deb420 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -145,14 +145,7 @@ jobs: # 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 }} + uses: ./.github/actions/download-gmt-cache # Install the package that we want to test - name: Install the package diff --git a/.github/workflows/ci_tests_dev.yaml b/.github/workflows/ci_tests_dev.yaml index 71666672337..32d7948f70e 100644 --- a/.github/workflows/ci_tests_dev.yaml +++ b/.github/workflows/ci_tests_dev.yaml @@ -151,14 +151,7 @@ jobs: # Download cached remote files (artifacts) from GitHub - name: Download remote data from GitHub - run: | - # Download cached 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 }} + uses: ./.github/actions/download-gmt-cache # Install the package that we want to test - name: Install the package diff --git a/.github/workflows/ci_tests_legacy.yaml b/.github/workflows/ci_tests_legacy.yaml index d73e10bd808..032c8729798 100644 --- a/.github/workflows/ci_tests_legacy.yaml +++ b/.github/workflows/ci_tests_legacy.yaml @@ -80,14 +80,7 @@ jobs: # Download cached remote files (artifacts) from GitHub - name: Download remote data from GitHub - run: | - # Download cached 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 }} + uses: ./.github/actions/download-gmt-cache # Install the package that we want to test - name: Install the package From 0a44b200e445be6b259e4c8aea4b3d4597a83bfb Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 25 Aug 2026 11:33:49 +0800 Subject: [PATCH 2/4] Rename the composite action directory to use an underscore The 'Ensure hyphens are not used in names of directories and Python files' step in style_checks.yaml greps every tracked directory, so '.github/actions/download-gmt-cache' would have failed CI. Rename it to 'download_gmt_cache'. Co-Authored-By: Claude Opus 5 --- .../{download-gmt-cache => download_gmt_cache}/action.yml | 0 .github/workflows/benchmarks.yml | 2 +- .github/workflows/ci_docs.yml | 2 +- .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, 6 insertions(+), 6 deletions(-) rename .github/actions/{download-gmt-cache => download_gmt_cache}/action.yml (100%) diff --git a/.github/actions/download-gmt-cache/action.yml b/.github/actions/download_gmt_cache/action.yml similarity index 100% rename from .github/actions/download-gmt-cache/action.yml rename to .github/actions/download_gmt_cache/action.yml diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index f87badc1cb8..c1becd7f6f4 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -69,7 +69,7 @@ jobs: # Download cached remote files (artifacts) from GitHub - name: Download remote data from GitHub - uses: ./.github/actions/download-gmt-cache + uses: ./.github/actions/download_gmt_cache # Install the package that we want to test - name: Install the package diff --git a/.github/workflows/ci_docs.yml b/.github/workflows/ci_docs.yml index 719e8ec5ac7..d304230c95a 100644 --- a/.github/workflows/ci_docs.yml +++ b/.github/workflows/ci_docs.yml @@ -123,7 +123,7 @@ jobs: # Download cached remote files (artifacts) from GitHub - name: Download remote data from GitHub - uses: ./.github/actions/download-gmt-cache + uses: ./.github/actions/download_gmt_cache # Install the package that we want to test - name: Install the package diff --git a/.github/workflows/ci_doctests.yaml b/.github/workflows/ci_doctests.yaml index c0deb9e483d..3c53bce5d78 100644 --- a/.github/workflows/ci_doctests.yaml +++ b/.github/workflows/ci_doctests.yaml @@ -69,7 +69,7 @@ jobs: # Download cached remote files (artifacts) from GitHub - name: Download remote data from GitHub - uses: ./.github/actions/download-gmt-cache + uses: ./.github/actions/download_gmt_cache # Install the package that we want to test - name: Install the package diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 39ef6deb420..4fb1ee75f37 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -145,7 +145,7 @@ jobs: # Download cached remote files (artifacts) from GitHub - name: Download remote data from GitHub - uses: ./.github/actions/download-gmt-cache + uses: ./.github/actions/download_gmt_cache # Install the package that we want to test - name: Install the package diff --git a/.github/workflows/ci_tests_dev.yaml b/.github/workflows/ci_tests_dev.yaml index 32d7948f70e..72ee1ee6759 100644 --- a/.github/workflows/ci_tests_dev.yaml +++ b/.github/workflows/ci_tests_dev.yaml @@ -151,7 +151,7 @@ jobs: # Download cached remote files (artifacts) from GitHub - name: Download remote data from GitHub - uses: ./.github/actions/download-gmt-cache + uses: ./.github/actions/download_gmt_cache # Install the package that we want to test - name: Install the package diff --git a/.github/workflows/ci_tests_legacy.yaml b/.github/workflows/ci_tests_legacy.yaml index 032c8729798..bf3306abc13 100644 --- a/.github/workflows/ci_tests_legacy.yaml +++ b/.github/workflows/ci_tests_legacy.yaml @@ -80,7 +80,7 @@ jobs: # Download cached remote files (artifacts) from GitHub - name: Download remote data from GitHub - uses: ./.github/actions/download-gmt-cache + uses: ./.github/actions/download_gmt_cache # Install the package that we want to test - name: Install the package From 373bd2649899c7515d68bebd7d28eeb80b0eb07c Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 27 Aug 2026 10:36:23 +0800 Subject: [PATCH 3/4] Login shell is likely not needed --- .github/actions/download_gmt_cache/action.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/actions/download_gmt_cache/action.yml b/.github/actions/download_gmt_cache/action.yml index 03b146baa3e..c9a73d823a1 100644 --- a/.github/actions/download_gmt_cache/action.yml +++ b/.github/actions/download_gmt_cache/action.yml @@ -14,9 +14,6 @@ runs: using: composite steps: - name: Download remote data from GitHub - # The job default shell is not inherited by composite actions, so it's set here to - # match the login shell used by the workflows. - shell: bash -l {0} run: | # Download cached files to ~/.gmt directory and list them gh run download --name gmt-cache --dir ~/.gmt/ From 9e19684721e022b05ae7c4fd4eccbcf998b09f97 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 27 Aug 2026 10:40:33 +0800 Subject: [PATCH 4/4] shell is required --- .github/actions/download_gmt_cache/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/download_gmt_cache/action.yml b/.github/actions/download_gmt_cache/action.yml index c9a73d823a1..716f0398616 100644 --- a/.github/actions/download_gmt_cache/action.yml +++ b/.github/actions/download_gmt_cache/action.yml @@ -14,6 +14,7 @@ runs: using: composite steps: - name: Download remote data from GitHub + shell: bash run: | # Download cached files to ~/.gmt directory and list them gh run download --name gmt-cache --dir ~/.gmt/