Skip to content

Commit

Permalink
Move GMT Master Tests to separate yaml file and add a badge for it
Browse files Browse the repository at this point in the history
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.saobby.my.eu.orgmunity/t/dont-run-actions-on-draft-pull-requests/16817/6.
  • Loading branch information
weiji14 committed Jul 22, 2020
1 parent 80f8bf6 commit 19c38d0
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 67 deletions.
65 changes: 0 additions & 65 deletions .github/workflows/ci_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,68 +122,3 @@ jobs:
file: ./coverage.xml # optional
env_vars: OS,PYTHON
fail_ci_if_error: true

test_gmt_master:
name: GMT master - ${{ matrix.os }} - Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: [3.7]
os: [ubuntu-20.04, macOS-10.15]
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

# 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"
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]
# 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]
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

# 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"
.. 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

0 comments on commit 19c38d0

Please sign in to comment.