Skip to content

Commit bdc51d7

Browse files
weiji14seisman
andauthored
Github Actions CI for testing GMT master branch (#485)
Running Continuous Integration tests on the gmt-master branch. Currently only on Ubuntu and macOS only. * Add a cron job for daily tests * Move GMT Master Tests to separate yaml file and add a badge for it Also run the tests only on PRs that are ready for review or have a review requested (i.e. non-draft PRs). * Mention GMT Master Tests in MAINTENANCE.md, and reorganize some sections Co-authored-by: Dongdong Tian <[email protected]>
1 parent eb93372 commit bdc51d7

File tree

3 files changed

+106
-7
lines changed

3 files changed

+106
-7
lines changed

.github/workflows/ci_tests_dev.yaml

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# This workflow installs PyGMT dependencies, builds documentation and runs tests on GMT master
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: GMT Master Tests
5+
6+
on:
7+
# push:
8+
# branches: [ master ]
9+
pull_request:
10+
types: [review_requested, ready_for_review]
11+
# Schedule daily tests
12+
schedule:
13+
- cron: '0 0 * * *'
14+
15+
jobs:
16+
test_gmt_master:
17+
name: ${{ matrix.os }} - Python ${{ matrix.python-version }}
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
python-version: [3.8]
23+
os: [ubuntu-20.04, macOS-10.15]
24+
env:
25+
# LD_LIBRARY_PATH: ${{ github.workspace }}/gmt/lib:$LD_LIBRARY_PATH
26+
GMT_INSTALL_DIR: ${{ github.workspace }}/gmt-install-dir
27+
GMT_LIBRARY_PATH: ${{ github.workspace }}/gmt-install-dir/lib
28+
defaults:
29+
run:
30+
shell: bash -l {0}
31+
32+
steps:
33+
# Checkout current git repository
34+
- name: Checkout
35+
uses: actions/[email protected]
36+
with:
37+
# fecth all history so that versioneer works
38+
fetch-depth: 0
39+
40+
# Setup Miniconda
41+
- name: Setup Miniconda
42+
uses: goanpeca/[email protected]
43+
with:
44+
python-version: ${{ matrix.python-version }}
45+
channels: conda-forge
46+
47+
# Install build dependencies from conda-forge
48+
- name: Install build dependencies
49+
run: conda install cmake libblas libcblas liblapack fftw gdal ghostscript libnetcdf hdf5 zlib curl pcre ipython pytest pytest-cov pytest-mpl
50+
51+
# Install GMT master branch
52+
- name: Install GMT from master
53+
run: curl https://raw.githubusercontent.com/GenericMappingTools/gmt/master/ci/build-gmt-master.sh | bash
54+
55+
# Download cached remote files (artifacts) from Github
56+
- name: Download remote data from Github
57+
uses: dawidd6/[email protected]
58+
with:
59+
workflow: cache_data.yaml
60+
name: gmt-cache
61+
path: .gmt
62+
63+
# Move downloaded files to ~/.gmt directory and list them
64+
- name: Move and list downloaded remote files
65+
shell: bash -l {0}
66+
run: |
67+
mkdir -p ~/.gmt
68+
mv .gmt/* ~/.gmt
69+
ls -lh ~/.gmt
70+
71+
# Install the package that we want to test
72+
- name: Install the package
73+
run: |
74+
python setup.py sdist --formats=zip
75+
pip install dist/*
76+
77+
# Run the tests
78+
- name: Test with pytest
79+
run: make test PYTEST_EXTRA="-r P"

MAINTENANCE.md

+22-5
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,33 @@ The main advantages of this are:
4242

4343
We use Github Actions and TravisCI continuous integration (CI) services to
4444
build and test the project on Linux, macOS and Windows.
45-
The configuration file for these services are in
46-
`.github/workflows/ci_tests.yaml` and `.travis.yml`.
4745
They rely on the `requirements.txt` file to install required dependencies using
4846
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.
47+
48+
### Github Actions
49+
50+
There are 3 configuration files located in `.github/workflows`:
51+
52+
1. `ci_tests.yaml` (Style Checks, Tests on Linux/macOS/Windows)
53+
54+
This is ran on every commit on the *master* and Pull Request branches.
55+
It is also scheduled to run daily on the *master* branch.
56+
57+
2. `ci_tests_dev.yaml` (GMT Master Tests on Linux/macOS).
58+
59+
This is only triggered when a review is requested or re-requested on a PR.
60+
It is also scheduled to run daily on the *master* branch.
61+
62+
3. `cache_data.yaml` (Caches GMT remote data files needed for Github Actions CI)
63+
64+
This is scheduled to run every Sunday at 12 noon.
5165
If new remote files are needed urgently, maintainers can manually uncomment
5266
the 'pull_request:' line in that `cache_data.yaml` file to refresh the cache.
5367

54-
Travis also handles all of our deployments automatically:
68+
### Travis CI
69+
70+
The configuration file is at `.travis.yml`.
71+
Travis runs tests (Linux only) and handles all of our deployments automatically:
5572

5673
* Updating the development documentation by pushing the built HTML pages from the
5774
*master* branch onto the `dev` folder of the *gh-pages* branch.

README.rst

+5-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ PyGMT
1313
:alt: Travis CI build status
1414
:target: https://travis-ci.org/GenericMappingTools/pygmt
1515
.. image:: https://github.com/GenericMappingTools/pygmt/workflows/Tests/badge.svg
16-
:alt: GitHub Actions build status
17-
:target: https://github.com/GenericMappingTools/pygmt/actions
16+
:alt: GitHub Actions Tests status
17+
:target: https://github.com/GenericMappingTools/pygmt/actions?query=workflow%3ATests
18+
.. image:: https://github.com/GenericMappingTools/pygmt/workflows/GMT%20Master%20Tests/badge.svg
19+
:alt: GitHub Actions GMT Master Tests status
20+
:target: https://github.com/GenericMappingTools/pygmt/actions?query=workflow%3A"GMT+Master+Tests"
1821
.. image:: https://img.shields.io/codecov/c/github/GenericMappingTools/pygmt/master.svg?style=flat-square
1922
:alt: Test coverage status
2023
:target: https://codecov.io/gh/GenericMappingTools/pygmt

0 commit comments

Comments
 (0)