Skip to content

Commit

Permalink
github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelduchesne committed May 24, 2021
1 parent fc841a7 commit f0206ae
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 21 deletions.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
time: "10:00"
open-pull-requests-limit: 10
41 changes: 41 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name-template: 'v$RESOLVED_VERSION 🌈'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '🚀 New Features'
labels:
- 'enhancement'
- 'new feature'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '🧰 Maintenance'
labels:
- 'refactoring'
- 'dependencies'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
- 'feature'
- 'new feature'
- 'enhancement'
patch:
labels:
- 'fix'
- 'bugfix'
- 'bug'
- 'patch'
- 'refactoring'
- 'documentation'
default: patch
template: |
## Changes
$CHANGES
28 changes: 20 additions & 8 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python application
name: Python package

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

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
os: [macos-latest, ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
python -m pip install flake8 pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
Expand All @@ -33,4 +37,12 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
pytest --cov=energy-pandas --cov-report=xml tests/
- name: Upload coverage to Codecov
if: ${{ matrix.python-version == 3.7 }}
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: false
verbose: true
31 changes: 31 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package

on:
release:
types: [created, edited]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
5 changes: 2 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
git+https://github.com/samuelduchesne/archetypal.git#archetypal=archetypal
archetypal
numpy
mongoengine
pycountry
pytest
geojson
mongomock
datapackage
geopandas
datapackage
58 changes: 48 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,59 @@
"""Setup/install the package."""
# Always prefer setuptools over distutils
import codecs
import os
from os import path

from setuptools import setup
from setuptools import find_packages, setup

here = os.getcwd()

with open(os.path.join(here, "requirements.txt")) as f:

def read(*parts):
with codecs.open(path.join(here, *parts), "r") as fp:
return fp.read()


# Get the long description from the README file
with codecs.open(path.join(here, "README.md"), encoding="utf-8") as f:
long_description = f.read()

with open("requirements.txt") as f:
requirements_lines = f.readlines()
install_requires = [r.strip() for r in requirements_lines if "git+" not in r]
install_requires = [r.strip() for r in requirements_lines]

package = "umitemplatedb"
setup(
name="umitemplatedb",
version="",
packages=["tests", "umitemplatedb"],
url="",
license="",
install_requires=install_requires,
name=package,
use_scm_version=True,
setup_requires=["setuptools_scm"],
packages=find_packages(exclude=["tests"]),
url="https://github.com/MITSustainableDesignLab/{}".format(package),
license="MIT",
author="Samuel Letellier-Duchesne",
author_email="[email protected]",
description="Functions to import and query the UmiTemplate DataBase",
description="Building Energy pandas extension",
long_description=long_description,
long_description_content_type="text/markdown",
keywords="archetypal umitemplatelibrary mongo mongoengine",
install_requires=install_requires,
test_suite="tests",
include_package_data=True,
classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
"Development Status :: 4 - Beta",
# Indicate who your project is intended for
"Intended Audience :: Science/Research",
# Pick your license as you wish (should match "license" above)
"License :: OSI Approved :: MIT License",
# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Operating System :: OS Independent",
],
)

0 comments on commit f0206ae

Please sign in to comment.