Skip to content
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

Replace TravisCI and Azure for GitHub Actions #189

Merged
merged 48 commits into from
Sep 30, 2020
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
170c275
Split check target on Makefile in two
santisoler Sep 21, 2020
b99e175
Add GitHub Actions workflows
santisoler Sep 21, 2020
5956e10
Add step for copying the sample data
santisoler Sep 21, 2020
a9233e6
Fix wrong syntax on workflow
santisoler Sep 21, 2020
8bfdb05
Remove quotes on env variable
santisoler Sep 21, 2020
2241c37
Move runner.temp from the matrix to the step
santisoler Sep 21, 2020
0431559
Try to define HARMONICA_DATA_DIR on matrix
santisoler Sep 21, 2020
cb75bb5
Try to set data dir on $HOME
santisoler Sep 21, 2020
7a60351
Try to change syntax for env variable $HOME
santisoler Sep 21, 2020
75948bd
Move HARMONICA_DATA_DIR to copy step
santisoler Sep 21, 2020
b15c3c8
Add HARMONICA_DATA_DIR env variable to test step
santisoler Sep 21, 2020
737e6c1
Add HARMONICA_DATA_DIR to doc build
santisoler Sep 21, 2020
d7e0436
Build docs only on Ubuntu with Python 3.8
santisoler Sep 28, 2020
edd7d25
Fix if syntax
santisoler Sep 28, 2020
73de834
Replace double quotes for single quotes on if statement
santisoler Sep 28, 2020
6b94bf2
Remove windows from matrix to test
santisoler Sep 28, 2020
f570ad9
Run only on Ubuntu with Python 3.8
santisoler Sep 28, 2020
df1b4dc
Set NUMBA_THREADING_LAYER to workqueue on Ubuntu
santisoler Sep 28, 2020
3e4e783
Revert "Run only on Ubuntu with Python 3.8"
santisoler Sep 28, 2020
367cc51
Revert "Remove windows from matrix to test"
santisoler Sep 28, 2020
17c98c3
Replace pooch for harmonica on deploy
santisoler Sep 28, 2020
8340e30
Set HARMONICA_DATA_DIR as a global env variable
santisoler Sep 28, 2020
88d0574
Merge branch 'actions' of github.com:fatiando/harmonica into actions
santisoler Sep 28, 2020
1c3bd8b
Try to use actions/cache for test data directory
santisoler Sep 28, 2020
3e964d2
Try to change cache dir name
santisoler Sep 28, 2020
1d9427d
Change the cache data dir once again
santisoler Sep 28, 2020
072b723
Explain why adding NUMBA_THREADING_LAYER
santisoler Sep 28, 2020
b38b2fb
Explicit cache directory instead of using env variable
santisoler Sep 28, 2020
e28e324
Move cache data inside cloned repo
santisoler Sep 28, 2020
27fd0d6
Revert "Move cache data inside cloned repo"
santisoler Sep 28, 2020
6432a58
Verbose cache directory before running the tests
santisoler Sep 28, 2020
0113279
Merge cache step with the one of conda packages
santisoler Sep 28, 2020
2c2dd85
Revert "Merge cache step with the one of conda packages"
santisoler Sep 28, 2020
f0fb341
Include actions/cache on step that copies the data
santisoler Sep 28, 2020
73b86a6
Revert "Include actions/cache on step that copies the data"
santisoler Sep 28, 2020
fc31920
Try changing cache key
santisoler Sep 29, 2020
c2d4dd5
Remove ls lines on action
santisoler Sep 29, 2020
deaf108
Remove actions/cache for data and use $HOME instead of ~
santisoler Sep 30, 2020
17a6a34
Try using env.HOME instead of $HOME
santisoler Sep 30, 2020
ce56468
Revert "Try using env.HOME instead of $HOME"
santisoler Sep 30, 2020
f8f00c0
Add some ls commands
santisoler Sep 30, 2020
d273775
Use work directory for data cache
santisoler Sep 30, 2020
96e02a4
Define HARMONICA_DATA_DIR on the steps
santisoler Sep 30, 2020
181f9d7
Add HARMONICA_DATA_DIR to doc build step
santisoler Sep 30, 2020
cde2891
Merge branch 'master' into actions
santisoler Sep 30, 2020
4a23db6
Ditch Azure and Travis from the repository
santisoler Sep 30, 2020
6a13874
Merge branch 'actions' of github.com:fatiando/harmonica into actions
santisoler Sep 30, 2020
5ae756c
Revert changes on MAINTENANCE.md
santisoler Sep 30, 2020
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
184 changes: 184 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
# Configuration for testing and deploying with GitHub Actions
#
# NOTE: Pin actions to a specific commit to avoid having the authentication
# token stolen if the Action is compromised. See the comments and links here:
# https://github.com/pypa/gh-action-pypi-publish/issues/27
#
name: test

# Only build PRs, the master branch, and releases. Pushes to branches will only
# be built when a PR is opened. This avoids duplicated buids in PRs comming
# from branches in the origin repository (1 for PR and 1 for push).
on:
pull_request:
push:
branches:
- master
release:
types:
- published

# Use bash by default in all jobs
defaults:
run:
# The -l {0} is necessary for conda environments to be activated
shell: bash -l {0}

