Skip to content

Commit eff332b

Browse files
committed
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). Based on https://github.community/t/dont-run-actions-on-draft-pull-requests/16817/6.
1 parent 80f8bf6 commit eff332b

File tree

3 files changed

+84
-67
lines changed

3 files changed

+84
-67
lines changed

.github/workflows/ci_tests.yaml

-65
Original file line numberDiff line numberDiff line change
@@ -122,68 +122,3 @@ jobs:
122122
file: ./coverage.xml # optional
123123
env_vars: OS,PYTHON
124124
fail_ci_if_error: true
125-
126-
test_gmt_master:
127-
name: GMT master - ${{ matrix.os }} - Python ${{ matrix.python-version }}
128-
runs-on: ${{ matrix.os }}
129-
strategy:
130-
fail-fast: false
131-
matrix:
132-
python-version: [3.7]
133-
os: [ubuntu-20.04, macOS-10.15]
134-
env:
135-
# LD_LIBRARY_PATH: ${{ github.workspace }}/gmt/lib:$LD_LIBRARY_PATH
136-
GMT_INSTALL_DIR: ${{ github.workspace }}/gmt-install-dir
137-
GMT_LIBRARY_PATH: ${{ github.workspace }}/gmt-install-dir/lib
138-
defaults:
139-
run:
140-
shell: bash -l {0}
141-
142-
steps:
143-
# Checkout current git repository
144-
- name: Checkout
145-
uses: actions/[email protected]
146-
with:
147-
# fecth all history so that versioneer works
148-
fetch-depth: 0
149-
150-
# Setup Miniconda
151-
- name: Setup Miniconda
152-
uses: goanpeca/[email protected]
153-
with:
154-
python-version: ${{ matrix.python-version }}
155-
channels: conda-forge
156-
157-
# Install build dependencies from conda-forge
158-
- name: Install build dependencies
159-
run: conda install cmake libblas libcblas liblapack fftw gdal ghostscript libnetcdf hdf5 zlib curl pcre gshhg-gmt dcw-gmt ipython pytest pytest-cov pytest-mpl
160-
161-
# Install GMT master branch
162-
- name: Install GMT from master
163-
run: curl https://raw.githubusercontent.com/GenericMappingTools/gmt/master/ci/build-gmt-master.sh | bash
164-
165-
# Download cached remote files (artifacts) from Github
166-
- name: Download remote data from Github
167-
uses: dawidd6/[email protected]
168-
with:
169-
workflow: cache_data.yaml
170-
name: gmt-cache
171-
path: .gmt
172-
173-
# Move downloaded files to ~/.gmt directory and list them
174-
- name: Move and list downloaded remote files
175-
shell: bash -l {0}
176-
run: |
177-
mkdir -p ~/.gmt
178-
mv .gmt/* ~/.gmt
179-
ls -lh ~/.gmt
180-
181-
# Install the package that we want to test
182-
- name: Install the package
183-
run: |
184-
python setup.py sdist --formats=zip
185-
pip install dist/*
186-
187-
# Run the tests
188-
- name: Test with pytest
189-
run: make test PYTEST_EXTRA="-r P"

.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 gshhg-gmt dcw-gmt 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"

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)