From 86a4417200e599e41475d1eb4cfa5729c7ac29c7 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Wed, 8 May 2024 10:44:10 +0800 Subject: [PATCH] Simplify more workflows --- .github/workflows/docker.yml | 42 ++++++++++++++++-------------------- .github/workflows/docs.yml | 14 ++++-------- .github/workflows/tests.yml | 14 ++++-------- 3 files changed, 27 insertions(+), 43 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index dc742e0d8b2..f3a0ffecb26 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -67,9 +67,6 @@ jobs: - fedora:rawhide # rolling release with latest versions steps: - - name: Checkout - uses: actions/checkout@v4.1.4 - - name: Install GMT dependencies run: | os=$(cat /etc/os-release | grep "^ID=" | awk -F= '{print $2}') @@ -83,24 +80,30 @@ jobs: ghostscript curl git apt reinstall -y ca-certificates update-ca-certificates + # Install gh from binary deb package + curl -LO https://github.com/cli/cli/releases/download/v2.49.0/gh_2.49.0_linux_amd64.deb + apt install ./gh_2.49.0_linux_amd64.deb elif [[ "$os" = "fedora" ]]; then dnf install -y \ cmake ninja-build \ libcurl-devel netcdf-devel gdal-devel gdal \ fftw3-devel pcre-devel lapack-devel openblas-devel glib2-devel \ - ghostscript openssl + ghostscript openssl gh fi - - name: Cache GSHHG and DCW data - uses: actions/cache@v4 - id: cache-coastline - with: - path: ${{ env.COASTLINEDIR }} - key: coastline-${{ hashFiles('ci/download-coastlines.sh') }} + - name: Checkout + uses: actions/checkout@v4.1.4 + + - name: Fixup git + run: | + # Fix the git error: + # "failed to run git: fatal: detected dubious ownership in repository at '/__w/gmt/gmt'" + git config --global --add safe.directory /__w/gmt/gmt - - name: Download coastlines - run: bash ci/download-coastlines.sh - if: steps.cache-coastline.outputs.cache-hit != 'true' + - name: Download GSHHG and DCW data + run: gh run download -n coastline-cache -D ${{ env.COASTLINEDIR }} + env: + GH_TOKEN: ${{ github.token }} - name: Configure GMT run: bash ci/config-gmt-unix.sh @@ -116,18 +119,11 @@ jobs: echo "${INSTALLDIR}/bin" >> $GITHUB_PATH - name: Download cached GMT remote data from GitHub Artifacts - uses: dawidd6/action-download-artifact@v3.1.4 - with: - workflow: ci-caches.yml - name: gmt-cache - path: gmt-cache - - # Move downloaded files to ~/.gmt directory and list them - - name: Move and list downloaded remote files run: | - mkdir -p ~/.gmt/static/ - mv gmt-cache/* ~/.gmt/static/ + gh run download -n gmt-cache -D ~/.gmt/static/ ls -lRh ~/.gmt/static/ + env: + GH_TOKEN: ${{ github.token }} - name: Check a few simple commands run: bash ci/simple-gmt-tests.sh diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index e07da6a3fa1..3146b3d9654 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -76,16 +76,10 @@ jobs: os=$(echo "$RUNNER_OS" | tr '[:upper:]' '[:lower:]') bash ci/install-dependencies-${os}.sh - - name: Cache GSHHG and DCW data - uses: actions/cache@v4 - id: cache-coastline - with: - path: ${{ env.COASTLINEDIR }} - key: coastline-${{ hashFiles('ci/download-coastlines.sh') }} - - - name: Download coastlines - run: bash ci/download-coastlines.sh - if: steps.cache-coastline.outputs.cache-hit != 'true' + - name: Download GSHHG and DCW data + run: gh run download -n coastline-cache -D ${{ env.COASTLINEDIR }} + env: + GH_TOKEN: ${{ github.token }} # Pull baseline image data from dvc remote (DAGsHub) - name: Pull baseline image data from dvc remote diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 64d4b1e21c8..7b8beea9ab8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -90,16 +90,10 @@ jobs: New-ItemProperty -Path "HKLM:\Software\GPL Ghostscript\10.02" -Name GS_LIB -PropertyType String -Value "C:\Miniconda\Library\bin;C:\Miniconda\Library\lib;C\Miniconda\Library\Font;C:\Miniconda\Library\fonts" if: runner.os == 'Windows' - - name: Cache GSHHG and DCW data - uses: actions/cache@v4 - id: cache-coastline - with: - path: ${{ env.COASTLINEDIR }} - key: coastline-${{ hashFiles('ci/download-coastlines.sh') }} - - - name: Download coastlines - run: bash ci/download-coastlines.sh - if: steps.cache-coastline.outputs.cache-hit != 'true' + - name: Download GSHHG and DCW data + run: gh run download -n coastline-cache -D ${{ env.COASTLINEDIR }} + env: + GH_TOKEN: ${{ github.token }} - name: Configure GMT run: |