From 007ca188e15e52ced8a254582654d6d6cc0e2957 Mon Sep 17 00:00:00 2001 From: Roberto Prevato Date: Sun, 8 Nov 2020 10:39:44 +0100 Subject: [PATCH] migrates to GitHub Workflows :octocat: --- .github/workflows/build.yml | 115 ++++++++++++++++++++++-------------- CHANGELOG.md | 12 ++++ README.md | 12 ++-- setup.py | 48 ++++++++------- 4 files changed, 116 insertions(+), 71 deletions(-) create mode 100644 CHANGELOG.md diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 167a7ad..ff1ceb7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,13 +1,15 @@ name: Build on: + release: + types: [published] push: branches: - master - ci pull_request: branches: - - '*' + - "*" env: PROJECT_NAME: rodi @@ -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 }} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e75c3cf --- /dev/null +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index cfb07c6..313fe56 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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). diff --git a/setup.py b/setup.py index 1544223..e636e92 100644 --- a/setup.py +++ b/setup.py @@ -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='roberto.prevato@gmail.com', - 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="roberto.prevato@gmail.com", + keywords="dependency injection type hints typing convention", + license="MIT", + packages=["rodi"], + install_requires=[], + include_package_data=True, + zip_safe=False, +)