Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Fix the ci-caches workflow and always use the "static" data server in CI #8426

Merged
merged 6 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@ jobs:
with:
workflow: ci-caches.yml
name: gmt-cache
path: .gmt
path: gmt-cache

# Move downloaded files to ~/.gmt directory and list them
- name: Move and list downloaded remote files
run: |
mkdir -p ~/.gmt
mv .gmt/* ~/.gmt
ls -lRh ~/.gmt
mkdir -p ~/.gmt/static/
mv gmt-cache/* ~/.gmt/static/
ls -lRh ~/.gmt/static/

- name: Install GMT
run: |
Expand Down
37 changes: 27 additions & 10 deletions .github/workflows/ci-caches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
name: GMT CI Caches

on:
# Uncomment the "push:" line to manually re-cache data artifacts in pushes
#push:
# Uncomment the 'pull_request:' line to manually re-cache data artifacts in PRs
# pull_request:
pull_request:
# Make any changes to the following files to refresh the cache in PRs
paths:
- '.github/workflows/ci-caches.yml'
workflow_dispatch:
# Schedule runs on 12 noon every Sunday
schedule:
- cron: '0 12 * * 0'
Expand All @@ -22,12 +23,22 @@ concurrency:
jobs:
data_cache:
name: Cache GMT data
# We have to use macOS, because Linux/Windows agents may fail to download
runs-on: macOS-latest
runs-on: macos-latest
defaults:
run:
shell: bash -l {0}

steps:
- name: Install GMT
run: brew install gmt
uses: mamba-org/[email protected]
with:
environment-name: gmt
condarc: |
channels:
- conda-forge
- nodefaults
create-args: >-
gmt=6.5.0

- name: Download remote data
run: |
Expand Down Expand Up @@ -76,20 +87,26 @@ jobs:
gmt which -Ga $data
gmt which -Ga $data
# Download cache files multiple times to make sure all are downloaded
# Workaroud for https://github.com/GenericMappingTools/gmt/issues/8437.
mv ~/.gmt/gmt_data_server.txt ~/.gmt/server/
mv ~/.gmt/gmt_hash_server.txt ~/.gmt/server/
gmt get -Dcache
gmt get -Dcache
gmt get -Dcache
# Workaroud for https://github.com/GenericMappingTools/gmt/issues/8437.
mkdir ~/.gmt/static/
mv ~/.gmt/server ~/.gmt/static/
mv ~/.gmt/cache ~/.gmt/static/
# check files
ls -R ~/.gmt
ls -lR ~/.gmt

# Upload the downloaded files as artifacts to GitHub
- name: Upload artifacts to GitHub
uses: actions/upload-artifact@v4
with:
name: gmt-cache
path: |
~/.gmt/cache
~/.gmt/server
~/.gmt/static

vcpkg_cache:
name: Cache vcpkg libraries
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ jobs:
with:
workflow: ci-caches.yml
name: gmt-cache
path: .gmt
path: gmt-cache

# Move downloaded files to ~/.gmt directory and list them
- name: Move and list downloaded remote files
run: |
mkdir -p ~/.gmt
mv .gmt/* ~/.gmt
ls -lRh ~/.gmt
mkdir -p ~/.gmt/static/
mv gmt-cache/* ~/.gmt/static/
ls -lRh ~/.gmt/static/

- name: Check a few simple commands
run: bash ci/simple-gmt-tests.sh
8 changes: 4 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ jobs:
with:
workflow: ci-caches.yml
name: gmt-cache
path: .gmt
path: gmt-cache

# Move downloaded files to ~/.gmt directory and list them
- name: Move and list downloaded remote files
run: |
mkdir -p ~/.gmt
mv .gmt/* ~/.gmt
ls -lRh ~/.gmt
mkdir -p ~/.gmt/static/
mv gmt-cache/* ~/.gmt/static/
ls -lRh ~/.gmt/static/

- name: Build documentation
run: |
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,18 @@ jobs:
with:
workflow: ci-caches.yml
name: gmt-cache
path: .gmt

# Pull baseline image data from dvc remote (DAGsHub)
- name: Pull baseline image data from dvc remote
run: dvc pull
path: gmt-cache

# Move downloaded files to ~/.gmt directory and list them
- name: Move and list downloaded remote files
run: |
mkdir -p ~/.gmt
mv .gmt/* ~/.gmt
ls -lRh ~/.gmt
mkdir -p ~/.gmt/static/
mv gmt-cache/* ~/.gmt/static/
ls -lRh ~/.gmt/static/

# Pull baseline image data from dvc remote (DAGsHub)
- name: Pull baseline image data from dvc remote
run: dvc pull

- name: Install GMT
run: |
Expand Down
4 changes: 3 additions & 1 deletion ci/config-gmt-unix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ set (DCW_ROOT "$ENV{COASTLINEDIR}/dcw")
set (GMT_USE_THREADS TRUE)
set (GMT_ENABLE_OPENMP TRUE)

# Always use the 'static' data server in CI.
set (GMT_DATA_SERVER static)

# recommended even for release build
set (CMAKE_C_FLAGS "-Wall -Wdeclaration-after-statement ${CMAKE_C_FLAGS}")
# extra warnings
Expand All @@ -23,7 +26,6 @@ if [[ "$RUN_TESTS" == "true" ]]; then
set (CMAKE_BUILD_TYPE Debug)

enable_testing()
set (GMT_DATA_SERVER static)
set (DO_EXAMPLES TRUE)
set (DO_TESTS TRUE)
set (DO_API_TESTS ON)
Expand Down
4 changes: 3 additions & 1 deletion ci/config-gmt-windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ set (GSHHG_ROOT "$ENV{COASTLINEDIR}/gshhg")
set (DCW_ROOT "$ENV{COASTLINEDIR}/dcw")

set (GMT_ENABLE_OPENMP TRUE)

# Always use the 'static' data server in CI.
set (GMT_DATA_SERVER static)
EOF

if [[ "$RUN_TESTS" == "true" ]]; then
cat >> cmake/ConfigUser.cmake << 'EOF'
enable_testing()
set (GMT_DATA_SERVER static)
set (DO_EXAMPLES TRUE)
set (DO_TESTS TRUE)
set (DO_API_TESTS ON)
Expand Down
Loading