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

Attempt to set up GitHub Actions for testing #41

Closed
wants to merge 6 commits into from
Closed
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
34 changes: 0 additions & 34 deletions .github/workflows/python-package-conda.yml

This file was deleted.

104 changes: 104 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: CI

on:
push:
branches:
- master
- v0.*.x
tags:
- "v*"
pull_request:

jobs:
tests:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:

- name: Python 3.7
os: ubuntu-latest
python: 3.7
toxenv: py37

- name: Python 3.7 with Astropy dev
os: ubuntu-latest
python: 3.7
toxenv: py37-astropydev

- name: Python 3.8 with code coverage
os: ubuntu-latest
python: 3.8
toxenv: py38-cov

- name: Python 3.8 with Numpy dev
os: ubuntu-latest
python: 3.8
toxenv: py38-numpydev

- name: Python 3.9
os: ubuntu-latest
python: 3.9
toxenv: py39

- name: Python 3.8 (Windows)
os: windows-latest
python: 3.8
toxenv: py38
toxposargs: --durations=50

- name: Python 3.8 (MacOS X)
os: macos-latest
python: 3.8
toxenv: py38

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install language-pack-fr and tzdata
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt-get install language-pack-fr tzdata
- name: Install Python dependencies
run: python -m pip install --upgrade tox codecov
- name: Run tests
run: tox ${{ matrix.toxargs }} -e ${{ matrix.toxenv }} -- ${{ matrix.toxposargs }}
- name: Upload coverage to codecov
if: ${{ contains(matrix.toxenv,'-cov') }}
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-18.04
needs: tests
steps:
- uses: actions/checkout@master
- name: Get history and tags for SCM versioning to work
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install requirements
run: |
pip install --upgrade pip
pip install setuptools numpy wheel setuptools_scm
- name: Build a binary wheel and a source tarball
run: |
python setup.py bdist_wheel
python setup.py sdist
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.pypi_access_token }}
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PlasmaPy-NEI License

Copyright (c) 2020, PlasmaPy-NEI Developers.
Copyright (c) 2020–2021, PlasmaPy-NEI Developers.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion licenses/PlasmaPy_license.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PlasmaPy License

Copyright (c) 2015-2020, PlasmaPy Developers.
Copyright (c) 2015-2021, PlasmaPy Developers.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
71 changes: 35 additions & 36 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,45 +1,44 @@
[tox]
envlist =
py{37}-test
build_docs
codestyle
envlist = py37,build_docs
isolated_build = True

[testenv]
# Pass through the following environemnt variables which may be needed for the CI
passenv = HOME WINDIR LC_ALL LC_CTYPE CC CI TRAVIS

# Run the tests in a temporary directory to make sure that we don't import
# the package from the source tree
changedir = .tmp/{envname}
whitelist_externals=
/bin/bash
/usr/bin/bash
changedir = tmp
setenv =
MPLBACKEND = agg
COLUMNS = 180
PYTEST_COMMAND = pytest --pyargs plasmapy --durations=25 {toxinidir}/docs -n=auto --dist=loadfile --ignore={toxinidir}/docs/conf.py
extras = all,tests
deps =
numpydev: git+https://github.com/numpy/numpy
astropydev: git+https://github.com/astropy/astropy
cov: pytest-cov
!minimal: pytest-xdist
pytest-github-actions-annotate-failures
commands =
!cov: {env:PYTEST_COMMAND} {posargs}
cov: {env:PYTEST_COMMAND} {posargs} --cov=plasmapy --cov-config={toxinidir}/setup.cfg

# tox environments are constructued with so-called 'factors' (or terms)
# separated by hyphens, e.g. test-devdeps-cov. Lines below starting with factor:
# will only take effect if that factor is included in the environment name. To
# see a list of example environments that can be run, along with a description,
# run:
#
# tox -l -v
#
description =
run tests

deps =
plasmapydev: git+https://github.com/PlasmaPy/PlasmaPy
extras =
# The following indicates which extras_require from setup.cfg will be installed
test
alldeps: all

commands =
pip freeze
pytest --pyargs plasmapy_nei {toxinidir}/docs --cov plasmapy_nei --cov-config={toxinidir}/setup.cfg {posargs}
numpydev: with the git master version of numpy
astropydev: with the git master version of astropy
minimal: with minimal versions of dependencies
cov: with code coverage

[testenv:build_docs]
basepython = python3.7
changedir = docs
description = invoke sphinx-build to build the HTML docs
extras = docs
commands =
pip freeze
sphinx-build -W -b html . _build/html {posargs}
changedir = {toxinidir}
extras = dev
setenv =
HOME = {envtmpdir}
commands = sphinx-build docs docs/_build/html -W -b html

[testenv:build_docs_no_examples]
changedir = {toxinidir}
extras = dev
setenv =
HOME = {envtmpdir}
commands = sphinx-build -D nbsphinx_execute='never' docs docs/_build/html -b html