jobs:
#############################################################################
# Run tests, build the docs, and deploy if needed
test:
name: ${{ matrix.os }} py${{ matrix.python }} ${{ matrix.dependencies }}
runs-on: ${{ matrix.os }}-latest
strategy:
# Otherwise, the workflow would stop if a single job fails. We want to
# run all of them to catch failures in different combinations.
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
python: [3.6, 3.7, 3.8]
# If "optional", will install non-required dependencies in the build
# environment. Otherwise, only required dependencies are installed.
dependencies: [""]
include:
- os: ubuntu
python: 3.8
- os: macos
python: 3.8
- os: windows
python: 3.8
env:
CONDA_REQUIREMENTS: requirements.txt
CONDA_REQUIREMENTS_DEV: requirements-dev.txt
CONDA_INSTALL_EXTRA:
# Used to tag codecov submissions
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python }}

steps:
# Checks-out your repository under $GITHUB_WORKSPACE
- name: Checkout
uses: actions/checkout@v2
with:
# Need to fetch more than the last commit so that versioneer can
# create the correct version string. If the number of commits since
# the last release is greater than this, the version still be wrong.
# Increase if necessary.
fetch-depth: 100
# The GitHub token is preserved by default but this job doesn't need
# to be able to push to GitHub.
persist-credentials: false

# Need the tags so that versioneer can form a valid version number
- name: Fetch git tags
run: git fetch origin 'refs/tags/*:refs/tags/*'

- name: Setup caching for conda packages
uses: actions/cache@v2
with:
path: ~/conda_pkgs_dir
key: conda-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('requirements*.txt') }}

- name: Setup miniconda
uses: goanpeca/setup-miniconda@v1
with:
python-version: ${{ matrix.python }}
miniconda-version: "latest"
auto-update-conda: true
channels: conda-forge
show-channel-urls: true
activate-environment: testing
# Needed for caching
use-only-tar-bz2: true

- name: Install requirements
run: |
requirements_file=full-conda-requirements.txt
if [ ! -z "$CONDA_REQUIREMENTS" ]; then
echo "Capturing dependencies from $CONDA_REQUIREMENTS"
cat $CONDA_REQUIREMENTS >> $requirements_file
fi
if [ ! -z "$CONDA_REQUIREMENTS_DEV" ]; then
echo "Capturing dependencies from $CONDA_REQUIREMENTS_DEV"
cat $CONDA_REQUIREMENTS_DEV >> $requirements_file
fi
if [ ! -z "$CONDA_INSTALL_EXTRA" ]; then
echo "Capturing extra dependencies: $CONDA_INSTALL_EXTRA"
echo "# Extra" >> $requirements_file
# Use xargs to print one argument per line
echo $CONDA_INSTALL_EXTRA | xargs -n 1 >> $requirements_file
fi
if [ -f $requirements_file ]; then
echo "Collected dependencies:"
cat $requirements_file
echo ""
conda install --quiet --file $requirements_file python=$PYTHON
else
echo "No requirements defined."
fi

- name: List installed packages
run: conda list

- name: Build source and wheel distributions
run: |
python setup.py sdist bdist_wheel
echo ""
echo "Generated files:"
ls -lh dist/

- name: Install the package
run: pip install --no-deps dist/*.whl

- name: Copy test data to cache
run: |
echo "Copy data to " ${HARMONICA_DATA_DIR}/master
set -x -e
mkdir -p ${HARMONICA_DATA_DIR}/master
cp -r data/* ${HARMONICA_DATA_DIR}/master
env:
# Override cache directory where test data is copied to
HARMONICA_DATA_DIR: ${{ runner.temp }}/.harmonica

- name: Run the tests
run: |
if [ ${{ matrix.os }} == 'ubuntu' ]; then
NUMBA_THREADING_LAYER=workqueue make test
else
make test
fi
env:
# Override cache directory where test data was copied to
HARMONICA_DATA_DIR: ${{ runner.temp }}/.harmonica

# The following steps will be run only on Ubuntu with Python 3.8
- name: Build the documentation
if: ${{ matrix.os == 'ubuntu' && matrix.python == 3.8 }}
run: make -C doc clean all
env:
# Override cache directory where test data was copied to
HARMONICA_DATA_DIR: ${{ runner.temp }}/.harmonica

# Store the docs as a build artifact on GitHub so we can check it if
# needed.
- name: Upload HTML documentation as an artifact
if: ${{ matrix.os == 'ubuntu' && matrix.python == 3.8 }}
uses: actions/upload-artifact@v2
with:
name: docs-${{ matrix.os }}-${{ matrix.python }}${{ matrix.dependencies }}-{{ github.sha }}
path: doc/_build/html

- name: Convert coverage report to XML for codecov
if: ${{ matrix.os == 'ubuntu' && matrix.python == 3.8 }}
run: coverage xml

- name: Upload coverage to Codecov
if: ${{ matrix.os == 'ubuntu' && matrix.python == 3.8 }}
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
env_vars: OS,PYTHON
# Don't mark the job as failed if the upload fails for some reason.
# It does sometimes but shouldn't be the reason for running
# everything again unless something else is broken.
fail_ci_if_error: false
Loading