Skip to content

Commit 827b98e

Browse files
authored
Merge branch 'master' into enable-windows
2 parents ca91890 + f0d3762 commit 827b98e

File tree

3 files changed

+58
-30
lines changed

3 files changed

+58
-30
lines changed

.github/workflows/cache_data.yaml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This workflow gets and uploads the GMT data artifacts used in the PyGMT CI tests
2+
name: Cache data
3+
4+
on:
5+
# Uncomment the 'pull_request' line below to manually re-cache data artifacts
6+
# pull_request:
7+
# Schedule runs on 12 noon every Sunday
8+
schedule:
9+
- cron: '0 12 * * 0'
10+
11+
jobs:
12+
gmt_cache:
13+
name: Cache GMT artifacts
14+
runs-on: macOS-latest
15+
16+
steps:
17+
# Setup Miniconda
18+
- name: Setup Miniconda
19+
uses: goanpeca/[email protected]
20+
with:
21+
channels: conda-forge
22+
23+
# Install GMT
24+
- name: Install GMT
25+
shell: bash -l {0}
26+
run: conda install -c conda-forge gmt=6.1.0
27+
28+
# Download remote files
29+
- name: Download remote data
30+
shell: bash -l {0}
31+
run: |
32+
gmt which -Ga @earth_relief_10m_p @earth_relief_10m_g @earth_relief_30m_p @earth_relief_30m_g @earth_relief_01d_p @earth_relief_01d_g
33+
gmt which -Ga @ridge.txt @Table_5_11.txt @test.dat.nc @tut_bathy.nc @tut_quakes.ngdc @tut_ship.xyz @usgs_quakes_22.txt
34+
35+
# Upload the downloaded files as artifacts to Github
36+
- name: Upload artifacts to Github
37+
uses: actions/upload-artifact@v2
38+
with:
39+
name: gmt-cache
40+
path: |
41+
~/.gmt/cache
42+
~/.gmt/server

.github/workflows/ci_tests.yaml

+12-30
Original file line numberDiff line numberDiff line change
@@ -82,39 +82,21 @@ jobs:
8282
shell: bash -l {0}
8383
run: conda list
8484

85-
# Cache the ${HOME}/.gmt directory, for docs and testing
86-
- name: Cache GMT directory
87-
uses: actions/cache@v2
88-
id: cache
85+
# Download cached remote files (artifacts) from Github
86+
- name: Download remote data from Github
87+
uses: dawidd6/[email protected]
8988
with:
90-
path: |
91-
~/.gmt/cache
92-
~/.gmt/server
93-
key: cache-gmt-${{ runner.os }}-${{ github.ref }}-20200711
94-
restore-keys: cache-gmt-${{ runner.os }}-refs/heads/master-
95-
96-
# Workaround for the timeouts of 'gmt which' on Linux and Windows
97-
- name: Download remote data using wget (Linux & Windows)
98-
shell: bash -l {0}
99-
run: |
100-
if [ "$RUNNER_OS" == "Windows" ]; then choco install wget; fi # install wget on Windows
101-
mkdir -p ~/.gmt ~/.gmt/cache ~/.gmt/server/earth/earth_relief/
102-
wget --no-check-certificate https://oceania.generic-mapping-tools.org/gmt_hash_server.txt -P ~/.gmt/server/
103-
for data in earth_relief_01d_p.grd earth_relief_01d_g.grd earth_relief_30m_p.grd earth_relief_30m_g.grd earth_relief_10m_p.grd earth_relief_10m_g.grd; do
104-
wget --no-check-certificate https://oceania.generic-mapping-tools.org/server/earth/earth_relief/${data} -P ~/.gmt/server/earth/earth_relief/
105-
done
106-
for data in ridge.txt Table_5_11.txt test.dat.nc tut_bathy.nc tut_quakes.ngdc tut_ship.xyz usgs_quakes_22.txt; do
107-
wget --no-check-certificate https://oceania.generic-mapping-tools.org/cache/${data} -P ~/.gmt/cache/
108-
done
109-
if: steps.cache.outputs.cache-hit != 'true' && runner.os != 'macOS'
110-
111-
# Download remote files, if not already cached
112-
- name: Download remote data (macOS)
89+
workflow: cache_data.yaml
90+
name: gmt-cache
91+
path: .gmt
92+
93+
# Move downloaded files to ~/.gmt directory and list them
94+
- name: Move and list downloaded remote files
11395
shell: bash -l {0}
11496
run: |
115-
gmt which -Ga @earth_relief_10m_p @earth_relief_10m_g @earth_relief_30m_p @earth_relief_30m_g @earth_relief_01d_p @earth_relief_01d_g
116-
gmt which -Ga @ridge.txt @Table_5_11.txt @test.dat.nc @tut_bathy.nc @tut_quakes.ngdc @tut_ship.xyz @usgs_quakes_22.txt
117-
if: steps.cache.outputs.cache-hit != 'true' && runner.os == 'macOS'
97+
mkdir -p ~/.gmt
98+
mv .gmt/* ~/.gmt
99+
ls -lh ~/.gmt
118100
119101
# Install the package that we want to test
120102
- name: Install the package

MAINTENANCE.md

+4
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ The configuration file for these services are in
4646
`.github/workflows/ci_tests.yaml` and `.travis.yml`.
4747
They rely on the `requirements.txt` file to install required dependencies using
4848
conda and the `Makefile` to run the tests and checks.
49+
There is also a `.github/workflows/cache_data.yaml` file which caches some GMT
50+
remote data files needed for the Github Actions CI on a regular basis.
51+
If new remote files are needed urgently, maintainers can manually uncomment
52+
the 'pull_request:' line in that `cache_data.yaml` file to refresh the cache.
4953

5054
Travis also handles all of our deployments automatically:
5155

0 commit comments

Comments
 (0)