Skip to content

Commit

Permalink
Eliminate Azure Pipelines CI jobs, use GitHub Actions instead (#513)
Browse files Browse the repository at this point in the history
- Add steps "building documentation" and "uploading coverage to codecov" in GitHub Actions
- Eliminate Azure Pipelines CI jobs, except the one doing style checks.
  • Loading branch information
seisman authored Jul 11, 2020
1 parent 9a25ed2 commit 1027b38
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 189 deletions.
188 changes: 0 additions & 188 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,191 +63,3 @@ jobs:
make lint
displayName: Linting (pylint)
condition: succeededOrFailed()
# Mac
########################################################################################
- job:
displayName: 'Mac'

pool:
vmImage: 'macOS-10.14'

variables:
CONDA_REQUIREMENTS: requirements.txt
CONDA_REQUIREMENTS_DEV: requirements-dev.txt
CONDA_INSTALL_EXTRA: "codecov gmt=6.0.0"

strategy:
matrix:
Python38:
python.version: '3.8'
PYTHON: '3.8'
Python37:
python.version: '3.7'
PYTHON: '3.7'
Python36:
python.version: '3.6'
PYTHON: '3.6'

steps:

- bash: echo "##vso[task.prependpath]$CONDA/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

# On Hosted macOS, the agent user doesn't have ownership of Miniconda's installation
# directory. We need to take ownership if we want to update conda or install packages
# globally.
- bash: sudo chown -R $USER $CONDA
displayName: Take ownership of conda installation

# 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
# Cache the ${HOME}/.gmt directory, for docs and testing
- task: Cache@2
inputs:
key: cachedata | 20200524
path: $(HOME)/.gmt
cacheHitVar: CACHE_CACHEDATA_RESTORED
displayName: Cache GMT remote data for testing

# Download remote files, if not already cached
- bash: |
set -x -e
source activate testing
gmt which -Gu @earth_relief_10m @earth_relief_01d @ridge.txt @Table_5_11.txt @tut_bathy.nc @tut_quakes.ngdc @tut_ship.xyz
displayName: Download remote data
condition: ne(variables['CACHE_CACHEDATA_RESTORED'], true)
# Install the package
- bash: |
set -x -e
source activate testing
python setup.py bdist_wheel
pip install dist/*
displayName: Install the package
# Run the tests
- bash: |
set -x -e
source activate testing
make test PYTEST_EXTRA="-r P"
displayName: Test
# Build the documentation
- bash: |
set -x -e
source activate testing
make -C doc clean all
displayName: Build the documentation
# Upload test coverage if there were no failures
- bash: |
set -x -e
source activate testing
echo "Uploading coverage to Codecov"
codecov -e PYTHON AGENT_OS
env:
CODECOV_TOKEN: $(codecov.token)
condition: succeeded()
displayName: Upload coverage
# Windows
########################################################################################
- job:
displayName: 'Windows'

pool:
vmImage: 'vs2017-win2016'

variables:
CONDA_REQUIREMENTS: requirements.txt
CONDA_REQUIREMENTS_DEV: requirements-dev.txt
CONDA_INSTALL_EXTRA: "codecov gmt=6.0.0"

strategy:
matrix:
Python38:
python.version: '3.8'
PYTHON: '3.8'
Python37:
python.version: '3.7'
PYTHON: '3.7'
Python36:
python.version: '3.6'
PYTHON: '3.6'

steps:

- powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
displayName: Add conda to PATH

# Get the Fatiando CI scripts
- script: 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
- script: continuous-integration/azure/setup-miniconda.bat
displayName: Setup Miniconda

# Show installed pkg information for postmortem diagnostic
- bash: |
set -x -e
source activate testing
conda list
displayName: List installed packages
# Cache the ${HOME}/.gmt directory, for docs and testing
- task: Cache@2
inputs:
key: cachedata | 20200524
path: $(HOMEPATH)/.gmt
cacheHitVar: CACHE_CACHEDATA_RESTORED
displayName: Cache GMT remote data for testing

# Download remote files, if not already cached
- bash: |
set -x -e
source activate testing
gmt which -Gu @earth_relief_10m @earth_relief_01d @ridge.txt @Table_5_11.txt @tut_bathy.nc @tut_quakes.ngdc @tut_ship.xyz
displayName: Download remote data
condition: ne(variables['CACHE_CACHEDATA_RESTORED'], true)
# Install the package that we want to test
- bash: |
set -x -e
source activate testing
python setup.py sdist --formats=zip
pip install dist/*
displayName: Install the package
# Run the tests
- bash: |
set -x -e
source activate testing
make test PYTEST_EXTRA="-r P"
displayName: Test
# Upload test coverage if there were no failures
- bash: |
set -x -e
source activate testing
codecov -e PYTHON AGENT_OS
env:
CODECOV_TOKEN: $(codecov.token)
condition: succeeded()
displayName: Upload coverage
20 changes: 19 additions & 1 deletion .github/workflows/ci_tests.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# This workflow installs PyGMT dependencies, build documentation and run tests
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Tests
Expand All @@ -20,6 +20,10 @@ jobs:
matrix:
python-version: [3.6, 3.7, 3.8]
os: [ubuntu-latest, macOS-latest, windows-latest]
# environmental variables used in coverage
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}

steps:
# Checkout current git repository
Expand All @@ -45,6 +49,7 @@ jobs:
cat << EOF >> $requirements_file
gmt=6.0.0
make
codecov
EOF
conda install --yes --file $requirements_file
Expand Down Expand Up @@ -96,3 +101,16 @@ jobs:
- name: Test with pytest
shell: bash -l {0}
run: make test PYTEST_EXTRA="-r P"

# Build the documentation
- name: Build the documentation
shell: bash -l {0}
run: make -C doc clean all

# Upload coverage to Codecov
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
file: ./coverage.xml # optional
env_vars: OS,PYTHON
fail_ci_if_error: true

0 comments on commit 1027b38

Please sign in to comment.