Skip to content

Eliminate Azure Pipelines CI jobs, use GitHub Actions instead #513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/codecov-action@v1.0.10
with:
file: ./coverage.xml # optional
env_vars: OS,PYTHON
fail_ci_if_error: true