|
| 1 | +# This workflow installs PyGMT and runs tests |
| 2 | + |
| 3 | +name: GMT Backward Tests |
| 4 | + |
| 5 | +on: |
| 6 | + # push: |
| 7 | + # branches: [ main ] |
| 8 | + pull_request: |
| 9 | + # types: [ready_for_review] |
| 10 | + paths-ignore: |
| 11 | + - 'doc/**' |
| 12 | + - 'examples/**' |
| 13 | + - '*.md' |
| 14 | + - 'README.rst' |
| 15 | + - 'LICENSE.txt' |
| 16 | + - '.gitignore' |
| 17 | + # Schedule tests on Monday/Wednesday/Friday |
| 18 | + schedule: |
| 19 | + - cron: '0 0 * * 1,3,5' |
| 20 | + |
| 21 | +jobs: |
| 22 | + test: |
| 23 | + name: ${{ matrix.os }} - GMT ${{ matrix.gmt_version }} |
| 24 | + runs-on: ${{ matrix.os }} |
| 25 | + strategy: |
| 26 | + fail-fast: false |
| 27 | + matrix: |
| 28 | + python-version: ['3.10'] |
| 29 | + os: [ubuntu-latest, macOS-latest, windows-latest] |
| 30 | + gmt_version: ['6.3'] |
| 31 | + timeout-minutes: 30 |
| 32 | + defaults: |
| 33 | + run: |
| 34 | + shell: bash -l {0} |
| 35 | + |
| 36 | + steps: |
| 37 | + # Cancel previous runs that are not completed |
| 38 | + - name: Cancel Previous Runs |
| 39 | + |
| 40 | + with: |
| 41 | + access_token: ${{ github.token }} |
| 42 | + |
| 43 | + # Checkout current git repository |
| 44 | + - name: Checkout |
| 45 | + |
| 46 | + with: |
| 47 | + # fetch all history so that setuptools-scm works |
| 48 | + fetch-depth: 0 |
| 49 | + |
| 50 | + # Install Mambaforge with conda-forge dependencies |
| 51 | + - name: Setup Mambaforge |
| 52 | + uses: conda-incubator/[email protected] |
| 53 | + with: |
| 54 | + activate-environment: pygmt |
| 55 | + python-version: ${{ matrix.python-version }} |
| 56 | + channels: conda-forge,nodefaults |
| 57 | + channel-priority: strict |
| 58 | + miniforge-version: latest |
| 59 | + miniforge-variant: Mambaforge |
| 60 | + mamba-version: "*" |
| 61 | + use-mamba: true |
| 62 | + |
| 63 | + # Install GMT and other required dependencies from conda-forge |
| 64 | + - name: Install dependencies |
| 65 | + run: | |
| 66 | + mamba install gmt=${{ matrix.gmt_version }} numpy \ |
| 67 | + pandas xarray netCDF4 packaging geopandas \ |
| 68 | + build dvc make pytest>=6.0 \ |
| 69 | + pytest-cov pytest-doctestplus pytest-mpl sphinx-gallery |
| 70 | +
|
| 71 | + # Show installed pkg information for postmortem diagnostic |
| 72 | + - name: List installed packages |
| 73 | + run: mamba list |
| 74 | + |
| 75 | + # Download cached remote files (artifacts) from GitHub |
| 76 | + - name: Download remote data from GitHub |
| 77 | + |
| 78 | + with: |
| 79 | + workflow: cache_data.yaml |
| 80 | + workflow_conclusion: success |
| 81 | + name: gmt-cache |
| 82 | + path: .gmt |
| 83 | + |
| 84 | + # Move downloaded files to ~/.gmt directory and list them |
| 85 | + - name: Move and list downloaded remote files |
| 86 | + run: | |
| 87 | + mkdir -p ~/.gmt |
| 88 | + mv .gmt/* ~/.gmt |
| 89 | + # Change modification times of the two files, so GMT won't refresh it |
| 90 | + touch ~/.gmt/server/gmt_data_server.txt ~/.gmt/server/gmt_hash_server.txt |
| 91 | + ls -lhR ~/.gmt |
| 92 | +
|
| 93 | + # Pull baseline image data from dvc remote (DAGsHub) |
| 94 | + - name: Pull baseline image data from dvc remote |
| 95 | + run: | |
| 96 | + dvc pull --verbose |
| 97 | + ls -lhR pygmt/tests/baseline/ |
| 98 | +
|
| 99 | + # Install the package that we want to test |
| 100 | + - name: Install the package |
| 101 | + run: make install |
| 102 | + |
| 103 | + # Run the tests but skip images |
| 104 | + - name: Run tests |
| 105 | + run: make test_no_images PYTEST_EXTRA="-r P" |
0 commit comments