Skip to content

Commit

Permalink
Actions (1) (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
andamian committed Nov 6, 2020
1 parent 36357b3 commit 9778bbf
Showing 1 changed file with 98 additions and 0 deletions.
98 changes: 98 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package

on: [push, pull_request, create]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Prepare
run: |
# set the TRAVIS_TAG env variable for next steps
echo "TRAVIS_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "***** $TRAVIS_TAG"
./.publish.sh
exit -1
build:
needs: publish
runs-on: ubuntu-latest
strategy:
matrix:
# 3.7 is missing because it is used for coverage
python-version: [2.7, 3.5, 3.6, 3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest coveralls
for i in (ls -d vos */); do
cd $i
pip install -r dev_requirements.txt;
cd ..
done
- name: Test with pytest
run: |
for i in $(ls -d */); do
cd $i;
pytest $i || exit -1
cd ..
done
coverage:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest coveralls
for i in $(ls -d */); do
cd $i
pip install -r dev_requirements.txt;
cd ..
done
- name: Lint with flake8
run: |
for i in $(ls -d */); do
cd $i
# stop the build if there are Python syntax errors or undefined names
flake8 $i --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 $i --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
cd ..;
done
- name: Test with pytest
run: |
for i in $(ls -d */); do
cd $i;
pytest --cov $i || exit -1
cd ..
done
coverage combine $(ls -d */.coverage) || exit 1;
- name: Consolidate coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
CI_BRANCH: ${GITHUB_REF#"ref/heads"}
run: |
coveralls

0 comments on commit 9778bbf

Please sign in to comment.