Skip to content

Commit

Permalink
Merge pull request #75 from materialsproject/refactor
Browse files Browse the repository at this point in the history
Release Workflow for Github
  • Loading branch information
Shyam Dwaraknath authored Jan 10, 2020
2 parents 7e166da + c2c6011 commit 1f868b5
Show file tree
Hide file tree
Showing 7 changed files with 190 additions and 75 deletions.
32 changes: 0 additions & 32 deletions .github/workflows/docs.yml

This file was deleted.

38 changes: 0 additions & 38 deletions .github/workflows/linting.yml

This file was deleted.

140 changes: 140 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
name: release

on:
push:
branches:
- master
tags:
- 'v*'

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

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

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-testing.txt
- name: Lint with pycodestyle
run: |
pip install pycodestyle
pycodestyle src/maggma
- name: Lint with mypy
run: |
pip install mypy mypy-boto3
mypy src/maggma
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 --count --show-source --statistics src/maggma
# exit-zero treats all errors as warnings.
flake8 --count --exit-zero --max-complexity=20 --statistics src/maggma
test:
services:
local_mongodb:
image: mongo:4.0
ports:
- 27017:27017

strategy:
max-parallel: 6
matrix:
os: [ubuntu-latest]
python-version: [3.7]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v1

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-testing.txt
pip install -r requirements-optional.txt
- name: Test with pytest
env:
CONTINUOUS_INTEGRATION: True
run: |
pip install -e .
pytest --cov=maggma --cov-report=xml
- uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml

deploy:
runs-on: ubuntu-latest
needs:
- lint
- test

steps:
- uses: actions/checkout@v1

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools setuptools_scm wheel
- name: Build packages
run: |
python setup.py sdist bdist_wheel
- name: Publish package
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPY_API_TOKEN }}

docs:
runs-on: ubuntu-latest
needs:
- lint
- test
- deploy

steps:
- uses: actions/checkout@v1

- uses: actions/setup-python@v1
with:
python-version: 3.7

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-docs.txt
pip install -e .
- name: Build
run: mkdocs build -d docs

- name: Deploy
uses: peaceiris/actions-gh-pages@v2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./docs
48 changes: 46 additions & 2 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,51 @@
name: testing

on: [push, pull_request]
on:
push:
branches:
- master

pull_request:
branches:
- master

jobs:
build:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

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

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-testing.txt
- name: Lint with pycodestyle
run: |
pip install pycodestyle
pycodestyle src/maggma
- name: Lint with mypy
run: |
pip install mypy mypy-boto3
mypy src/maggma
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 --count --show-source --statistics src/maggma
# exit-zero treats all errors as warnings.
flake8 --count --exit-zero --max-complexity=20 --statistics src/maggma
test:
services:
local_mongodb:
image: mongo:4.0
Expand All @@ -21,16 +62,19 @@ jobs:

steps:
- uses: actions/checkout@v1

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-testing.txt
pip install -r requirements-optional.txt
- name: Test with pytest
env:
CONTINUOUS_INTEGRATION: True
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

# Maggma
[![linting](https://github.com/materialsproject/maggma/workflows/linting/badge.svg)](https://github.com/materialsproject/maggma/actions?query=workflow%3Alinting) [![testing](https://github.com/materialsproject/maggma/workflows/testing/badge.svg)](https://github.com/materialsproject/maggma/actions?query=workflow%3Atesting) [![codecov](https://codecov.io/gh/materialsproject/maggma/branch/master/graph/badge.svg)](https://codecov.io/gh/materialsproject/maggma) [![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/materialsproject/maggma.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/materialsproject/maggma/context:python)

[![testing](https://github.com/materialsproject/maggma/workflows/testing/badge.svg)](https://github.com/materialsproject/maggma/actions?query=workflow%3Atesting) [![codecov](https://codecov.io/gh/materialsproject/maggma/branch/master/graph/badge.svg)](https://codecov.io/gh/materialsproject/maggma) [![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/materialsproject/maggma.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/materialsproject/maggma/context:python)

A files-to-API data pipeline for scientific applications using Python and MongoDB
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
package_dir={"": "src"},
zip_safe=False,
install_requires=[
"setuptools",
"pymongo>=3.6",
"mongomock>=3.10.0",
"monty>=1.0.2",
Expand Down
3 changes: 1 addition & 2 deletions src/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ You can install Maggma directly from a clone of the [Git repository](https://git

``` shell tab="Local Clone"
git clone https://github.com//materialsproject/maggma
cd sphinx
pip install .
python setup.py install
```

``` shell tab="Direct Git"
Expand Down

0 comments on commit 1f868b5

Please sign in to comment.