-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Github Actions CI for testing GMT master branch #485
Changes from 35 commits
4c0fd39
31340ee
9a4e7bc
51472dc
9c2e393
2220702
6936b3c
6906426
d2ce09b
e407081
841f937
9fd73f0
1a23b55
0ba3d7e
c744db9
3a06afc
05c225f
8bd8a66
d4408c0
c12cfff
9179bc2
8662be0
b5caae6
127c851
ba7b6ca
b87de5d
2dc2e6e
928ab48
1f1d6ae
575baa7
a4a6d7a
e2518ef
65ec7ce
80f8bf6
19c38d0
b911366
c174a1e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# This workflow installs PyGMT dependencies, builds documentation and runs tests on GMT master | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
||
name: GMT Master Tests | ||
|
||
on: | ||
# push: | ||
# branches: [ master ] | ||
pull_request: | ||
types: [review_requested, ready_for_review] | ||
# Schedule daily tests | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
jobs: | ||
test_gmt_master: | ||
name: ${{ matrix.os }} - Python ${{ matrix.python-version }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [3.8] | ||
os: [ubuntu-20.04, macOS-10.15] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would love to test on Windows here, but I think we might have to do conda-forge/gmt-feedstock#95 first 😉 |
||
env: | ||
# LD_LIBRARY_PATH: ${{ github.workspace }}/gmt/lib:$LD_LIBRARY_PATH | ||
GMT_INSTALL_DIR: ${{ github.workspace }}/gmt-install-dir | ||
GMT_LIBRARY_PATH: ${{ github.workspace }}/gmt-install-dir/lib | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
|
||
steps: | ||
# Checkout current git repository | ||
- name: Checkout | ||
uses: actions/checkout@v2.3.1 | ||
with: | ||
# fecth all history so that versioneer works | ||
fetch-depth: 0 | ||
|
||
# Setup Miniconda | ||
- name: Setup Miniconda | ||
uses: goanpeca/setup-miniconda@v1.6.0 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
channels: conda-forge | ||
|
||
# Install build dependencies from conda-forge | ||
- name: Install build dependencies | ||
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 | ||
seisman marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Install GMT master branch | ||
- name: Install GMT from master | ||
run: curl https://raw.githubusercontent.com/GenericMappingTools/gmt/master/ci/build-gmt-master.sh | bash | ||
|
||
# Download cached remote files (artifacts) from Github | ||
- name: Download remote data from Github | ||
uses: dawidd6/action-download-artifact@v2.6.3 | ||
with: | ||
workflow: cache_data.yaml | ||
name: gmt-cache | ||
path: .gmt | ||
|
||
# Move downloaded files to ~/.gmt directory and list them | ||
- name: Move and list downloaded remote files | ||
shell: bash -l {0} | ||
run: | | ||
mkdir -p ~/.gmt | ||
mv .gmt/* ~/.gmt | ||
ls -lh ~/.gmt | ||
|
||
# Install the package that we want to test | ||
- name: Install the package | ||
run: | | ||
python setup.py sdist --formats=zip | ||
pip install dist/* | ||
|
||
# Run the tests | ||
- name: Test with pytest | ||
run: make test PYTEST_EXTRA="-r P" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,11 @@ PyGMT | |
:alt: Travis CI build status | ||
:target: https://travis-ci.org/GenericMappingTools/pygmt | ||
.. image:: https://github.com/GenericMappingTools/pygmt/workflows/Tests/badge.svg | ||
:alt: GitHub Actions build status | ||
:target: https://github.com/GenericMappingTools/pygmt/actions | ||
:alt: GitHub Actions Tests status | ||
:target: https://github.com/GenericMappingTools/pygmt/actions?query=workflow%3ATests | ||
.. image:: https://github.com/GenericMappingTools/pygmt/workflows/GMT%20Master%20Tests/badge.svg | ||
:alt: GitHub Actions GMT Master Tests status | ||
:target: https://github.com/GenericMappingTools/pygmt/actions?query=workflow%3A"GMT+Master+Tests" | ||
Comment on lines
+16
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Ok, I've moved it into a separate file and added a separate badge. It would be nice if we could have separate badges for different jobs in a workflow but it doesn't look to be possible yet according to https://github.saobby.my.eu.orgmunity/t/separate-workflow-badges-when-using-matrix-testing-possible/16708. |
||
.. image:: https://img.shields.io/codecov/c/github/GenericMappingTools/pygmt/master.svg?style=flat-square | ||
:alt: Test coverage status | ||
:target: https://codecov.io/gh/GenericMappingTools/pygmt | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found this nice way to limit the GMT Master Tests to non-draft PRs (see https://github.saobby.my.eu.orgmunity/t/dont-run-actions-on-draft-pull-requests/16817/6 and also https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request). I think this strikes a nice balance between testing GMT master "on every PR commit" and testing "only on the PyGMT master branch". Let me know if this is okay.
As an aside, we could apply this to other expensive tests too (e.g. *coughs* Windows).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks a good idea. Do we still want to test GMT master when a PR is merged into master branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Up to you. I'd prefer to save on CI resources, and there's a daily cron job anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Daily cron job is enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just made a new commit b911366 to this branch. The GMT master workflow is not triggered. I need to click the "Re-request review" icon to trigger the GMT master test.
I think It's good. The GMT master workflow only runs when:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's a nice feature. We don't need to test this too often anyway so I'm happy with it 😄 Should I document this in MAINTENANCE.md?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please.