diff --git a/.github/actions/download_gmt_cache/action.yml b/.github/actions/download_gmt_cache/action.yml new file mode 100644 index 00000000000..716f0398616 --- /dev/null +++ b/.github/actions/download_gmt_cache/action.yml @@ -0,0 +1,25 @@ +# 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 + shell: bash + 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..c1becd7f6f4 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..d304230c95a 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..3c53bce5d78 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..4fb1ee75f37 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 9a46e59563f..f6af14b2744 100644 --- a/.github/workflows/ci_tests_dev.yaml +++ b/.github/workflows/ci_tests_dev.yaml @@ -156,14 +156,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..bf3306abc13 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