-
Notifications
You must be signed in to change notification settings - Fork 219
87 lines (79 loc) · 2.48 KB
/
cache_data.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Cache GMT remote data files and upload as artifacts
#
# This workflow downloads data files needed by PyGMT tests/documentation from the GMT
# data server and uploads them as workflow artifacts, which can then be accessed by other
# GitHub Actions workflows.
#
# It is scheduled to run every Sunday at 12:00 (UTC). If new remote files are needed
# urgently, maintainers can refresh the cache by one of the following methods:
#
# 1. Update this workflow file
# 2. Update the `pygmt/helpers/caching.py` file
# 3. Go to https://github.com/GenericMappingTools/pygmt/actions/workflows/cache_data.yaml
# and click the "Run workflow" button
#
name: Cache data
on:
pull_request:
# Make any changes to the following files to refresh the cache in PRs
paths:
- 'pygmt/helpers/caching.py'
- '.github/workflows/cache_data.yaml'
workflow_dispatch:
# Schedule runs on 12 noon every Sunday
schedule:
- cron: '0 12 * * 0'
jobs:
gmt_cache:
name: Cache GMT artifacts
runs-on: macos-latest
defaults:
run:
shell: bash -l {0}
steps:
# Checkout current git repository
- name: Checkout
uses: actions/checkout@v4.1.7
with:
# fetch all history so that setuptools-scm works
fetch-depth: 0
# Install Micromamba with conda-forge dependencies
- name: Setup Micromamba
uses: mamba-org/setup-micromamba@v1.9.0
with:
environment-name: pygmt
condarc: |
channels:
- conda-forge
- nodefaults
create-args: >-
python=3.12
gmt=6.5.0
numpy
pandas
xarray
netCDF4
packaging
python-build
# Install the package that we want to test
- name: Install the package
run: |
python -m build --sdist
python -m pip install dist/*
# Download remote files
- name: Download remote data
run: |
python -c "from pygmt.helpers.caching import cache_data; cache_data()"
- name: List downloaded remote files
run: ls -lhR ~/.gmt
# Upload the downloaded files as artifacts to GitHub
- name: Upload artifacts to GitHub
uses: actions/upload-artifact@v4.4.0
with:
name: gmt-cache
include-hidden-files: true
path: |
~/.gmt/cache
~/.gmt/server
~/.gmt/gmt_data_server.txt
~/.gmt/gmt_hash_server.txt