Skip to content

Commit

Permalink
Merge pull request #746 from oemof/replace-travis-with-github-actions
Browse files Browse the repository at this point in the history
Replace travis with workflows, add 3.9 and remove 3.6
  • Loading branch information
uvchik authored Feb 18, 2021
2 parents ebef09b + 5f8f91c commit 86ff088
Show file tree
Hide file tree
Showing 48 changed files with 3,717 additions and 2,516 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Black

on:
push:
branches:
- master
- dev
pull_request:
branches:
- master
- dev
workflow_dispatch:
schedule:
- cron: "0 5 * * 6" # 5:00 UTC every Saturday

jobs:
run-linters:
name: Run linters
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.9

- name: Install Python dependencies
run: pip install black flake8

- name: Run linters
uses: samuelmeuli/lint-action@v1
with:
github_token: ${{ secrets.github_token }}
# Enable linters
black: true
flake8: false
# Mark the following line true if you want linters to attempt to autocorrect your code
auto_fix: false
git_name: "Greene Lab Linter"
git_email: "[email protected]"
37 changes: 37 additions & 0 deletions .github/workflows/packaging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: packaging

on:
# Make sure packaging process is not broken
push:
branches: [master, dev]
pull_request:
# Make a package for release
release:
types: [published]

jobs:
build:

runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.9]

steps:
- uses: actions/checkout@v1
- 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 setuptools setuptools_scm twine wheel
- name: Create packages
run: python setup.py sdist bdist_wheel
- name: Run twine check
run: twine check dist/*
- uses: actions/upload-artifact@v2
with:
name: tox-gh-actions-dist
path: dist
54 changes: 54 additions & 0 deletions .github/workflows/tox_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# NB: this name is used in the status badge
name: tox checks

on:
push:
branches:
- master
- dev
pull_request:
branches:
- master
- dev
workflow_dispatch:
schedule:
- cron: "0 5 * * 6" # 5:00 UTC every Saturday

jobs:
lint:
name: ${{ matrix.toxenv }}
runs-on: ubuntu-latest

strategy:
matrix:
toxenv:
- clean
- check
- docs

steps:
- name: Git clone
uses: actions/checkout@v2

- name: Set up Python ${{ env.default_python || '3.9' }}
uses: actions/setup-python@v2
with:
python-version: "${{ env.default_python || '3.9' }}"

- name: Pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.toxenv }}-${{ hashFiles('tox.ini', 'setup.py') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.toxenv }}-
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U setuptools wheel
python -m pip install -U tox
- name: Run ${{ matrix.toxenv }}
run: python -m tox -e ${{ matrix.toxenv }}
45 changes: 45 additions & 0 deletions .github/workflows/tox_pytests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: tox pytests

on:
push:
branches:
- master
- dev
pull_request:
branches:
- master
- dev
workflow_dispatch:
schedule:
- cron: "0 5 * * 6" # 5:00 UTC every Saturday

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v1
- name: Install xmllint
run: sudo apt install coinor-cbc
- 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 tox tox-gh-actions coverage coveralls
- name: Test with tox
run: tox

- name: Check test coverage
run: coverage report -m --fail-under=${{ matrix.vcs == 'bzr' && 89 || 90 }}

- name: Report to coveralls
run: coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
62 changes: 0 additions & 62 deletions .travis.yml

This file was deleted.

2 changes: 0 additions & 2 deletions ci/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def main():
import jinja2
import matrix


print("Project path: {0}".format(base_path))

jinja = jinja2.Environment(
Expand Down Expand Up @@ -101,4 +100,3 @@ def main():
else:
print("Unexpected arguments {0}".format(args), file=sys.stderr)
sys.exit(1)

56 changes: 28 additions & 28 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,50 @@


extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.coverage',
'sphinx.ext.doctest',
'sphinx.ext.extlinks',
'sphinx.ext.ifconfig',
'sphinx.ext.napoleon',
'sphinx.ext.todo',
'sphinx.ext.imgmath',
'sphinx.ext.viewcode',
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.coverage",
"sphinx.ext.doctest",
"sphinx.ext.extlinks",
"sphinx.ext.ifconfig",
"sphinx.ext.napoleon",
"sphinx.ext.todo",
"sphinx.ext.imgmath",
"sphinx.ext.viewcode",
]
source_suffix = '.rst'
master_doc = 'index'
project = 'oemof.solph'
year = '2014-2020'
author = 'oemof-developer-group'
copyright = '{0}, {1}'.format(year, author)
version = release = '0.4.2.dev0'

pygments_style = 'trac'
templates_path = ['.']
source_suffix = ".rst"
master_doc = "index"
project = "oemof.solph"
year = "2014-2020"
author = "oemof-developer-group"
copyright = "{0}, {1}".format(year, author)
version = release = "0.4.2.dev0"

pygments_style = "trac"
templates_path = ["."]
extlinks = {
'issue': ('https://github.com/oemof/oemof-solph/issues/%s', '#'),
'pr': ('https://github.com/oemof/oemof-solph/pull/%s', 'PR #'),
"issue": ("https://github.com/oemof/oemof-solph/issues/%s", "#"),
"pr": ("https://github.com/oemof/oemof-solph/pull/%s", "PR #"),
}
# on_rtd is whether we are on readthedocs.org
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
on_rtd = os.environ.get("READTHEDOCS", None) == "True"

if not on_rtd: # only set the theme if we're building docs locally
html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"

html_use_smartypants = True
html_last_updated_fmt = '%b %d, %Y'
html_last_updated_fmt = "%b %d, %Y"
html_split_index = False
html_sidebars = {
'**': ['searchbox.html', 'globaltoc.html', 'sourcelink.html'],
"**": ["searchbox.html", "globaltoc.html", "sourcelink.html"],
}
html_short_title = '%s-%s' % (project, version)
html_short_title = "%s-%s" % (project, version)

napoleon_use_ivar = True
napoleon_use_rtype = False
napoleon_use_param = False

exclude_patterns = ['_build', 'whatsnew/*']
exclude_patterns = ["_build", "whatsnew/*"]

linkcheck_ignore = [r"https://requires.io/.*"] + (
[
Expand Down
19 changes: 19 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[tool.black]
line-length = 79
target-version = ['py37', 'py38']
include = '\.pyi?$'
exclude = '''
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
| ci
)/
'''
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ universal = 1
[flake8]
max-line-length = 79
exclude = */migrations/*, docs/conf.py
ignore = E203, W503

[pydocstyle]
ignore = D200, D203, D213, D406, D407
Expand Down
Loading

0 comments on commit 86ff088

Please sign in to comment.