Skip to content

Commit

Permalink
Merge pull request #3 from HERMES-SOC/github-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsteve committed Mar 9, 2022
2 parents 11dffaa + 2c48e1c commit ee6d4f1
Show file tree
Hide file tree
Showing 10 changed files with 144 additions and 38 deletions.
35 changes: 22 additions & 13 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,49 @@
"dockerfile": "Dockerfile",
"context": ".."
},

// Set *default* container specific settings.json values on container create.
"settings": {
"python.pythonPath": "/usr/local/bin/python",
"python.pythonPath": "/usr/bin/python3",
"python.languageServer": "Pylance",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.formatting.blackPath": "/home/vscode/.local/bin/black",
"python.formatting.provider":"black",
"python.formatting.blackArgs": ["--line-length", "100"],
"python.formatting.provider": "black",
"python.formatting.blackArgs": [
"--line-length",
"100"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.linting.lintOnSave": true,
"python.linting.flake8Enabled": true,
"editor.formatOnSave": true,
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
"python.linting.pycodestylePath": "/home/vscode/.local/bin/pycodestyle",
"python.linting.pydocstylePath": "/home/vscode/.local/bin/pydocstyle",
"python.linting.pylintPath": "/usr/bin/pylint",
"workbench.colorTheme": "Default Dark+",
"terminal.integrated.shell.linux": "/bin/bash"
"terminal.integrated.profiles.linux": {
"bash (login)": {
"path": "/bin/bash",
"args": [
""
]
}
}
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"marklarah.pre-commit-vscode"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "pip3 install -r .devcontainer/requirements.txt",
//"postCreateCommand": "bash -i -c 'pip3 install --user .[all]'",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
}
3 changes: 2 additions & 1 deletion .devcontainer/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ pytest-astropy
pytest-cov
sphinx
sphinx-automodapi
towncrier
towncrier
ipython
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
# This workflow will install Python dependencies, run tests, run linting, and test building docs
name: Python package 3.8
name: Codestyle and Linting

on:
push:
branches: [ main ]
branches:
- main
pull_request:
branches: [ main ]

branches:
- main
jobs:
build:

runs-on: ubuntu-latest
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest]
python-version: [3.8]

steps:
Expand All @@ -25,14 +27,11 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run tests
run: |
tox -e py38
- name: Build docs
python -m pip install -e .[dev]
- name: Lint with Black
run: |
tox -e build_docs
- name: Check codestyle
black --check --diff hermes_instrument
- name: flake8
run: |
tox -e codestyle
flake8 --count hermes_instrument
32 changes: 32 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow will install Python dependencies, run tests, run linting, and test building docs
name: Building Docs

on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:

runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest]
python-version: [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
python -m pip install -e .[docs]
- name: Build docs
run: sphinx-build docs docs/_build/html -W -b html
35 changes: 35 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This workflow will install Python dependencies, run tests, run linting, and test building docs
name: Testing

on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:

runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.6, 3.7, 3.8, 3.9]

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
python -m pip install -e .[test]
- name: Run tests
run: pytest --pyargs hermes_instrument/tests --cov hermes_instrument
env:
PLATFORM: ${{ matrix.platform }}

2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ repos:
rev: 3.7.9
hooks:
- id: flake8
args: ['--count', '--select', 'E101,W191,W291,W292,W293,W391,E111,E112,E113,E303,E304,E306,E502,E722,E901,E902,F822,F823']
args: ['--count', '--select', 'E101,E11,E111,E112,E113,E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E133,E20,E211,E231,E241,E242,E251,E252,E26,E265,E266,E27,E301,E302,E303,E304,E305,E306,E401,E402,E502,E701,E711,E712,E713,E714,E722,E731,E901,E902,F822,F823,W191,W291,W292,W293,W391,W601,W602,W603,W604,W605,W690']

- repo: https://github.com/psf/black
rev: 21.6b0
Expand Down
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

34 changes: 30 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,39 @@
A Python package to process the HERMES instrument.
--------------------------------------------------
========
Overview
========

.. start-badges
.. list-table::
:stub-columns: 1

* - docs
- |docs|
* - build status
- |testing| |codestyle|

.. |docs| image:: https://github.com/HERMES-SOC/hermes_instrument/actions/workflows/docs.yml/badge.svg
:target: https://github.com/HERMES-SOC/hermes_instrument/actions/workflows/docs.yml
:alt: Documentation Build Status

.. |testing| image:: https://github.com/HERMES-SOC/hermes_instrument/actions/workflows/testing.yml/badge.svg
:target: https://github.com/HERMES-SOC/hermes_instrument/actions/workflows/testing.yml
:alt: Build Status

.. |codestyle| image:: https://github.com/HERMES-SOC/hermes_instrument/actions/workflows/codestyle.yml/badge.svg
:target: https://github.com/HERMES-SOC/hermes_instrument/actions/workflows/codestyle.yml
:alt: Codestyle and linting using flake8

.. end-badges
License
-------

This project is Copyright (c) Jane Doe and licensed under
the terms of the BSD 3-Clause license. This package is based upon
the terms of the BSD 3-Clause "New" or "Revised" License license. This package is based upon
the `Openastronomy packaging guide <https://github.com/OpenAstronomy/packaging-guide>`_
which is licensed under the BSD 3-clause licence. See the licenses folder for
which is licensed under the BSD 3-clause licence. See the LICENSE file for
more information.


Expand Down
4 changes: 3 additions & 1 deletion hermes_instrument/example_mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ def main(args=None):
action="store_true",
help="Print all of the Prime numbers.",
)
parser.add_argument("n", metavar="N", type=int, help="Get Prime numbers up to this number.")
parser.add_argument(
"n", metavar="N", type=int, help="Get Prime numbers up to this number."
)

res = parser.parse_args(args)

Expand Down
7 changes: 6 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ long_description = file: README.rst
[options]
zip_safe = False
packages = find:
python_requires = >=3.8
python_requires = >=3.6
setup_requires = setuptools_scm
install_requires =
astropy>=4.1.0
Expand All @@ -26,6 +26,7 @@ console_scripts =
[options.extras_require]
dev =
black
flake8

test =
tox
Expand Down Expand Up @@ -79,3 +80,7 @@ exclude_lines =
pragma: py{ignore_python_version}
# Don't complain about IPython completion helper
def _ipython_key_completions_

[flake8]
select = E101,E11,E111,E112,E113,E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E133,E20,E211,E231,E241,E242,E251,E252,E26,E265,E266,E27,E301,E302,E303,E304,E305,E306,E401,E402,E502,E701,E711,E712,E713,E714,E722,E731,E901,E902,F822,F823,W191,W291,W292,W293,W391,W601,W602,W603,W604,W605,W690
exclude = .txt, .rst, .md

0 comments on commit ee6d4f1

Please sign in to comment.