From 4c0fd39327577c26f3e7b47c2e2a4b6029902ba0 Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Tue, 19 May 2020 21:52:52 +1200 Subject: [PATCH 01/39] Run Continuous Integration tests on Github Actions Signed-off-by: Wei Ji --- .github/workflows/ci_tests.yaml | 66 +++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/ci_tests.yaml diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml new file mode 100644 index 00000000000..e0cd6c9cc37 --- /dev/null +++ b/.github/workflows/ci_tests.yaml @@ -0,0 +1,66 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: PyGMT Tests + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + test: + name: ${{ matrix.os }} - Python ${{ matrix.python_version }} + runs-on: ${{ matrix.os }} + strategy: + max-parallel: 3 + matrix: + python_version: [3.7] + os: [ubuntu-latest, macOS-latest, windows-latest] + env: + LD_LIBRARY_PATH: ${{ github.workspace }}/gmt/lib:$LD_LIBRARY_PATH + GMT_LIBRARY_PATH: ${{ github.workspace }}/gmt/lib + + steps: + # Checkout current git repository + - name: Checkout + uses: actions/checkout@v2.1.0 + + # Setup Miniconda + - name: Setup Miniconda + uses: goanpeca/setup-miniconda@v1 + with: + python-version: ${{ matrix.python-version }} + channels: conda-forge + + # Install GMT and other required dependencies from conda-forge + - name: Install GMT and required dependencies + shell: bash -l {0} + run: conda install gmt=6.0.0 numpy pandas xarray netCDF4 packaging + + # Show installed pkg information for postmortem diagnostic + - name: List installed packages + shell: bash -l {0} + run: conda list + + # Set environment variables to make conda GMT work for Windows + - name: Set GMT environment variables for Windows + run: | + echo ::set-env name=GMT_LIBRARY_PATH::%CONDA_PREFIX%\Library\bin + echo ::set-env name=GMT_SHAREDIR::%CONDA_PREFIX%\Library\share\gmt + if: startsWith(matrix.os, 'windows') + + # Install the package that we want to test + - name: Install the package + shell: bash -l {0} + run: | + python setup.py sdist --formats=zip + pip install dist/* + + # Run the tests + - name: Test with pytest + shell: bash -l {0} + run: | + conda install make + make test PYTEST_EXTRA="-r P" From 31340ee7101b50cc5c1e981c48f9f6df700a68a9 Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Tue, 19 May 2020 22:11:41 +1200 Subject: [PATCH 02/39] Install make earlier Signed-off-by: Wei Ji --- .github/workflows/ci_tests.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index e0cd6c9cc37..b82a0a278a8 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -37,7 +37,7 @@ jobs: # Install GMT and other required dependencies from conda-forge - name: Install GMT and required dependencies shell: bash -l {0} - run: conda install gmt=6.0.0 numpy pandas xarray netCDF4 packaging + run: conda install gmt=6.0.0 numpy pandas xarray netCDF4 packaging make # Show installed pkg information for postmortem diagnostic - name: List installed packages @@ -61,6 +61,4 @@ jobs: # Run the tests - name: Test with pytest shell: bash -l {0} - run: | - conda install make - make test PYTEST_EXTRA="-r P" + run: make test PYTEST_EXTRA="-r P" From 9a4e7bc5fa0adb8982323fc446b2e74b6a980220 Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Wed, 20 May 2020 18:30:10 +1200 Subject: [PATCH 03/39] Set Linux/MacOS environment variables properly Signed-off-by: Wei Ji --- .github/workflows/ci_tests.yaml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index b82a0a278a8..b289eb1e542 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -18,9 +18,6 @@ jobs: matrix: python_version: [3.7] os: [ubuntu-latest, macOS-latest, windows-latest] - env: - LD_LIBRARY_PATH: ${{ github.workspace }}/gmt/lib:$LD_LIBRARY_PATH - GMT_LIBRARY_PATH: ${{ github.workspace }}/gmt/lib steps: # Checkout current git repository @@ -44,12 +41,19 @@ jobs: shell: bash -l {0} run: conda list - # Set environment variables to make conda GMT work for Windows + # Set environment variables for Linux/MacOS + - name: Set GMT environment variables for Linux/MacOS + run: | + echo ::set-env name=LD_LIBRARY_PATH/gmt/lib:$LD_LIBRARY_PATH + echo ::set-env name=GMT_LIBRARY_PATH/gmt/lib + if: matrix.os != 'windows-latest' + + # Set environment variables for Windows - name: Set GMT environment variables for Windows run: | echo ::set-env name=GMT_LIBRARY_PATH::%CONDA_PREFIX%\Library\bin echo ::set-env name=GMT_SHAREDIR::%CONDA_PREFIX%\Library\share\gmt - if: startsWith(matrix.os, 'windows') + if: matrix.os == 'windows-latest' # Install the package that we want to test - name: Install the package From 51472dc7eead27a2977ac1f481432f8f6aa6c75a Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Wed, 20 May 2020 18:31:14 +1200 Subject: [PATCH 04/39] Install pytest and other dev dependencies Signed-off-by: Wei Ji --- .github/workflows/ci_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index b289eb1e542..cf59ede02e4 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -34,7 +34,7 @@ jobs: # Install GMT and other required dependencies from conda-forge - name: Install GMT and required dependencies shell: bash -l {0} - run: conda install gmt=6.0.0 numpy pandas xarray netCDF4 packaging make + run: conda install gmt=6.0.0 numpy pandas xarray netCDF4 packaging make pytest pytest-cov pytest-mpl sphinx jinja2 docutils ipython # Show installed pkg information for postmortem diagnostic - name: List installed packages From 9c2e393dfcc80c6816ae80572b71eba1230ef3da Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Wed, 20 May 2020 18:32:01 +1200 Subject: [PATCH 05/39] Don't fail-fast and cancel all jobs See https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast Signed-off-by: Wei Ji --- .github/workflows/ci_tests.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index cf59ede02e4..e9591b7a445 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -15,6 +15,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: max-parallel: 3 + fail-fast: false matrix: python_version: [3.7] os: [ubuntu-latest, macOS-latest, windows-latest] From 2220702539f03e4b54c075346e616fec27a8737b Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Wed, 20 May 2020 19:14:47 +1200 Subject: [PATCH 06/39] Update setup-miniconda Github Action from v1 to v1.3.1 Signed-off-by: Wei Ji --- .github/workflows/ci_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index e9591b7a445..97b05d6ac44 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -27,7 +27,7 @@ jobs: # Setup Miniconda - name: Setup Miniconda - uses: goanpeca/setup-miniconda@v1 + uses: goanpeca/setup-miniconda@v1.3.1 with: python-version: ${{ matrix.python-version }} channels: conda-forge From 6936b3ced635b10254550448edbf85ae7692decf Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Thu, 21 May 2020 18:57:09 +1200 Subject: [PATCH 07/39] Don't set any environment variables for all OSes --- .github/workflows/ci_tests.yaml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 97b05d6ac44..974a0078709 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -42,20 +42,6 @@ jobs: shell: bash -l {0} run: conda list - # Set environment variables for Linux/MacOS - - name: Set GMT environment variables for Linux/MacOS - run: | - echo ::set-env name=LD_LIBRARY_PATH/gmt/lib:$LD_LIBRARY_PATH - echo ::set-env name=GMT_LIBRARY_PATH/gmt/lib - if: matrix.os != 'windows-latest' - - # Set environment variables for Windows - - name: Set GMT environment variables for Windows - run: | - echo ::set-env name=GMT_LIBRARY_PATH::%CONDA_PREFIX%\Library\bin - echo ::set-env name=GMT_SHAREDIR::%CONDA_PREFIX%\Library\share\gmt - if: matrix.os == 'windows-latest' - # Install the package that we want to test - name: Install the package shell: bash -l {0} From 6906426d92e13443685b0d909557eca8d340800e Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Fri, 5 Jun 2020 15:37:46 +1200 Subject: [PATCH 08/39] Cache GMT tutorial files in ${{ github.workspace }}/.gmt on 20200605 Try just caching ~/.gmt/cache and ~/.gmt/server. --- .github/workflows/ci_tests.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 974a0078709..4e77fe51bc0 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -42,6 +42,23 @@ jobs: shell: bash -l {0} run: conda list + # Cache the ${HOME}/.gmt directory, for docs and testing + - name: Cache GMT directory + uses: actions/cache@v2 + id: cache + with: + path: | + ${{ github.workspace }}/.gmt/cache + ${{ github.workspace }}/.gmt/server + key: cache-gmt-${{ github.ref }}-20200605-2 + restore-keys: cache-gmt-refs/heads/master- + + # Download remote files, if not already cached + - name: Download remote data + shell: bash -l {0} + run: gmt which -Gu @earth_relief_10m @earth_relief_60m @ridge.txt @Table_5_11.txt @tut_bathy.nc @tut_quakes.ngdc @tut_ship.xyz + if: steps.cache.outputs.cache-hit != 'true' + # Install the package that we want to test - name: Install the package shell: bash -l {0} From d2ce09b187426a5c81f47fc0e935064503d2b712 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Mon, 8 Jun 2020 09:41:31 +1200 Subject: [PATCH 09/39] Fix typo python_version to python-version Co-authored-by: Dongdong Tian --- .github/workflows/ci_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 4e77fe51bc0..91399131ced 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -17,7 +17,7 @@ jobs: max-parallel: 3 fail-fast: false matrix: - python_version: [3.7] + python-version: [3.7] os: [ubuntu-latest, macOS-latest, windows-latest] steps: From e40708161d0b009d151847fc8f23a6552fd98ea9 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 9 Jun 2020 00:49:31 -0400 Subject: [PATCH 10/39] Fix python_version to python-version --- .github/workflows/ci_tests.yaml | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 91399131ced..5e8a6defc3e 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -11,7 +11,7 @@ on: jobs: test: - name: ${{ matrix.os }} - Python ${{ matrix.python_version }} + name: ${{ matrix.os }} - Python ${{ matrix.python-version }} runs-on: ${{ matrix.os }} strategy: max-parallel: 3 @@ -48,16 +48,30 @@ jobs: id: cache with: path: | - ${{ github.workspace }}/.gmt/cache - ${{ github.workspace }}/.gmt/server - key: cache-gmt-${{ github.ref }}-20200605-2 + ~/.gmt/cache + ~/.gmt/server + key: cache-gmt-${{ runner.os }}-20200609 restore-keys: cache-gmt-refs/heads/master- + - name: Download remote data using wget (Linux & Windows) + shell: bash -l {0} + run: | + if [ "$RUNNER_OS" == "Windows" ]; then choco install wget; fi # install wget on Windows + mkdir ~/.gmt ~/.gmt/cache ~/.gmt/server + wget --no-check-certificate https://oceania.generic-mapping-tools.org/gmt_hash_server.txt -P ~/.gmt/server/ + for data in earth_relief_60m.grd earth_relief_30m.grd earth_relief_10m.grd; do + wget --no-check-certificate https://oceania.generic-mapping-tools.org/${data} -P ~/.gmt/server/ + done + for data in ridge.txt Table_5_11.txt tut_bathy.nc tut_quakes.ngdc tut_ship.xyz usgs_quakes_22.txt; do + wget --no-check-certificate https://oceania.generic-mapping-tools.org/cache/${data} -P ~/.gmt/cache/ + done + if: steps.cache.outputs.cache-hit != 'true' && runner.os != 'macOS' + # Download remote files, if not already cached - - name: Download remote data + - name: Download remote data (macOS) shell: bash -l {0} - run: gmt which -Gu @earth_relief_10m @earth_relief_60m @ridge.txt @Table_5_11.txt @tut_bathy.nc @tut_quakes.ngdc @tut_ship.xyz - if: steps.cache.outputs.cache-hit != 'true' + run: gmt which -Gu @earth_relief_60m @earth_relief_30m @earth_relief_10m @ridge.txt @Table_5_11.txt @tut_bathy.nc @tut_quakes.ngdc @tut_ship.xyz @usgs_quakes_22.txt + if: steps.cache.outputs.cache-hit != 'true' && runner.os == 'macOS' # Install the package that we want to test - name: Install the package From 841f937aa60eddb718178ec06748c405bc691fd9 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Wed, 10 Jun 2020 01:53:40 -0400 Subject: [PATCH 11/39] Disable tests to enable caches --- .github/workflows/ci_tests.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 5e8a6defc3e..05b1889a3b7 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -81,6 +81,6 @@ jobs: pip install dist/* # Run the tests - - name: Test with pytest - shell: bash -l {0} - run: make test PYTEST_EXTRA="-r P" + #- name: Test with pytest + # shell: bash -l {0} + # run: make test PYTEST_EXTRA="-r P" From 9fd73f0a6439cd1fdba4ddb650549bda59328a99 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Wed, 10 Jun 2020 02:50:28 -0400 Subject: [PATCH 12/39] Re-enable tests to check caches --- .github/workflows/ci_tests.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 05b1889a3b7..5e8a6defc3e 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -81,6 +81,6 @@ jobs: pip install dist/* # Run the tests - #- name: Test with pytest - # shell: bash -l {0} - # run: make test PYTEST_EXTRA="-r P" + - name: Test with pytest + shell: bash -l {0} + run: make test PYTEST_EXTRA="-r P" From 1a23b55fc39c56e5f2fb28802a4267961a9e7b93 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Wed, 10 Jun 2020 11:12:06 -0400 Subject: [PATCH 13/39] Change github action name --- .github/workflows/ci_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 5e8a6defc3e..ea0a57c23a2 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -1,7 +1,7 @@ # This workflow will install Python dependencies, run tests and lint with a single version of Python # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions -name: PyGMT Tests +name: Tests on: push: From 0ba3d7e42993c3598ccf0142331ea190aec64513 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Wed, 10 Jun 2020 11:12:36 -0400 Subject: [PATCH 14/39] Simplify job name --- .github/workflows/ci_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index ea0a57c23a2..837536f4c31 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -11,7 +11,7 @@ on: jobs: test: - name: ${{ matrix.os }} - Python ${{ matrix.python-version }} + name: ${{ runner.os }} - Python ${{ matrix.python-version }} runs-on: ${{ matrix.os }} strategy: max-parallel: 3 From c744db9670b1649b2046bcc1c218a2c19d2b8f13 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Wed, 10 Jun 2020 11:15:10 -0400 Subject: [PATCH 15/39] The versioneer pacakge need tags to determine the PyGMT version --- .github/workflows/ci_tests.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 837536f4c31..9a83a361fdc 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -25,6 +25,10 @@ jobs: - name: Checkout uses: actions/checkout@v2.1.0 + # See https://github.com/warner/python-versioneer/issues/206 + - name: Fetch all history for all tags and branches + run: git fetch --prune --unshallow + # Setup Miniconda - name: Setup Miniconda uses: goanpeca/setup-miniconda@v1.3.1 From 3a06afca6b53bae0b7e90ecf46e66b121e366b36 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Wed, 10 Jun 2020 11:43:58 -0400 Subject: [PATCH 16/39] Change runner.os to matrix.os --- .github/workflows/ci_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 9a83a361fdc..999d6dab2fc 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -11,7 +11,7 @@ on: jobs: test: - name: ${{ runner.os }} - Python ${{ matrix.python-version }} + name: ${{ matrix.os }} - Python ${{ matrix.python-version }} runs-on: ${{ matrix.os }} strategy: max-parallel: 3 From 05c225f380be5a8e545c7945baa7190563ac2d38 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Wed, 10 Jun 2020 11:58:39 -0400 Subject: [PATCH 17/39] Improve the docs --- .github/workflows/ci_tests.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 999d6dab2fc..e37af9b1ee6 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -14,7 +14,6 @@ jobs: name: ${{ matrix.os }} - Python ${{ matrix.python-version }} runs-on: ${{ matrix.os }} strategy: - max-parallel: 3 fail-fast: false matrix: python-version: [3.7] @@ -25,7 +24,7 @@ jobs: - name: Checkout uses: actions/checkout@v2.1.0 - # See https://github.com/warner/python-versioneer/issues/206 + # Workaround for versioneer, see https://github.com/warner/python-versioneer/issues/206 - name: Fetch all history for all tags and branches run: git fetch --prune --unshallow @@ -57,6 +56,7 @@ jobs: key: cache-gmt-${{ runner.os }}-20200609 restore-keys: cache-gmt-refs/heads/master- + # Workaround for the timeouts of 'gmt which' on Linux and Windows - name: Download remote data using wget (Linux & Windows) shell: bash -l {0} run: | From 8bd8a6663a2394df624f41df1dd29919cf5d99d3 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Wed, 10 Jun 2020 12:02:49 -0400 Subject: [PATCH 18/39] Add a cron job for daily tests --- .github/workflows/ci_tests.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index e37af9b1ee6..5bf72145445 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -8,6 +8,9 @@ on: branches: [ master ] pull_request: branches: [ master ] + # Schedule daily tests + schedule: + - cron: '0 0 * * *' jobs: test: From c12cfffa50815836daedd60fc4c786c888a2c207 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sun, 28 Jun 2020 22:58:42 -0400 Subject: [PATCH 19/39] Change earth_relief_60m to earth_relief_01d --- .github/workflows/ci_tests.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 5bf72145445..75e255106a1 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -66,7 +66,7 @@ jobs: if [ "$RUNNER_OS" == "Windows" ]; then choco install wget; fi # install wget on Windows mkdir ~/.gmt ~/.gmt/cache ~/.gmt/server wget --no-check-certificate https://oceania.generic-mapping-tools.org/gmt_hash_server.txt -P ~/.gmt/server/ - for data in earth_relief_60m.grd earth_relief_30m.grd earth_relief_10m.grd; do + for data in earth_relief_01d.grd earth_relief_30m.grd earth_relief_10m.grd; do wget --no-check-certificate https://oceania.generic-mapping-tools.org/${data} -P ~/.gmt/server/ done for data in ridge.txt Table_5_11.txt tut_bathy.nc tut_quakes.ngdc tut_ship.xyz usgs_quakes_22.txt; do @@ -77,7 +77,7 @@ jobs: # Download remote files, if not already cached - name: Download remote data (macOS) shell: bash -l {0} - run: gmt which -Gu @earth_relief_60m @earth_relief_30m @earth_relief_10m @ridge.txt @Table_5_11.txt @tut_bathy.nc @tut_quakes.ngdc @tut_ship.xyz @usgs_quakes_22.txt + run: gmt which -Gu @earth_relief_01d @earth_relief_30m @earth_relief_10m @ridge.txt @Table_5_11.txt @tut_bathy.nc @tut_quakes.ngdc @tut_ship.xyz @usgs_quakes_22.txt if: steps.cache.outputs.cache-hit != 'true' && runner.os == 'macOS' # Install the package that we want to test From 9179bc265880f079882a15ea1dbe8e2247180d8a Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sun, 28 Jun 2020 23:31:17 -0400 Subject: [PATCH 20/39] Let conda install packages listed in requirements.txt --- .github/workflows/ci_tests.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 75e255106a1..99f036a3f04 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -41,7 +41,10 @@ jobs: # Install GMT and other required dependencies from conda-forge - name: Install GMT and required dependencies shell: bash -l {0} - run: conda install gmt=6.0.0 numpy pandas xarray netCDF4 packaging make pytest pytest-cov pytest-mpl sphinx jinja2 docutils ipython + run: | + conda install --yes --file requirements.txt + conda install --yes --file requirements-dev.txt + conda install gmt=6.0.0 make # Show installed pkg information for postmortem diagnostic - name: List installed packages From 8662be01c35f64c9309c2a23356f3c6dd4552a60 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 29 Jun 2020 00:40:56 -0400 Subject: [PATCH 21/39] Single conda command to install all packages --- .github/workflows/ci_tests.yaml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 99f036a3f04..c516b1a800f 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -42,9 +42,13 @@ jobs: - name: Install GMT and required dependencies shell: bash -l {0} run: | - conda install --yes --file requirements.txt - conda install --yes --file requirements-dev.txt - conda install gmt=6.0.0 make + requirements_file=full-conda-requirements.txt + cat requirements.txt requirements-dev.txt > $requirements_file + cat << EOF >> $requirements_file + gmt=6.0.0 + make + EOF + conda install --yes --file $requirements_file # Show installed pkg information for postmortem diagnostic - name: List installed packages From a806efadbe52e940a9ffc097da31a1f76c9a39a0 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 29 Jun 2020 18:04:38 -0400 Subject: [PATCH 22/39] Add github.ref to the cache key Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> --- .github/workflows/ci_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index c516b1a800f..3003d94ed8d 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -63,7 +63,7 @@ jobs: path: | ~/.gmt/cache ~/.gmt/server - key: cache-gmt-${{ runner.os }}-20200609 + key: cache-gmt-${{ github.ref }}-${{ runner.os }}-20200609 restore-keys: cache-gmt-refs/heads/master- # Workaround for the timeouts of 'gmt which' on Linux and Windows From 895e87109853b5fd93192f838ddcb29d6a835c66 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 29 Jun 2020 18:26:09 -0400 Subject: [PATCH 23/39] Disable the cache temporarily to cache the GMT files --- .github/workflows/ci_tests.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 3003d94ed8d..d3660b1cf26 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -95,6 +95,6 @@ jobs: pip install dist/* # Run the tests - - name: Test with pytest - shell: bash -l {0} - run: make test PYTEST_EXTRA="-r P" + #- name: Test with pytest + # shell: bash -l {0} + # run: make test PYTEST_EXTRA="-r P" From e0c79e6c2056f71bd8415bd9fcaaad3326d223a9 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 29 Jun 2020 18:47:02 -0400 Subject: [PATCH 24/39] Enable tests again --- .github/workflows/ci_tests.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index d3660b1cf26..3003d94ed8d 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -95,6 +95,6 @@ jobs: pip install dist/* # Run the tests - #- name: Test with pytest - # shell: bash -l {0} - # run: make test PYTEST_EXTRA="-r P" + - name: Test with pytest + shell: bash -l {0} + run: make test PYTEST_EXTRA="-r P" From 4d271c0d1d804fef75dc8d4fc250690c48aa17b4 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 29 Jun 2020 19:12:53 -0400 Subject: [PATCH 25/39] Set fetch-depth to 0 --- .github/workflows/ci_tests.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 3003d94ed8d..54b4d4ed208 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -25,11 +25,14 @@ jobs: steps: # Checkout current git repository - name: Checkout - uses: actions/checkout@v2.1.0 + uses: actions/checkout@v2.3.1 + with: + # fecth all history so that versioneer works + fetch-depth: 0 # Workaround for versioneer, see https://github.com/warner/python-versioneer/issues/206 - - name: Fetch all history for all tags and branches - run: git fetch --prune --unshallow + #- name: Fetch all history for all tags and branches + # run: git fetch --prune --unshallow # Setup Miniconda - name: Setup Miniconda From 0c1ba7162819093876f44298770608683cbb4c3e Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 29 Jun 2020 19:42:48 -0400 Subject: [PATCH 26/39] Create an environment using environment.yml --- .github/workflows/ci_tests.yaml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 54b4d4ed208..25f39a82ef6 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -30,16 +30,13 @@ jobs: # fecth all history so that versioneer works fetch-depth: 0 - # Workaround for versioneer, see https://github.com/warner/python-versioneer/issues/206 - #- name: Fetch all history for all tags and branches - # run: git fetch --prune --unshallow - # Setup Miniconda - name: Setup Miniconda - uses: goanpeca/setup-miniconda@v1.3.1 + uses: goanpeca/setup-miniconda@v1.6.0 with: python-version: ${{ matrix.python-version }} channels: conda-forge + environment-file: environment.yml # Install GMT and other required dependencies from conda-forge - name: Install GMT and required dependencies From 80c650891e1ab605028770f6549b091147ca1acf Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 29 Jun 2020 19:51:41 -0400 Subject: [PATCH 27/39] Still slow using environment.yml --- .github/workflows/ci_tests.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 25f39a82ef6..dc291ae343a 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -36,7 +36,6 @@ jobs: with: python-version: ${{ matrix.python-version }} channels: conda-forge - environment-file: environment.yml # Install GMT and other required dependencies from conda-forge - name: Install GMT and required dependencies From bf2126f0c721f1de80b8643b3cb8e8cae2e39223 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 29 Jun 2020 22:12:58 -0400 Subject: [PATCH 28/39] Cache conda packages --- .github/workflows/ci_tests.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index dc291ae343a..20478f6ad49 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -30,12 +30,21 @@ jobs: # fecth all history so that versioneer works fetch-depth: 0 + - name: Cache conda packages + uses: actions/cache@v2 + with: + path: ${CONDA_PKGS_DIRS} + key: cache-conda-${{ github.ref }}-${{ hashFiles('environment.yml') }} + restore-keys: | + cache-conda-refs/heads/master- + # Setup Miniconda - name: Setup Miniconda uses: goanpeca/setup-miniconda@v1.6.0 with: python-version: ${{ matrix.python-version }} channels: conda-forge + use-only-tar-bz2: true # required for caching conda pacakges # Install GMT and other required dependencies from conda-forge - name: Install GMT and required dependencies From 9c977229452cb4c3604a27b270351e7ed7d86bcc Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 29 Jun 2020 22:20:11 -0400 Subject: [PATCH 29/39] Disable tests to cache conda packages --- .github/workflows/ci_tests.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 20478f6ad49..8061ee2d36f 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -103,6 +103,6 @@ jobs: pip install dist/* # Run the tests - - name: Test with pytest - shell: bash -l {0} - run: make test PYTEST_EXTRA="-r P" + #- name: Test with pytest + # shell: bash -l {0} + # run: make test PYTEST_EXTRA="-r P" From 37f2a533a57ca421db87fd8736bcee6914f15d3c Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 29 Jun 2020 22:33:51 -0400 Subject: [PATCH 30/39] Update cache keys --- .github/workflows/ci_tests.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 8061ee2d36f..236591ab8c3 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -33,8 +33,8 @@ jobs: - name: Cache conda packages uses: actions/cache@v2 with: - path: ${CONDA_PKGS_DIRS} - key: cache-conda-${{ github.ref }}-${{ hashFiles('environment.yml') }} + path: ~/conda_pkgs_dir + key: cache-conda-${{ github.ref }}-${{ runner.os }}-${{ hashFiles('environment.yml') }} restore-keys: | cache-conda-refs/heads/master- From 8ff30d995428f58ff15e50b607d3c0e8c0cb3b32 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 29 Jun 2020 22:49:07 -0400 Subject: [PATCH 31/39] Enable tests --- .github/workflows/ci_tests.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 236591ab8c3..320836e8b54 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -103,6 +103,6 @@ jobs: pip install dist/* # Run the tests - #- name: Test with pytest - # shell: bash -l {0} - # run: make test PYTEST_EXTRA="-r P" + - name: Test with pytest + shell: bash -l {0} + run: make test PYTEST_EXTRA="-r P" From 1b947d3fde42cbe99988cf341f26e88418399640 Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Tue, 7 Jul 2020 15:18:49 +1200 Subject: [PATCH 32/39] Run Github Actions CI tests on GMT 6.1.0 --- .github/workflows/ci_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 320836e8b54..e0af3bb2890 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -53,7 +53,7 @@ jobs: requirements_file=full-conda-requirements.txt cat requirements.txt requirements-dev.txt > $requirements_file cat << EOF >> $requirements_file - gmt=6.0.0 + gmt=6.1.0 make EOF conda install --yes --file $requirements_file From 098e03d57d883465a9697dc9be459efbb9fde74a Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Tue, 7 Jul 2020 15:18:49 +1200 Subject: [PATCH 33/39] Revert "Run Github Actions CI tests on GMT 6.1.0" This reverts commit 1b947d3fde42cbe99988cf341f26e88418399640. --- .github/workflows/ci_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index e0af3bb2890..320836e8b54 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -53,7 +53,7 @@ jobs: requirements_file=full-conda-requirements.txt cat requirements.txt requirements-dev.txt > $requirements_file cat << EOF >> $requirements_file - gmt=6.1.0 + gmt=6.0.0 make EOF conda install --yes --file $requirements_file From b4c7492da481162c2bbdfb5b88b4268b2dafb592 Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Fri, 10 Jul 2020 11:06:24 +1200 Subject: [PATCH 34/39] Disable Azure Pipeline CI on Windows and macOS, but keep Style Checks on --- .azure-pipelines.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index c6321616124..d42a13291d4 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -69,6 +69,7 @@ jobs: ######################################################################################## - job: displayName: 'Mac' + condition: False pool: vmImage: 'macOS-10.14' @@ -171,6 +172,7 @@ jobs: ######################################################################################## - job: displayName: 'Windows' + condition: False pool: vmImage: 'vs2017-win2016' From b6445d0e35367d7d81d992cadee28e7fb175b7a9 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 9 Jul 2020 19:18:17 -0400 Subject: [PATCH 35/39] Do not cache the conda packages --- .github/workflows/ci_tests.yaml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 320836e8b54..dc291ae343a 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -30,21 +30,12 @@ jobs: # fecth all history so that versioneer works fetch-depth: 0 - - name: Cache conda packages - uses: actions/cache@v2 - with: - path: ~/conda_pkgs_dir - key: cache-conda-${{ github.ref }}-${{ runner.os }}-${{ hashFiles('environment.yml') }} - restore-keys: | - cache-conda-refs/heads/master- - # Setup Miniconda - name: Setup Miniconda uses: goanpeca/setup-miniconda@v1.6.0 with: python-version: ${{ matrix.python-version }} channels: conda-forge - use-only-tar-bz2: true # required for caching conda pacakges # Install GMT and other required dependencies from conda-forge - name: Install GMT and required dependencies From b731f0ca25cb22fc820975f63954236610534945 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 9 Jul 2020 20:15:14 -0400 Subject: [PATCH 36/39] Add the status badge to README --- README.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.rst b/README.rst index f20a8d9d59a..8f641844fc2 100644 --- a/README.rst +++ b/README.rst @@ -15,6 +15,9 @@ PyGMT .. image:: https://img.shields.io/azure-devops/build/GenericMappingTools/7682ad4e-76bb-4775-849e-7c4f8dce4e1a/3/master.svg?label=Mac|Windows&style=flat-square :alt: Azure Pipelines build status :target: https://dev.azure.com/GenericMappingTools/PyGMT/_build +.. image:: https://github.com/GenericMappingTools/pygmt/workflows/Tests/badge.svg + :alt: GitHub Actions build status + :target: https://github.com/GenericMappingTools/pygmt/actions .. 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 From 5b654556bab11e06025a7743ea3483200a218da1 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 9 Jul 2020 20:15:40 -0400 Subject: [PATCH 37/39] Test Python 3.6-3.8 --- .github/workflows/ci_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index dc291ae343a..5fc21a87be6 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.7] + python-version: [3.6, 3.7, 3.8] os: [ubuntu-latest, macOS-latest, windows-latest] steps: From 36fa209a3be695663639b08224e888e1f43cc469 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 9 Jul 2020 20:36:05 -0400 Subject: [PATCH 38/39] Let the github actions run in all PRs --- .github/workflows/ci_tests.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 5fc21a87be6..9f40a29fb7a 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -7,7 +7,6 @@ on: push: branches: [ master ] pull_request: - branches: [ master ] # Schedule daily tests schedule: - cron: '0 0 * * *' From a5af2dc5ecca2a02dc8bacb24f8d55d56c330e4f Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 9 Jul 2020 21:22:31 -0400 Subject: [PATCH 39/39] Use PYTEST_EXTRA in Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 97e93bcfbda..a861f3e409e 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # Build, package, test, and clean PROJECT=pygmt TESTDIR=tmp-test-dir-with-unique-name -PYTEST_ARGS=--cov-config=../.coveragerc --cov-report=term-missing --cov=$(PROJECT) --doctest-modules -v --mpl --mpl-results-path=results --pyargs +PYTEST_ARGS=--cov-config=../.coveragerc --cov-report=term-missing --cov=$(PROJECT) --doctest-modules -v --mpl --mpl-results-path=results --pyargs ${PYTEST_EXTRA} BLACK_FILES=$(PROJECT) setup.py doc/conf.py examples FLAKE8_FILES=$(PROJECT) setup.py LINT_FILES=$(PROJECT) setup.py