-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: Add the "Doctests" workflow to run doctests weekly (#2456)
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> Co-authored-by: Michael Grund <23025878+michaelgrund@users.noreply.github.com>
- Loading branch information
1 parent
8cacfc4
commit e799cc6
Showing
3 changed files
with
107 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# This workflow installs PyGMT and runs all doctests | ||
|
||
name: Doctests | ||
|
||
on: | ||
# push: | ||
# branches: [ main ] | ||
# pull_request: | ||
# Schedule weekly tests on Sunday | ||
schedule: | ||
- cron: '0 0 * * 0' | ||
|
||
jobs: | ||
test: | ||
name: ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macOS-latest, windows-latest] | ||
timeout-minutes: 30 | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
|
||
steps: | ||
# Cancel previous runs that are not completed | ||
- name: Cancel Previous Runs | ||
uses: styfle/cancel-workflow-action@0.11.0 | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
# Checkout current git repository | ||
- name: Checkout | ||
uses: actions/checkout@v3.4.0 | ||
with: | ||
# fetch all history so that setuptools-scm works | ||
fetch-depth: 0 | ||
|
||
# Install Mambaforge with conda-forge dependencies | ||
- name: Setup Mambaforge | ||
uses: conda-incubator/setup-miniconda@v2.2.0 | ||
with: | ||
activate-environment: pygmt | ||
python-version: '3.11' | ||
channels: conda-forge,nodefaults | ||
channel-priority: strict | ||
miniforge-version: latest | ||
miniforge-variant: Mambaforge | ||
mamba-version: "*" | ||
run-post: false | ||
use-mamba: true | ||
|
||
# Install GMT and other required dependencies from conda-forge | ||
- name: Install dependencies | ||
run: | | ||
mamba install gmt=6.4.0 numpy \ | ||
pandas xarray netCDF4 packaging \ | ||
build make 'pytest>=6.0' \ | ||
pytest-cov pytest-doctestplus pytest-mpl sphinx-gallery \ | ||
contextily geopandas ipython rioxarray | ||
# Show installed pkg information for postmortem diagnostic | ||
- name: List installed packages | ||
run: mamba list | ||
|
||
# Download cached remote files (artifacts) from GitHub | ||
- name: Download remote data from GitHub | ||
uses: dawidd6/action-download-artifact@v2.26.0 | ||
with: | ||
workflow: cache_data.yaml | ||
workflow_conclusion: success | ||
name: gmt-cache | ||
path: .gmt | ||
|
||
# Move downloaded files to ~/.gmt directory and list them | ||
- name: Move and list downloaded remote files | ||
run: | | ||
mkdir -p ~/.gmt | ||
mv .gmt/* ~/.gmt | ||
# Change modification times of the two files, so GMT won't refresh it | ||
touch ~/.gmt/server/gmt_data_server.txt ~/.gmt/server/gmt_hash_server.txt | ||
ls -lhR ~/.gmt | ||
# Install the package that we want to test | ||
- name: Install the package | ||
run: make install | ||
|
||
# Run the doctests | ||
- name: Run doctests | ||
run: make doctest PYTEST_EXTRA="-r P" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters