-
Notifications
You must be signed in to change notification settings - Fork 368
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1691 from greglucas/github_actions
TST: Using GitHub Actions for CI testing
- Loading branch information
Showing
3 changed files
with
133 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
name: Tests | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
python-version: [3.6, 3.9] | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
activate-environment: test-environment | ||
python-version: ${{ matrix.python-version }} | ||
channels: conda-forge/label/testing,conda-forge | ||
|
||
- name: Minimum packages | ||
# Only run on macos for now | ||
# Conda's linux packages don't grab the testing label of matplotlib causing failures due to freetype differences | ||
if: ${{ matrix.python-version == '3.6' && matrix.os == 'macos-latest' }} | ||
id: minimum-packages | ||
run: | | ||
echo "PACKAGES=cython=0.28.5 matplotlib=2.2.2 numpy=1.16 owslib=0.17 proj4=5.2.0 scipy=1.2.0" >> $GITHUB_ENV | ||
echo "CFLAGS=-stdlib=libc++" >> $GITHUB_ENV | ||
- name: Latest packages | ||
if: ${{ steps.minimum-packages.conclusion == 'skipped' }} | ||
run: | | ||
echo "PACKAGES=cython fiona matplotlib-base numpy proj pykdtree scipy" >> $GITHUB_ENV | ||
- name: Coverage packages | ||
id: coverage | ||
# only want the coverage to be run on the latest ubuntu | ||
if: ${{ matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest' }} | ||
run: | | ||
echo "PACKAGES=$PACKAGES pytest-cov coveralls" >> $GITHUB_ENV | ||
echo "CYTHON_COVERAGE=1" >> $GITHUB_ENV | ||
echo "EXTRA_TEST_ARGS=--cov=cartopy -ra" >> $GITHUB_ENV | ||
- name: Install dependencies | ||
run: | | ||
PACKAGES="$PACKAGES flufl.lock owslib pep8 pillow pyepsg pyshp pytest" | ||
PACKAGES="$PACKAGES pytest-xdist requests setuptools_scm" | ||
PACKAGES="$PACKAGES setuptools_scm_git_archive shapely" | ||
conda install $PACKAGES | ||
conda info -a | ||
conda list | ||
- name: Install Cartopy | ||
run: | | ||
MPL_CONFIG_DIR=~/.config/matplotlib | ||
mkdir -p $MPL_CONFIG_DIR | ||
echo "backend : agg" > $MPL_CONFIG_DIR/matplotlibrc | ||
pip install --no-deps -e . | ||
python -c "import cartopy; print('Version ', cartopy.__version__)" | ||
- name: Testing | ||
id: test | ||
run: | | ||
# Check that the downloader tool at least knows where to get the data from (but don't actually download it) | ||
python tools/feature_download.py gshhs physical --dry-run | ||
CARTOPY_GIT_DIR=$PWD | ||
pytest -n 4 --doctest-modules --pyargs cartopy ${EXTRA_TEST_ARGS} | ||
- name: Coveralls | ||
if: ${{ steps.coverage.conclusion == 'success' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | ||
coveralls | ||
|
||
- name: Create image output | ||
if: ${{ steps.test.conclusion == 'failure' }} | ||
id: image-output | ||
run: | ||
python -c "import cartopy.tests.mpl; print(cartopy.tests.mpl.failed_images_html())" >> image-failures-${{ matrix.os }}-${{ matrix.python-version }}.html | ||
|
||
# Can't create image output and upload in the same step | ||
- name: Upload image results | ||
uses: actions/upload-artifact@v2 | ||
if: ${{ steps.image-output.conclusion == 'success' }} | ||
with: | ||
name: image-failures-${{ matrix.os }}-${{ matrix.python-version }}.html | ||
path: image-failures-${{ matrix.os }}-${{ matrix.python-version }}.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Build and upload to PyPI | ||
|
||
# Only build on tagged releases | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
build: | ||
name: Build sdist | ||
runs-on: ubuntu-18.04 | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
activate-environment: test-environment | ||
python-version: ${{ matrix.python-version }} | ||
channels: conda-forge/label/testing,conda-forge | ||
|
||
- name: Install dependencies | ||
run: | | ||
PACKAGES="cython fiona matplotlib-base numpy proj pykdtree scipy" | ||
PACKAGES="$PACKAGES flufl.lock owslib pep8 pillow pyepsg pyshp pytest" | ||
PACKAGES="$PACKAGES pytest-xdist requests setuptools_scm" | ||
PACKAGES="$PACKAGES setuptools_scm_git_archive shapely" | ||
conda install $PACKAGES | ||
- name: Create sdist | ||
run: python setup.py | ||
|
||
- name: Publish Package | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.pypi_token }} |
This file was deleted.
Oops, something went wrong.