From a8d9f76b5f999615e623dc1a5b37287a42bad841 Mon Sep 17 00:00:00 2001 From: Simon Brugman Date: Wed, 24 Nov 2021 17:13:49 +0100 Subject: [PATCH 1/2] docs(rtd): migrate config to v2 --- .readthedocs.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index caf5186a..1af04fec 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,11 +1,10 @@ -# See: https://docs.readthedocs.io/en/latest/yaml-config.html -# .readthedocs.yml +# See: https://docs.readthedocs.io/en/latest/config-file/v2.html +version: 2 build: image: latest python: - version: 3.8 - setup_py_install: true + version: '3.8' install: - requirements: docs/requirements.txt From 9a6c4c017e34b0405eff62569471d67d7c074511 Mon Sep 17 00:00:00 2001 From: Simon Brugman Date: Wed, 24 Nov 2021 17:15:12 +0100 Subject: [PATCH 2/2] ci: migrate from standard-version to python-semantic-release automates larger parts of the release process --- .github/workflows/pypi.yml | 45 ----------------------------------- .github/workflows/release.yml | 32 ++++++++++++------------- .versionrc.json | 16 ------------- CHANGELOG.md | 2 ++ bump.py | 37 ---------------------------- package.json | 13 ---------- popmon/version.py | 2 +- pyproject.toml | 8 ++++++- setup.py | 4 +++- 9 files changed, 29 insertions(+), 130 deletions(-) delete mode 100644 .github/workflows/pypi.yml delete mode 100644 .versionrc.json delete mode 100644 bump.py delete mode 100644 package.json diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml deleted file mode 100644 index ba51d096..00000000 --- a/.github/workflows/pypi.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Deploy to PyPi - -on: - release: - types: [created] - -jobs: - release: - if: github.event_name == 'release' && github.event.action == 'created' - name: PyPi Release - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - name: Checkout repo - - - name: Set up Python 3.6 - uses: actions/setup-python@v1 - with: - python-version: 3.6 - - - uses: actions/cache@v1 - name: Cache pip dependencies - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - name: Install pip dependencies - run: | - pip install --upgrade pip - pip install -r requirements.txt - - name: Install - run: make install - - - name: Make distribution - run: | - pip install twine wheel - python setup.py sdist bdist_wheel - twine check dist/* - - name: Publish a Python distribution to PyPI - uses: pypa/gh-action-pypi-publish@master - with: - user: __token__ - password: ${{ secrets.PYPI_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6d16de47..7bc4bbdb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,23 +1,23 @@ -# Creates a draft release when a new tag is pushed -name: Release +name: Semantic Release on: push: - tags: - - "v*.*.*" + branches: + - master jobs: - build: + release: runs-on: ubuntu-latest + concurrency: release + steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Get the version - id: get_version - run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - - name: Release - uses: softprops/action-gh-release@v1 - with: - name: "popmon ${{ steps.get_version.outputs.VERSION }}" - body: "Release notes are available [here](https://github.com/ing-bank/popmon/blob/master/CHANGELOG.md)." - draft: true + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Python Semantic Release + uses: relekang/python-semantic-release@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + repository_username: __token__ + repository_password: ${{ secrets.PYPI_TOKEN }} diff --git a/.versionrc.json b/.versionrc.json deleted file mode 100644 index f5efefe3..00000000 --- a/.versionrc.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "header": "Release notes", - "types": [ - {"type": "feat", "section": "\uD83C\uDF89 Features"}, - {"type": "fix", "section": "\uD83D\uDC1B Bug fixes"}, - {"type": "perf", "section": "⚡ Performance improvements"}, - {"type": "docs", "section": "\uD83D\uDCD6 Documentation"}, - {"type": "style", "section": "\uD83D\uDC77\u200D♂️ Internal improvements"}, - {"type": "refactor", "section": "\uD83D\uDC77\u200D♂️ Internal improvements"}, - {"type": "build", "section": "⬆️ Dependencies"}, - {"type": "chore", "hidden": true}, - {"type": "test", "hidden": true} - ], - "commitUrlFormat": "https://github.com/ing-bank/popmon/commits/{{hash}}", - "compareUrlFormat": "https://github.com/ing-bank/popmon/compare/{{previousTag}}...{{currentTag}}" -} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index b13d51ae..9ed4ccd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Release notes + + ## [v0.4.4](https://github.com/ing-bank/popmon/compare/v0.4.3...v0.4.4) (2021-10-22) diff --git a/bump.py b/bump.py deleted file mode 100644 index 50c8df52..00000000 --- a/bump.py +++ /dev/null @@ -1,37 +0,0 @@ -import re -from pathlib import Path - -MAJOR = 0 -REVISION = 5 -PATCH = 0 -VERSION = f"{MAJOR}.{REVISION}.{PATCH}" - - -def write_version_py(filename: str = "popmon/version.py") -> None: - """Write package version to version.py. - - This will ensure that the version in version.py is in sync with us. - - :param filename: The version.py to write too. - :type filename: str - """ - # Do not modify the indentation of version_str! - version_str = f"""\"\"\"THIS FILE IS AUTO-GENERATED BY SETUP.PY.\"\"\" - -version = \"{VERSION:s}\" -""" - - with open(filename, "w") as version_file: - version_file.write(version_str) - - -def update_setup_py(filename="setup.py"): - contents = Path(filename).read_text() - contents = re.sub( - r'version="[0-9]+\.[0-9]+\.[0-9]+[A-Za-z]*",', f'version="{VERSION}",', contents - ) - Path(filename).write_text(contents) - - -write_version_py() -update_setup_py() diff --git a/package.json b/package.json deleted file mode 100644 index 24139e98..00000000 --- a/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "scripts": { - "release": "standard-version", - "bump": "python bump.py" - }, - "standard-version": { - "skip": { - "bump": true, - "commit": true, - "tag": true - } - } -} \ No newline at end of file diff --git a/popmon/version.py b/popmon/version.py index 5aa30b4d..e143821c 100644 --- a/popmon/version.py +++ b/popmon/version.py @@ -1,3 +1,3 @@ """THIS FILE IS AUTO-GENERATED BY SETUP.PY.""" -version = "0.5.0" +version = "0.4.4" diff --git a/pyproject.toml b/pyproject.toml index e860a5c0..59a3807d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,4 +7,10 @@ markers = ["spark"] "spark.executor.instances" = 1 "master" = "local[*]" "spark.driver.host" = "192.168.1.78" -"spark.sql.catalogImplementation" = "in-memory" \ No newline at end of file +"spark.sql.catalogImplementation" = "in-memory" + +[tool.semantic_release] +version_variable = [ + "setup.py:__version__", + "popmon/version.py:version", +] \ No newline at end of file diff --git a/setup.py b/setup.py index 2cfbfcd6..9037e1b4 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,7 @@ from setuptools import find_packages, setup +__version__ = "0.4.4" + with open("requirements.txt") as f: REQUIREMENTS = f.read().splitlines() @@ -15,7 +17,7 @@ def setup_package() -> None: """ setup( name="popmon", - version="0.4.4", + version=__version__, url="https://github.com/ing-bank/popmon", license="MIT", author="ING Wholesale Banking Advanced Analytics",