diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index 1d169890f8..0000000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,32 +0,0 @@ - -name: docs - -on: - pull_request: - types: [closed] - -jobs: - build: - runs-on: ubuntu-latest - if: github.event.pull_request.merged - 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 diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml deleted file mode 100644 index 749e7a8b69..0000000000 --- a/.github/workflows/linting.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: linting - -on: [push, pull_request] - -jobs: - build: - runs-on: ubuntu-latest - strategy: - max-parallel: 4 - matrix: - python-version: [3.7] - - 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 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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..e246eafdbb --- /dev/null +++ b/.github/workflows/release.yml @@ -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 diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 9fcff5d1eb..c161b0da79 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -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 @@ -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 diff --git a/README.md b/README.md index 088299f4df..47f354a003 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/setup.py b/setup.py index cbae218b30..b2dd81945e 100644 --- a/setup.py +++ b/setup.py @@ -23,6 +23,7 @@ package_dir={"": "src"}, zip_safe=False, install_requires=[ + "setuptools", "pymongo>=3.6", "mongomock>=3.10.0", "monty>=1.0.2", diff --git a/src/docs/index.md b/src/docs/index.md index 6a054489e9..3d293d6cb8 100644 --- a/src/docs/index.md +++ b/src/docs/index.md @@ -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"