From 185a8c673f1e4c697dfddbbc86ecb3ba1a07a275 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Fri, 10 Jul 2020 22:02:16 -0400 Subject: [PATCH 1/7] Run style checks in GitHub Actions Also remove Azure Pipelines. --- .azure-pipelines.yml | 65 ------------------------------ .github/workflows/style_check.yaml | 39 ++++++++++++++++++ README.rst | 6 +-- 3 files changed, 42 insertions(+), 68 deletions(-) delete mode 100644 .azure-pipelines.yml create mode 100644 .github/workflows/style_check.yaml diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml deleted file mode 100644 index c7bc5fd885f..00000000000 --- a/.azure-pipelines.yml +++ /dev/null @@ -1,65 +0,0 @@ -# Configuration for Azure Pipelines -######################################################################################## - -# Only build the master branch, tags, and PRs (on by default) to avoid building random -# branches in the repository until a PR is opened. -trigger: - branches: - include: - - master - - refs/tags/* - - -jobs: - -# Linux -######################################################################################## -- job: - displayName: 'Style Checks' - - pool: - vmImage: 'ubuntu-16.04' - - variables: - CONDA_INSTALL_EXTRA: "black flake8 pylint" - PYTHON: '3.7' - - steps: - - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.7' - - - bash: echo "##vso[task.prependpath]/usr/share/miniconda/bin" - displayName: Add conda to PATH - - # Get the Fatiando CI scripts - - bash: git clone --branch=1.2.0 --depth=1 https://github.com/fatiando/continuous-integration.git - displayName: Fetch the Fatiando CI scripts - - # Setup dependencies and build a conda environment - - bash: source continuous-integration/azure/setup-miniconda.sh - displayName: Setup Miniconda - - # Show installed pkg information for postmortem diagnostic - - bash: | - set -x -e - source activate testing - conda list - displayName: List installed packages - - # Check that the code passes format checks - - bash: | - set -x -e - source activate testing - make check - displayName: Formatting check (black and flake8) - condition: succeededOrFailed() - - # Check that the code passes linting checks - - bash: | - set -x -e - source activate testing - make lint - displayName: Linting (pylint) - condition: succeededOrFailed() diff --git a/.github/workflows/style_check.yaml b/.github/workflows/style_check.yaml new file mode 100644 index 00000000000..249a4c55abc --- /dev/null +++ b/.github/workflows/style_check.yaml @@ -0,0 +1,39 @@ +name: Style Checks + +on: + push: + branches: [ master ] + pull_request: + +jobs: + style_check: + name: Style Checks + runs-on: ubuntu-latest + + steps: + # Checkout current git repository + - name: Checkout + uses: actions/checkout@v2.3.1 + + # Setup Miniconda + - name: Setup Miniconda + uses: goanpeca/setup-miniconda@v1.6.0 + with: + python-version: 3.7 + channels: conda-forge + + - name: Install packages + shell: bash -l {0} + run: conda install --yes black flake8 pylint + + - name: List installed packages + shell: bash -l {0} + run: conda list + + - name: Formatting check (black and flake8) + shell: bash -l {0} + run: make check + + - name: Linting (pylint) + shell: bash -l {0} + run: make lint diff --git a/README.rst b/README.rst index 8f641844fc2..a0cad43583b 100644 --- a/README.rst +++ b/README.rst @@ -12,9 +12,9 @@ PyGMT .. image:: http://img.shields.io/travis/GenericMappingTools/pygmt/master.svg?style=flat-square&label=Linux :alt: Travis CI build status :target: https://travis-ci.org/GenericMappingTools/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/Style%20Checks/badge.svg + :alt: GitHub Actions Style Checks + :target: https://github.com/GenericMappingTools/pygmt/actions .. image:: https://github.com/GenericMappingTools/pygmt/workflows/Tests/badge.svg :alt: GitHub Actions build status :target: https://github.com/GenericMappingTools/pygmt/actions From 1a8031155be35ad547e8057d275a31eb76662480 Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Sun, 12 Jul 2020 18:40:36 +1200 Subject: [PATCH 2/7] Update Continuous Integration maintenance note to include GH Actions --- MAINTENANCE.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/MAINTENANCE.md b/MAINTENANCE.md index a0b1a86ca2b..c1ef4915959 100644 --- a/MAINTENANCE.md +++ b/MAINTENANCE.md @@ -40,10 +40,11 @@ The main advantages of this are: ## Continuous Integration -We use TravisCI continuous integration (CI) services to build and test the -project on Linux, and Mac (Windows is still a work in progress). -The configuration file for this service is `.travis.yml`. -It relies on the `requirements.txt` file to install the required dependencies using +We use Github Actions and TravisCI continuous integration (CI) services to +build and test the project on Linux, macOS and Windows. +The configuration file for these services are in +`.github/workflows/ci_tests.yaml` and `.travis.yml`. +They rely on the `requirements.txt` file to install required dependencies using conda and the `Makefile` to run the tests and checks. Travis also handles all of our deployments automatically: From 0b77a1971f4f2898005bbe137d4665575bc8992f Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Sun, 12 Jul 2020 18:54:24 +1200 Subject: [PATCH 3/7] Remove Style Checks badge from README.rst --- README.rst | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.rst b/README.rst index a0cad43583b..7d399e37489 100644 --- a/README.rst +++ b/README.rst @@ -12,9 +12,6 @@ PyGMT .. image:: http://img.shields.io/travis/GenericMappingTools/pygmt/master.svg?style=flat-square&label=Linux :alt: Travis CI build status :target: https://travis-ci.org/GenericMappingTools/pygmt -.. image:: https://github.com/GenericMappingTools/pygmt/workflows/Style%20Checks/badge.svg - :alt: GitHub Actions Style Checks - :target: https://github.com/GenericMappingTools/pygmt/actions .. image:: https://github.com/GenericMappingTools/pygmt/workflows/Tests/badge.svg :alt: GitHub Actions build status :target: https://github.com/GenericMappingTools/pygmt/actions From 7040eb1f4cfa51c1c93fb0aa14cf8fd7cf4780a2 Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Sun, 12 Jul 2020 19:11:03 +1200 Subject: [PATCH 4/7] Move style checks job into ci_tests.yaml --- .github/workflows/ci_tests.yaml | 32 ++++++++++++++++++++++++ .github/workflows/style_check.yaml | 39 ------------------------------ 2 files changed, 32 insertions(+), 39 deletions(-) delete mode 100644 .github/workflows/style_check.yaml diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index b019487edf2..d5bf5a69b5f 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -12,6 +12,38 @@ on: - cron: '0 0 * * *' jobs: + style_check: + name: Style Checks + runs-on: ubuntu-latest + + steps: + # Checkout current git repository + - name: Checkout + uses: actions/checkout@v2.3.1 + + # Setup Miniconda + - name: Setup Miniconda + uses: goanpeca/setup-miniconda@v1.6.0 + with: + python-version: 3.7 + channels: conda-forge + + - name: Install packages + shell: bash -l {0} + run: conda install --yes black flake8 pylint + + - name: List installed packages + shell: bash -l {0} + run: conda list + + - name: Formatting check (black and flake8) + shell: bash -l {0} + run: make check + + - name: Linting (pylint) + shell: bash -l {0} + run: make lint + test: name: ${{ matrix.os }} - Python ${{ matrix.python-version }} runs-on: ${{ matrix.os }} diff --git a/.github/workflows/style_check.yaml b/.github/workflows/style_check.yaml deleted file mode 100644 index 249a4c55abc..00000000000 --- a/.github/workflows/style_check.yaml +++ /dev/null @@ -1,39 +0,0 @@ -name: Style Checks - -on: - push: - branches: [ master ] - pull_request: - -jobs: - style_check: - name: Style Checks - runs-on: ubuntu-latest - - steps: - # Checkout current git repository - - name: Checkout - uses: actions/checkout@v2.3.1 - - # Setup Miniconda - - name: Setup Miniconda - uses: goanpeca/setup-miniconda@v1.6.0 - with: - python-version: 3.7 - channels: conda-forge - - - name: Install packages - shell: bash -l {0} - run: conda install --yes black flake8 pylint - - - name: List installed packages - shell: bash -l {0} - run: conda list - - - name: Formatting check (black and flake8) - shell: bash -l {0} - run: make check - - - name: Linting (pylint) - shell: bash -l {0} - run: make lint From fd1d26d62d500e6f4c8cc74643e9b4f9551bfe3a Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Sun, 12 Jul 2020 19:16:27 +1200 Subject: [PATCH 5/7] Use pip instead of conda to install black flake8 and pylint --- .github/workflows/ci_tests.yaml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index d5bf5a69b5f..5edcbf7b435 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -22,19 +22,14 @@ jobs: uses: actions/checkout@v2.3.1 # Setup Miniconda - - name: Setup Miniconda - uses: goanpeca/setup-miniconda@v1.6.0 + - name: Set up Python + uses: actions/setup-python@v2 with: python-version: 3.7 - channels: conda-forge - name: Install packages shell: bash -l {0} - run: conda install --yes black flake8 pylint - - - name: List installed packages - shell: bash -l {0} - run: conda list + run: pip install black flake8 pylint - name: Formatting check (black and flake8) shell: bash -l {0} @@ -43,7 +38,7 @@ jobs: - name: Linting (pylint) shell: bash -l {0} run: make lint - + test: name: ${{ matrix.os }} - Python ${{ matrix.python-version }} runs-on: ${{ matrix.os }} From 8e21bb62a4f63d248aeb9c049a4f0862e27d398e Mon Sep 17 00:00:00 2001 From: Wei Ji Date: Sun, 12 Jul 2020 23:24:18 +1200 Subject: [PATCH 6/7] Run style checks using default bash shell --- .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 5edcbf7b435..dc40df4fa15 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -15,6 +15,9 @@ jobs: style_check: name: Style Checks runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} steps: # Checkout current git repository @@ -28,15 +31,12 @@ jobs: python-version: 3.7 - name: Install packages - shell: bash -l {0} run: pip install black flake8 pylint - name: Formatting check (black and flake8) - shell: bash -l {0} run: make check - name: Linting (pylint) - shell: bash -l {0} run: make lint test: From 29d39473e8222060e9b28fc642592525062c601c Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sun, 12 Jul 2020 12:37:10 -0400 Subject: [PATCH 7/7] No need to use login shell --- .github/workflows/ci_tests.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index dc40df4fa15..d106a96df41 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -15,9 +15,6 @@ jobs: style_check: name: Style Checks runs-on: ubuntu-latest - defaults: - run: - shell: bash -l {0} steps: # Checkout current git repository