-
Notifications
You must be signed in to change notification settings - Fork 406
190 lines (171 loc) · 5.75 KB
/
Copy pathci-caches.yml
File metadata and controls
190 lines (171 loc) · 5.75 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#
# Create CI caches for:
#
# 1. GMT remote data for building documentation and running tests
# 2. GMT GSHHG and DCW datasets
# 3. vcpkg libraries on Windows
# 4. DVC-tracked baseline images for tests and docs
#
name: GMT CI Caches
on:
push:
branches:
- master
paths:
- 'test/baseline/*.dvc'
- 'doc/examples/images/*.dvc'
- 'doc/scripts/images/*.dvc'
- '.github/workflows/ci-caches.yml'
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'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
jobs:
data_cache:
name: Cache GMT data
runs-on: macos-latest
if: github.event_name != 'push'
defaults:
run:
shell: bash -l {0}
steps:
- name: Install GMT
uses: mamba-org/setup-micromamba@v3.0.0
with:
environment-name: gmt
condarc: |
channels:
- conda-forge
- nodefaults
create-args: >-
gmt=6.5.0
- name: Download remote data
run: |
# list of datasets used in tests
data="@earth_relief_01d_p \
@earth_relief_01d_g \
@earth_relief_30m_p \
@earth_relief_20m_p \
@earth_relief_15m_p \
@earth_relief_10m_p \
@earth_relief_06m_p \
@earth_relief_05m_p \
@earth_relief_05m_g \
@earth_relief_04m_p \
@N30E000.earth_relief_02m_p.nc \
@N30W060.earth_relief_02m_p.nc \
@N30W120.earth_relief_02m_p.nc \
@N30W180.earth_relief_02m_p.nc \
@S30E000.earth_relief_02m_p.nc \
@S30W060.earth_relief_02m_p.nc \
@S30W180.earth_relief_02m_p.nc \
@S30W060.earth_relief_02m_g.nc \
@N00E000.earth_relief_01m_p.nc \
@N00W180.earth_relief_01m_p.nc \
@S30W060.earth_relief_01m_p.nc \
@S60W120.earth_relief_01m_g.nc \
@N30W105.earth_relief_30s_p.nc \
@N30W120.earth_relief_30s_p.nc \
@N45E000.earth_relief_30s_p.nc \
@N40E000.earth_relief_15s_p.nc \
@N44E003.earth_relief_03s_g.nc \
@N44E004.earth_relief_03s_g.nc \
@earth_age_10m_p \
@earth_age_06m_p \
@S30W180.earth_age_02m_p.nc \
@earth_day_20m_p \
@earth_day_15m_p \
@earth_day_01m_p \
@earth_day_01d_p \
@earth_night_20m_p \
@earth_mask_30s_p"
# Use the static server
export GMT_DATA_SERVER=static
# Download remote data multiple times to make sure all are downloaded
gmt which -Ga $data
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 -lR ~/.gmt
# Upload the downloaded files as artifacts to GitHub
- name: Upload artifacts to GitHub
uses: actions/upload-artifact@v7
with:
name: gmt-cache
path: ~/.gmt/static
coastline_cache:
name: Cache GSHHG and DCW datasets
runs-on: ubuntu-latest
if: github.event_name != 'push'
env:
COASTLINEDIR: ${{ github.workspace }}/coastline
steps:
- name: Checkout
uses: actions/checkout@v6.0.2
- name: Download GSHHG and DCW datasets
run: bash ci/download-coastlines.sh
env:
COASTLINEDIR: ${{ env.COASTLINEDIR }}
- name: Upload artifacts to GitHub
uses: actions/upload-artifact@v7
with:
name: coastline-cache
path: ${{ env.COASTLINEDIR }}
vcpkg_cache:
name: Cache vcpkg libraries
runs-on: windows-latest
if: github.event_name != 'push'
steps:
- name: Checkout
uses: actions/checkout@v6.0.2
- name: Install vcpkg libraries
run: bash ci/install-dependencies-windows.sh
- name: Upload artifacts to GitHub
uses: actions/upload-artifact@v7
with:
name: vcpkg-cache
# VCPKG_INSTALLATION_ROOT is C:\vcpkg
path: C:\vcpkg\installed\
dvc_cache:
name: Cache DVC baseline images
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout
uses: actions/checkout@v6.0.2
with:
persist-credentials: false
- name: Setup data version control (DVC)
uses: iterative/setup-dvc@v2
- name: Pull baseline image data from dvc remote
env:
DAGSHUB_TOKEN: ${{ secrets.DAGSHUB_TOKEN }}
run: |
dvc remote modify origin url https://${DAGSHUB_TOKEN}@dagshub.com/GenericMappingTools/gmt.dvc --local
dvc pull --remote origin --no-run-cache --verbose
- name: Upload DVC cache as artifacts to GitHub
uses: actions/upload-artifact@v7
with:
name: dvc-cache
include-hidden-files: true
path: .dvc/cache/