Skip to content

Commit

Permalink
Use GitHub Actions for CI/CD (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgiannuzzi committed Sep 18, 2021
1 parent 29c5315 commit e0e18ae
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 45 deletions.
4 changes: 3 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[report]
omit = nptdms/test/*
omit =
nptdms/test/*
.tox/*
exclude_lines =
# Ignore repr methods only used for debugging
def __repr__
Expand Down
79 changes: 79 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: CI/CD

on:
push:
pull_request:

jobs:
lint:
name: Lint
if: github.event_name == 'push' || github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install tox
run: pip install tox
- name: Run pycodestyle
run: tox
env:
TOXENV: pycodestyle

test:
name: Test Python ${{ matrix.python }} on ${{ matrix.os }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id
strategy:
fail-fast: false
matrix:
python: ['2.7', '3.5', '3.6', '3.7', '3.8', '3.9']
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install tox
run: pip install tox
- name: Compute TOXENV
id: toxenv
run: echo "::set-output name=toxenv::py$(tr -d . <<< ${{ matrix.python }})"
shell: bash
- name: Run tests
run: tox
env:
TOXENV: ${{ steps.toxenv.outputs.toxenv }}
- name: Upload coverage to Codecov
if: ${{ !(github.event_name == 'push' && github.event.repository.fork) }}
uses: codecov/codecov-action@v2
with:
env_vars: OS,PYTHON
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python }}

publish:
name: Publish
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && !github.event.repository.fork
needs: [lint, test]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Create package
run: python setup.py sdist
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
33 changes: 0 additions & 33 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ npTDMS
.. image:: https://img.shields.io/pypi/v/npTDMS.svg
:alt: PyPI Version
:target: https://pypi.org/project/npTDMS/
.. image:: https://app.travis-ci.com/adamreeve/npTDMS.svg?branch=master
.. image:: https://github.com/adamreeve/npTDMS/actions/workflows/ci.yml/badge.svg?branch=master&event=push
:alt: Build status
:target: https://app.travis-ci.com/github/adamreeve/npTDMS/branches
:target: https://github.com/adamreeve/npTDMS/actions/workflows/ci.yml?query=event%3Apush+branch%3Amaster
.. image:: https://readthedocs.org/projects/nptdms/badge/?version=latest
:target: https://nptdms.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
Expand Down
18 changes: 9 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
envlist = py{27,35,36,37,38},pep8
envlist = py{27,35,36,37,38},pycodestyle

[pep8]
[pycodestyle]
max-line-length = 120

[pytest]
Expand All @@ -13,15 +13,15 @@ addopts = --benchmark-disable
deps =
pytest
coverage
codecov
passenv = CI TRAVIS TRAVIS_*
passenv = CI GITHUB_* RUNNER_*
extras = test,pandas,hdf,thermocouple_scaling
commands =
python -m coverage run -m pytest []
codecov
coverage run -m pytest []
coverage report
coverage xml

[testenv:pep8]
[testenv:pycodestyle]
skip_install = True
deps = pep8
deps = pycodestyle
commands =
pep8 ./nptdms
pycodestyle ./nptdms

0 comments on commit e0e18ae

Please sign in to comment.