-
Notifications
You must be signed in to change notification settings - Fork 216
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
CI: Add the "Doctests" workflow to run doctests weekly #2456
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
adbb19d
Do not run the full tests in the Tests workflow
seisman 9f4a136
Add a new workflow to run doctests weekly
seisman d4d3aba
Temporarily enable the workflow in PR
seisman 63d28d4
Update the workflow
seisman 952456b
Add the workflow information to maintainers guides
seisman f904987
Merge branch 'main' into workflow-doctests
seisman da5535b
Add rioxarray
seisman d03048f
Merge branch 'main' into workflow-doctests
seisman 8e0acfc
Merge branch 'main' into workflow-doctests
seisman 142add7
Python 3.8 is no longer supported
seisman 5946fd4
Merge branch 'main' into workflow-doctests
seisman f17b57c
Only run on Python 3.11
seisman d1344cd
Doctests don't produce any diff images
seisman 8ac89f2
matrix.numpy-version is not defined and fix a typo
seisman eea0b4a
Disable the workflow in PR and fix a typo
seisman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Off-topic question: Currently, we're documenting what a workflow does in the maintainers' guide, but it's very likely that we may forget to update the guides when we make changes to a workflow.
Perhaps we should only keep a short, one-sentence description for each workflow in the maintainers' guide and put a much longer description in the workflow file.
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.
Ping @GenericMappingTools/pygmt-maintainers for comments on this.
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.
Maybe have a README.md under https://github.com/GenericMappingTools/pygmt/tree/v0.9.0/.github/workflows to document, so that people looking at the folder can see what the *.yml files are for? Also fine with including it in the YAML file since that will be more visible.
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'm inclined to this option because (1) we won't forget to update the workflow descriptions; (2) the workflows are more self-explanatory.
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, so just document things in the YAML files and remove the descriptions from the doc/maintenance.md file. Can do this in another PR once this one is merged.