Skip to content

Commit

Permalink
migrates to GitHub Workflows :octocat:
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertoPrevato authored Nov 8, 2020
1 parent 8de7043 commit 007ca18
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 71 deletions.
115 changes: 72 additions & 43 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
name: Build

on:
release:
types: [published]
push:
branches:
- master
- ci
pull_request:
branches:
- '*'
- "*"

env:
PROJECT_NAME: rodi
Expand All @@ -17,56 +19,83 @@ jobs:
runs-on: ubuntu-18.04
strategy:
matrix:
python-version: [3.7, 3.8]
python-version: [3.6, 3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v1
with:
fetch-depth: 9
submodules: false
- uses: actions/checkout@v1
with:
fetch-depth: 9
submodules: false

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

- uses: actions/cache@v1
id: depcache
with:
path: deps
key: requirements-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
- uses: actions/cache@v1
id: depcache
with:
path: deps
key: requirements-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}

- name: Download dependencies
if: steps.depcache.outputs.cache-hit != 'true'
run: |
pip download --dest=deps -r requirements.txt
- name: Download dependencies
if: steps.depcache.outputs.cache-hit != 'true'
run: |
pip download --dest=deps -r requirements.txt
- name: Install dependencies
run: |
pip install -U --no-index --find-links=deps deps/*
- name: Install dependencies
run: |
pip install -U --no-index --find-links=deps deps/*
- name: Run tests
run: |
flake8 && pytest --doctest-modules --junitxml=junit/pytest-results-${{ matrix.python-version }}.xml --cov=$PROJECT_NAME --cov-report=xml tests/
- name: Run tests
run: |
flake8 && pytest --doctest-modules --junitxml=junit/pytest-results-${{ matrix.python-version }}.xml --cov=$PROJECT_NAME --cov-report=xml tests/
- name: Upload pytest test results
uses: actions/upload-artifact@master
with:
name: pytest-results-${{ matrix.python-version }}
path: junit/pytest-results-${{ matrix.python-version }}.xml
if: always()
- name: Upload pytest test results
uses: actions/upload-artifact@master
with:
name: pytest-results-${{ matrix.python-version }}
path: junit/pytest-results-${{ matrix.python-version }}.xml
if: always()

- name: Install distribution dependencies
run: pip install --upgrade twine setuptools wheel
if: github.event.pull_request.merged && matrix.python-version == 3.8
- name: Codecov
run: |
bash <(curl -s https://codecov.io/bash)
- name: Create distribution package
run: python setup.py sdist bdist_wheel
if: github.event.pull_request.merged && matrix.python-version == 3.8
- name: Install distribution dependencies
run: pip install --upgrade twine setuptools wheel
if: github.event.pull_request.merged && matrix.python-version == 3.9

- name: Upload distribution package
uses: actions/upload-artifact@master
with:
name: dist-package-${{ matrix.python-version }}
path: dist
if: github.event.pull_request.merged && matrix.python-version == 3.8
- name: Create distribution package
run: python setup.py sdist bdist_wheel
if: github.event.pull_request.merged && matrix.python-version == 3.9

- name: Upload distribution package
uses: actions/upload-artifact@master
with:
name: dist-package-${{ matrix.python-version }}
path: dist
if: github.event.pull_request.merged && matrix.python-version == 3.9

publish:
runs-on: ubuntu-18.04
needs: build
if: github.event_name == 'release'
steps:
- name: Download a distribution artifact
uses: actions/download-artifact@v2
with:
name: dist-package-3.9
path: dist
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@master
with:
skip_existing: true
user: __token__
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.9] - 2020-11-08 :octocat:
- Completely migrates to GitHub Workflows
- Improves build to test Python 3.6 and 3.9
- Adds a changelog
- Improves badges
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[![Build](https://github.com/RobertoPrevato/rodi/workflows/Build/badge.svg)](https://github.com/RobertoPrevato/rodi/actions?query=workflow%3ABuild)
[![Build status](https://dev.azure.com/robertoprevato/rodi/_apis/build/status/rodi-CI)](https://dev.azure.com/robertoprevato/rodi/_build/latest?definitionId=8) [![pypi](https://robertoprevato.vsrm.visualstudio.com/_apis/public/Release/badge/06ceb1f2-6ca8-4981-97ca-14cc8b599bc7/1/2)](https://pypi.org/project/rodi/) [![Test coverage](https://img.shields.io/azure-devops/coverage/robertoprevato/rodi/8/master.svg)](https://robertoprevato.visualstudio.com/rodi/_build?definitionId=8)
![Build](https://github.com/RobertoPrevato/rodi/workflows/Build/badge.svg)
[![pypi](https://img.shields.io/pypi/v/rodi.svg)](https://pypi.python.org/pypi/rodi)
[![versions](https://img.shields.io/pypi/pyversions/rodi.svg)](https://github.com/RobertoPrevato/rodi)
[![license](https://img.shields.io/github/license/RobertoPrevato/rodi.svg)](https://github.com/RobertoPrevato/rodi/blob/master/LICENSE)
[![codecov](https://codecov.io/gh/RobertoPrevato/rodi/branch/master/graph/badge.svg?token=VzAnusWIZt)](https://codecov.io/gh/RobertoPrevato/rodi)

# Implementation of dependency injection for Python 3

Expand Down Expand Up @@ -51,8 +54,3 @@ assert cat.name == "Celine"

# Documentation
For documentation and examples, please refer to the [wiki in GitHub, https://github.com/RobertoPrevato/rodi/wiki](https://github.com/RobertoPrevato/rodi/wiki).

---

## Public project in Azure DevOps
[https://dev.azure.com/robertoprevato/rodi](https://dev.azure.com/robertoprevato/rodi) - see here the project in Azure DevOps, with [builds](https://dev.azure.com/robertoprevato/rodi/_build?definitionId=8).
48 changes: 27 additions & 21 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,33 @@


def readme():
with open('README.md') as f:
with open("README.md") as f:
return f.read()


setup(name='rodi',
version='1.0.8',
description='Implementation of dependency injection for Python 3',
long_description=readme(),
long_description_content_type='text/markdown',
classifiers=[
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'Operating System :: OS Independent'
],
url='https://github.com/RobertoPrevato/rodi',
author='RobertoPrevato',
author_email='[email protected]',
keywords='dependency injection type hints typing convention',
license='MIT',
packages=['rodi'],
install_requires=[],
include_package_data=True,
zip_safe=False)
setup(
name="rodi",
version="1.0.9",
description="Implementation of dependency injection for Python 3",
long_description=readme(),
long_description_content_type="text/markdown",
classifiers=[
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Operating System :: OS Independent",
],
url="https://github.com/RobertoPrevato/rodi",
author="RobertoPrevato",
author_email="[email protected]",
keywords="dependency injection type hints typing convention",
license="MIT",
packages=["rodi"],
install_requires=[],
include_package_data=True,
zip_safe=False,
)

0 comments on commit 007ca18

Please sign in to comment.