CI: Add a script to create environment.yml file dynamically for GitHub Actions and ReadTheDocs #61
Workflow file for this run
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
# Run all doctests on Linux/macOS/Windows | |
# | |
# This workflow runs all PyGMT doctests. It is scheduled to run weekly every | |
# Sunday. | |
# | |
name: Doctests | |
on: | |
# push: | |
# branches: [ main ] | |
pull_request: | |
# Schedule weekly tests on Sunday | |
schedule: | |
- cron: '0 0 * * 0' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
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: | |
# Checkout current git repository | |
- name: Checkout | |
uses: actions/checkout@v4.1.1 | |
with: | |
# fetch all history so that setuptools-scm works | |
fetch-depth: 0 | |
- name: Make an environment.yml file | |
run: bash ci/make_environment.sh doctests | tee ci/environment.yml | |
# Install Micromamba with conda-forge dependencies | |
- name: Setup Micromamba | |
uses: mamba-org/setup-micromamba@v1.6.0 | |
with: | |
environment-file: ci/environment.yml | |
# Download cached remote files (artifacts) from GitHub | |
- name: Download remote data from GitHub | |
uses: dawidd6/action-download-artifact@v2.28.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" |