Skip to content
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

Merged
merged 37 commits into from
Jul 22, 2020
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
4c0fd39
Run Continuous Integration tests on Github Actions
weiji14 May 19, 2020
31340ee
Install make earlier
weiji14 May 19, 2020
9a4e7bc
Set Linux/MacOS environment variables properly
weiji14 May 20, 2020
51472dc
Install pytest and other dev dependencies
weiji14 May 20, 2020
9c2e393
Don't fail-fast and cancel all jobs
weiji14 May 20, 2020
2220702
Update setup-miniconda Github Action from v1 to v1.3.1
weiji14 May 20, 2020
6936b3c
Don't set any environment variables for all OSes
weiji14 May 21, 2020
6906426
Cache GMT tutorial files in ${{ github.workspace }}/.gmt on 20200605
weiji14 Jun 5, 2020
d2ce09b
Fix typo python_version to python-version
weiji14 Jun 7, 2020
e407081
Fix python_version to python-version
seisman Jun 9, 2020
841f937
Disable tests to enable caches
seisman Jun 10, 2020
9fd73f0
Re-enable tests to check caches
seisman Jun 10, 2020
1a23b55
Change github action name
seisman Jun 10, 2020
0ba3d7e
Simplify job name
seisman Jun 10, 2020
c744db9
The versioneer pacakge need tags to determine the PyGMT version
seisman Jun 10, 2020
3a06afc
Change runner.os to matrix.os
seisman Jun 10, 2020
05c225f
Improve the docs
seisman Jun 10, 2020
8bd8a66
Add a cron job for daily tests
seisman Jun 10, 2020
d4408c0
Merge branch 'master' into gh-actions-ci
seisman Jun 29, 2020
c12cfff
Change earth_relief_60m to earth_relief_01d
seisman Jun 29, 2020
9179bc2
Let conda install packages listed in requirements.txt
seisman Jun 29, 2020
8662be0
Single conda command to install all packages
seisman Jun 29, 2020
b5caae6
Attempt to test GMT master on Github Actions
weiji14 Jun 22, 2020
127c851
Use conda to install build dependencies instead of apt
weiji14 Jun 29, 2020
ba7b6ca
Set GMT_LIBRARY_PATH to gmt-install-dir/lib
weiji14 Jun 29, 2020
b87de5d
Install pytest et al
weiji14 Jun 29, 2020
2dc2e6e
Test on Ubuntu/macOS/Windows
weiji14 Jun 29, 2020
928ab48
Link to gmt binary on macOS and skip Windows for now
weiji14 Jun 29, 2020
1f1d6ae
Merge branch 'master' into gmt-master-gh-actions
weiji14 Jul 12, 2020
575baa7
Update cache key to 20200712 and use GMT 6.1.0 specific dataset names
weiji14 Jul 12, 2020
a4a6d7a
Add ipython for test_figure_show
weiji14 Jul 12, 2020
e2518ef
Merge branch 'master' into gmt-master-gh-actions
weiji14 Jul 16, 2020
65ec7ce
Use remote file cache artifacts from Github
weiji14 Jul 16, 2020
80f8bf6
Merge remote-tracking branch 'origin/master' into gmt-master-gh-actions
weiji14 Jul 22, 2020
19c38d0
Move GMT Master Tests to separate yaml file and add a badge for it
weiji14 Jul 22, 2020
b911366
No need to install gshhg-gmt and dcw-gmt
seisman Jul 22, 2020
c174a1e
Mention GMT Master Tests in MAINTENANCE.md, and reorganize some sections
weiji14 Jul 22, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/ci_tests_dev.yaml
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]
Comment on lines +9 to +10
Copy link
Member Author

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).

Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still want to test GMT master when a PR is merged into master branch?

Up to you. I'd prefer to save on CI resources, and there's a daily cron job anyway.

Copy link
Member

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.

Copy link
Member

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:

  1. A draft PR is ready for review
  2. A review is request or re-request

Copy link
Member Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please.

# 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]
Copy link
Member Author

@weiji14 weiji14 Jul 22, 2020

Choose a reason for hiding this comment

The 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"
7 changes: 5 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should move the "testing GMT master branch" into a separate file. Sometimes it's impossible to make all the tests for the current release and master branch. Then we will always see a failing badge in the README file.

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
Expand Down