Skip to content

Commit ec4a786

Browse files
author
andamian
authored
Add GH Actions to the repo (#142)
* Added support for GH Actions
1 parent ff56c18 commit ec4a786

File tree

6 files changed

+307
-63
lines changed

6 files changed

+307
-63
lines changed

.github/workflows/cibuild.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: "0 4 * * *"
8+
release:
9+
types: [created]
10+
11+
jobs:
12+
egginfo:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Set up Python 3.8
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: 3.8
20+
- name: Install tox
21+
run: python -m pip install --upgrade tox
22+
- name: egg-info caom2
23+
run: cd caom2 && tox -e egg_info
24+
- name: egg-info caom2utils
25+
run: cd caom2utils && tox -e egg_info
26+
- name: egg-info caom2repo
27+
run: cd caom2repo && tox -e egg_info
28+
29+
tests:
30+
needs: egginfo
31+
runs-on: ubuntu-latest
32+
strategy:
33+
fail-fast: true
34+
matrix:
35+
#TODO 2.7 fails on GH Actions but cannot be reproduced locally. Disabled for now.
36+
# python-version: [2.7,3.5,3.6,3.7,3.8,3.9]
37+
python-version: [3.5,3.6,3.7,3.8,3.9]
38+
package: [caom2, caom2utils, caom2repo]
39+
steps:
40+
- name: Checkout code
41+
uses: actions/checkout@v2
42+
with:
43+
fetch-depth: 0
44+
- name: Set up Python
45+
uses: actions/setup-python@v2
46+
with:
47+
python-version: ${{ matrix.python-version }}
48+
- name: Install tox
49+
run: python -m pip install --upgrade tox
50+
- name: Test ${{ matrix.package }}
51+
run: cd ${{ matrix.package }} && tox -e py${{ matrix.python-version }}
52+
53+
style_n_coverage:
54+
runs-on: ubuntu-latest
55+
needs: tests
56+
steps:
57+
- uses: actions/checkout@v2
58+
- name: Set up Python 3.8
59+
uses: actions/setup-python@v2
60+
with:
61+
python-version: 3.8
62+
- name: Setup Graphviz
63+
uses: ts-graphviz/setup-graphviz@v1
64+
- name: Install tox
65+
run: python -m pip install --upgrade tox
66+
- name: checkstyle & coverage caom2
67+
run: cd caom2 && tox -e checkstyle && tox -e cov
68+
- name: checkstyle & coverage caom2utils
69+
run: cd caom2utils && tox -e checkstyle && tox -e cov
70+
- name: checkstyle & coverage caom2repo
71+
run: cd caom2repo && tox -e checkstyle && tox -e cov
72+
- name: Upload coverage to codecov
73+
uses: codecov/codecov-action@v1
74+
with:
75+
files: ./caom2/coverage.xml,./caom2utils/coverage.xml,./cao2repo/coverage.xml
76+
77+
build-n-publish:
78+
name: Build and publish to PyPI
79+
needs: style_n_coverage
80+
runs-on: ubuntu-latest
81+
if: contains(github.ref, '=')
82+
steps:
83+
- uses: actions/checkout@v2
84+
- name: Set up Python
85+
uses: actions/setup-python@v2
86+
with:
87+
python-version: '3.x'
88+
- name: Determine the package
89+
run: |
90+
echo ${GITHUB_REF#refs/*/}
91+
echo "repo_name=$(echo ${GITHUB_REF#refs/*/} | awk -F '=' '{print $1}')" >> $GITHUB_ENV
92+
echo "repo_version=$(echo ${GITHUB_REF#refs/*/} | awk -F '=' '{print $2}')" >> $GITHUB_ENV
93+
- name: Check version is valid
94+
run: |
95+
echo ${{ env.repo_name }}
96+
echo ${{ env.repo_version }}
97+
cd ${{ env.repo_name }} || (echo "Invalid release tag. Repo not found: ${{ env.repo_name }}" && exit -1)
98+
sed 's/ //g' setup.cfg | grep "^version=${{ env.repo_version }}" || (echo "Version in tag ${{ env.repo_version }} does not match version in setup.cfg" && exit -1)
99+
- name: Install dependencies
100+
run: |
101+
cd ${{ env.repo_name }}
102+
python -m pip install --upgrade pip
103+
pip install setuptools wheel twine
104+
- name: Build and publish
105+
env:
106+
TWINE_USERNAME: ${{ secrets.PYPI_PUBLISH_USER }}
107+
TWINE_PASSWORD: ${{ secrets.PYPI_PUBLISH_PWORD }}
108+
run: |
109+
cd ${{ env.repo_name }}
110+
python setup.py sdist bdist_wheel
111+
twine upload --skip-existing dist/*

.travis.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

README.rst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
Common Archive Observation Model - data engineering tools
22

3+
.. image:: https://img.shields.io/pypi/pyversions/caom2.svg
4+
:target: https://pypi.python.org/pypi/caom2
35

4-
.. image:: https://img.shields.io/pypi/pyversions/caom2repo.svg
5-
:target: https://pypi.python.org/pypi/caom2repo
6+
.. image:: https://github.com/opencadc/caom2tools/workflows/CI/badge.svg?branch=master&event=schedule
7+
:target: https://github.com/opencadc/caom2tools/actions?query=event%3Aschedule+
68

7-
.. image:: https://img.shields.io/travis/opencadc/caom2tools/master.svg
8-
:target: https://travis-ci.org/opencadc/caom2tools?branch=master
9-
10-
.. image:: https://img.shields.io/coveralls/opencadc/caom2tools/master.svg
11-
:target: https://coveralls.io/github/opencadc/caom2tools?branch=master
9+
.. image:: https://codecov.io/gh/opencadc/caom2tools/branch/master/graph/badge.svg
10+
:target: https://codecov.io/gh/opencadc/caom2tools
1211

1312
.. image:: https://img.shields.io/github/contributors/opencadc/caom2tools.svg
1413
:target: https://github.com/opencadc/caom2tools/graphs/contributors

caom2/tox.ini

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
[package]
2+
# TODO find a way to replace with one common ini file.
3+
# the next line is the only package specific configuration. Everything else is common to all packages
4+
name = caom2
5+
6+
[tox]
7+
envlist =
8+
py{2.7,3.4,3.5,3.6,3.7,3.8,3.9}
9+
requires =
10+
pip >= 19.3.1
11+
12+
[testenv]
13+
description = run tests
14+
changedir = {toxinidir}
15+
passenv = HOME
16+
deps = -rdev_requirements.txt
17+
commands =
18+
pip freeze
19+
pytest {[package]name}
20+
21+
[testenv:egg_info]
22+
description = ensure egg_info works without dependencies
23+
commands =
24+
python setup.py egg_info
25+
26+
[testenv:cov]
27+
description = determine the code coverage
28+
deps:
29+
coverage>=4.5.4
30+
-rdev_requirements.txt
31+
commands =
32+
pytest {[package]name} --cov {[package]name} --cov-report xml --cov-config={toxinidir}/setup.cfg
33+
34+
35+
[testenv:checkstyle]
36+
description = check code style, e.g. with flake8
37+
# We list the warnings/errors to check for here rather than in setup.cfg because
38+
# we don't want these options to apply whenever anyone calls flake8 from the
39+
# command-line or their code editor - in this case all warnings/errors should be
40+
# checked for. The warnings/errors we check for here are:
41+
# E101 - mix of tabs and spaces
42+
# W191 - use of tabs
43+
# W291 - trailing whitespace
44+
# W292 - no newline at end of file
45+
# W293 - trailing whitespace
46+
# W391 - blank line at end of file
47+
# E111 - 4 spaces per indentation level
48+
# E112 - 4 spaces per indentation level
49+
# E113 - 4 spaces per indentation level
50+
# E301 - expected 1 blank line, found 0
51+
# E302 - expected 2 blank lines, found 0
52+
# E303 - too many blank lines (3)
53+
# E304 - blank lines found after function decorator
54+
# E305 - expected 2 blank lines after class or function definition
55+
# E306 - expected 1 blank line before a nested definition
56+
# E502 - the backslash is redundant between brackets
57+
# E722 - do not use bare except
58+
# E901 - SyntaxError or IndentationError
59+
# E902 - IOError
60+
# E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree
61+
# F822: undefined name in __all__
62+
# F823: local variable name referenced before assignment
63+
skip_install = true
64+
deps = flake8
65+
changedir = {toxinidir}
66+
commands = flake8 {[package]name} --count --select=E101,W191,W291,W292,W293,W391,E111,E112,E113,E30,E502,E722,E901,E902,E999,F822,F823

caom2repo/tox.ini

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,66 @@
1+
[package]
2+
# TODO find a way to replace with one common ini file.
3+
# the next line is the only package specific configuration. Everything else is common to all packages
4+
name = caom2repo
5+
16
[tox]
2-
envlist = py27, py34, py35, py36, p37
3-
skip_missing_interpreters = True
7+
envlist =
8+
py{2.7,3.4,3.5,3.6,3.7,3.8,3.9}
9+
requires =
10+
pip >= 19.3.1
411

512
[testenv]
13+
description = run tests
14+
changedir = {toxinidir}
15+
passenv = HOME
616
deps = -rdev_requirements.txt
7-
commands = python setup.py test
17+
commands =
18+
pip freeze
19+
pytest {[package]name}
20+
21+
[testenv:egg_info]
22+
description = ensure egg_info works without dependencies
23+
commands =
24+
python setup.py egg_info
25+
26+
[testenv:cov]
27+
description = determine the code coverage
28+
deps:
29+
coverage>=4.5.4
30+
-rdev_requirements.txt
31+
commands =
32+
pytest {[package]name} --cov {[package]name} --cov-report xml --cov-config={toxinidir}/setup.cfg
33+
34+
35+
[testenv:checkstyle]
36+
description = check code style, e.g. with flake8
37+
# We list the warnings/errors to check for here rather than in setup.cfg because
38+
# we don't want these options to apply whenever anyone calls flake8 from the
39+
# command-line or their code editor - in this case all warnings/errors should be
40+
# checked for. The warnings/errors we check for here are:
41+
# E101 - mix of tabs and spaces
42+
# W191 - use of tabs
43+
# W291 - trailing whitespace
44+
# W292 - no newline at end of file
45+
# W293 - trailing whitespace
46+
# W391 - blank line at end of file
47+
# E111 - 4 spaces per indentation level
48+
# E112 - 4 spaces per indentation level
49+
# E113 - 4 spaces per indentation level
50+
# E301 - expected 1 blank line, found 0
51+
# E302 - expected 2 blank lines, found 0
52+
# E303 - too many blank lines (3)
53+
# E304 - blank lines found after function decorator
54+
# E305 - expected 2 blank lines after class or function definition
55+
# E306 - expected 1 blank line before a nested definition
56+
# E502 - the backslash is redundant between brackets
57+
# E722 - do not use bare except
58+
# E901 - SyntaxError or IndentationError
59+
# E902 - IOError
60+
# E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree
61+
# F822: undefined name in __all__
62+
# F823: local variable name referenced before assignment
63+
skip_install = true
64+
deps = flake8
65+
changedir = {toxinidir}
66+
commands = flake8 {[package]name} --count --select=E101,W191,W291,W292,W293,W391,E111,E112,E113,E30,E502,E722,E901,E902,E999,F822,F823

caom2utils/tox.ini

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,66 @@
1+
[package]
2+
# TODO find a way to replace with one common ini file.
3+
# the next line is the only package specific configuration. Everything else is common to all packages
4+
name = caom2utils
5+
16
[tox]
2-
envlist = py27, py34, py35, py36, py37
3-
skip_missing_interpreters = True
7+
envlist =
8+
py{2.7,3.4,3.5,3.6,3.7,3.8,3.9}
9+
requires =
10+
pip >= 19.3.1
411

512
[testenv]
13+
description = run tests
14+
changedir = {toxinidir}
15+
passenv = HOME
616
deps = -rdev_requirements.txt
7-
commands = python setup.py test
17+
commands =
18+
pip freeze
19+
pytest {[package]name}
20+
21+
[testenv:egg_info]
22+
description = ensure egg_info works without dependencies
23+
commands =
24+
python setup.py egg_info
25+
26+
[testenv:cov]
27+
description = determine the code coverage
28+
deps:
29+
coverage>=4.5.4
30+
-rdev_requirements.txt
31+
commands =
32+
pytest {[package]name} --cov {[package]name} --cov-report xml --cov-config={toxinidir}/setup.cfg
33+
34+
35+
[testenv:checkstyle]
36+
description = check code style, e.g. with flake8
37+
# We list the warnings/errors to check for here rather than in setup.cfg because
38+
# we don't want these options to apply whenever anyone calls flake8 from the
39+
# command-line or their code editor - in this case all warnings/errors should be
40+
# checked for. The warnings/errors we check for here are:
41+
# E101 - mix of tabs and spaces
42+
# W191 - use of tabs
43+
# W291 - trailing whitespace
44+
# W292 - no newline at end of file
45+
# W293 - trailing whitespace
46+
# W391 - blank line at end of file
47+
# E111 - 4 spaces per indentation level
48+
# E112 - 4 spaces per indentation level
49+
# E113 - 4 spaces per indentation level
50+
# E301 - expected 1 blank line, found 0
51+
# E302 - expected 2 blank lines, found 0
52+
# E303 - too many blank lines (3)
53+
# E304 - blank lines found after function decorator
54+
# E305 - expected 2 blank lines after class or function definition
55+
# E306 - expected 1 blank line before a nested definition
56+
# E502 - the backslash is redundant between brackets
57+
# E722 - do not use bare except
58+
# E901 - SyntaxError or IndentationError
59+
# E902 - IOError
60+
# E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree
61+
# F822: undefined name in __all__
62+
# F823: local variable name referenced before assignment
63+
skip_install = true
64+
deps = flake8
65+
changedir = {toxinidir}
66+
commands = flake8 {[package]name} --count --select=E101,W191,W291,W292,W293,W391,E111,E112,E113,E30,E502,E722,E901,E902,E999,F822,F823

0 commit comments

Comments
 (0)