From af00aac627954c28feea8d105cdd01c035e177d1 Mon Sep 17 00:00:00 2001 From: miro Date: Fri, 25 Oct 2024 23:23:33 +0100 Subject: [PATCH 1/5] feat:semver --- .github/dependabot.yml | 11 +++ .github/workflows/conventional-label.yaml | 10 ++ .github/workflows/license_tests.yml | 35 ------- .github/workflows/publish_stable.yml | 58 ++++++++++++ .github/workflows/release_workflow.yml | 108 ++++++++++++++++++++++ palavreado/version.py | 6 ++ setup.py | 62 ++++++++++++- test/license_tests.py | 55 ----------- 8 files changed, 252 insertions(+), 93 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/conventional-label.yaml delete mode 100644 .github/workflows/license_tests.yml create mode 100644 .github/workflows/publish_stable.yml create mode 100644 .github/workflows/release_workflow.yml create mode 100644 palavreado/version.py delete mode 100644 test/license_tests.py diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..26e59a2 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + - package-ecosystem: "pip" # See documentation for possible values + directory: "/requirements" # Location of package manifests + schedule: + interval: "weekly" diff --git a/.github/workflows/conventional-label.yaml b/.github/workflows/conventional-label.yaml new file mode 100644 index 0000000..0a449cb --- /dev/null +++ b/.github/workflows/conventional-label.yaml @@ -0,0 +1,10 @@ +# auto add labels to PRs +on: + pull_request_target: + types: [ opened, edited ] +name: conventional-release-labels +jobs: + label: + runs-on: ubuntu-latest + steps: + - uses: bcoe/conventional-release-labels@v1 \ No newline at end of file diff --git a/.github/workflows/license_tests.yml b/.github/workflows/license_tests.yml deleted file mode 100644 index 561e773..0000000 --- a/.github/workflows/license_tests.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Run License Tests -on: - push: - workflow_dispatch: - -jobs: - license_tests: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - ref: ${{ github.head_ref }} - - name: Setup Python - uses: actions/setup-python@v1 - with: - python-version: 3.8 - - name: Install Build Tools - run: | - python -m pip install build wheel - - name: Install System Dependencies - run: | - sudo apt-get update - sudo apt install python3-dev swig libssl-dev - - name: Install core repo - run: | - pip install . - - name: Install licheck - run: | - pip install git+https://github.com/NeonJarbas/lichecker - - name: Install test dependencies - run: | - pip install pytest pytest-timeout pytest-cov - - name: Test Licenses - run: | - pytest test/license_tests.py \ No newline at end of file diff --git a/.github/workflows/publish_stable.yml b/.github/workflows/publish_stable.yml new file mode 100644 index 0000000..d7f77ea --- /dev/null +++ b/.github/workflows/publish_stable.yml @@ -0,0 +1,58 @@ +name: Stable Release +on: + push: + branches: [master] + workflow_dispatch: + +jobs: + publish_stable: + uses: TigreGotico/gh-automations/.github/workflows/publish-stable.yml@master + secrets: inherit + with: + branch: 'master' + version_file: 'palavreado/version.py' + setup_py: 'setup.py' + publish_release: true + + publish_pypi: + needs: publish_stable + if: success() # Ensure this job only runs if the previous job succeeds + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: dev + fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. + - name: Setup Python + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - name: Install Build Tools + run: | + python -m pip install build wheel + - name: version + run: echo "::set-output name=version::$(python setup.py --version)" + id: version + - name: Build Distribution Packages + run: | + python setup.py sdist bdist_wheel + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{secrets.PYPI_TOKEN}} + + + sync_dev: + needs: publish_stable + if: success() # Ensure this job only runs if the previous job succeeds + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. + ref: master + - name: Push master -> dev + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: dev \ No newline at end of file diff --git a/.github/workflows/release_workflow.yml b/.github/workflows/release_workflow.yml new file mode 100644 index 0000000..9e9721b --- /dev/null +++ b/.github/workflows/release_workflow.yml @@ -0,0 +1,108 @@ +name: Release Alpha and Propose Stable + +on: + pull_request: + types: [closed] + branches: [dev] + +jobs: + publish_alpha: + if: github.event.pull_request.merged == true + uses: TigreGotico/gh-automations/.github/workflows/publish-alpha.yml@master + secrets: inherit + with: + branch: 'dev' + version_file: 'palavreado/version.py' + setup_py: 'setup.py' + update_changelog: true + publish_prerelease: true + changelog_max_issues: 100 + + notify: + if: github.event.pull_request.merged == true + needs: publish_alpha + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Send message to Matrix bots channel + id: matrix-chat-message + uses: fadenb/matrix-chat-message@v0.0.6 + with: + homeserver: 'matrix.org' + token: ${{ secrets.MATRIX_TOKEN }} + channel: '!WjxEKjjINpyBRPFgxl:krbel.duckdns.org' + message: | + new ${{ github.event.repository.name }} PR merged! https://github.com/${{ github.repository }}/pull/${{ github.event.number }} + + publish_pypi: + needs: publish_alpha + if: success() # Ensure this job only runs if the previous job succeeds + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: dev + fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. + - name: Setup Python + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - name: Install Build Tools + run: | + python -m pip install build wheel + - name: version + run: echo "::set-output name=version::$(python setup.py --version)" + id: version + - name: Build Distribution Packages + run: | + python setup.py sdist bdist_wheel + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{secrets.PYPI_TOKEN}} + + + propose_release: + needs: publish_alpha + if: success() # Ensure this job only runs if the previous job succeeds + runs-on: ubuntu-latest + steps: + - name: Checkout dev branch + uses: actions/checkout@v3 + with: + ref: dev + + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: '3.10' + + - name: Get version from setup.py + id: get_version + run: | + VERSION=$(python setup.py --version) + echo "VERSION=$VERSION" >> $GITHUB_ENV + + - name: Create and push new branch + run: | + git checkout -b release-${{ env.VERSION }} + git push origin release-${{ env.VERSION }} + + - name: Open Pull Request from dev to master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Variables + BRANCH_NAME="release-${{ env.VERSION }}" + BASE_BRANCH="master" + HEAD_BRANCH="release-${{ env.VERSION }}" + PR_TITLE="Release ${{ env.VERSION }}" + PR_BODY="Human review requested!" + + # Create a PR using GitHub API + curl -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: token $GITHUB_TOKEN" \ + -d "{\"title\":\"$PR_TITLE\",\"body\":\"$PR_BODY\",\"head\":\"$HEAD_BRANCH\",\"base\":\"$BASE_BRANCH\"}" \ + https://api.github.com/repos/${{ github.repository }}/pulls + diff --git a/palavreado/version.py b/palavreado/version.py new file mode 100644 index 0000000..45c1596 --- /dev/null +++ b/palavreado/version.py @@ -0,0 +1,6 @@ +# START_VERSION_BLOCK +VERSION_MAJOR = 0 +VERSION_MINOR = 2 +VERSION_BUILD = 0 +VERSION_ALPHA = 0 +# END_VERSION_BLOCK diff --git a/setup.py b/setup.py index 4f556ba..1025f86 100644 --- a/setup.py +++ b/setup.py @@ -1,13 +1,69 @@ +import os +import os.path + from setuptools import setup +BASEDIR = os.path.abspath(os.path.dirname(__file__)) + + +def package_files(directory): + paths = [] + for (path, _, filenames) in os.walk(directory): + for filename in filenames: + paths.append(os.path.join('..', path, filename)) + return paths + + +def required(requirements_file): + """ Read requirements file and remove comments and empty lines. """ + with open(os.path.join(BASEDIR, requirements_file), 'r') as f: + requirements = f.read().splitlines() + if 'MYCROFT_LOOSE_REQUIREMENTS' in os.environ: + print('USING LOOSE REQUIREMENTS!') + requirements = [r.replace('==', '>=').replace('~=', '>=') for r in requirements] + return [pkg for pkg in requirements + if pkg.strip() and not pkg.startswith("#")] + + +def get_version(): + version_file = os.path.join(BASEDIR, 'palavreado', 'version.py') + major, minor, build, alpha = (None, None, None, None) + with open(version_file) as f: + for line in f: + if 'VERSION_MAJOR' in line: + major = line.split('=')[1].strip() + elif 'VERSION_MINOR' in line: + minor = line.split('=')[1].strip() + elif 'VERSION_BUILD' in line: + build = line.split('=')[1].strip() + elif 'VERSION_ALPHA' in line: + alpha = line.split('=')[1].strip() + + if ((major and minor and build and alpha) or + '# END_VERSION_BLOCK' in line): + break + version = f"{major}.{minor}.{build}" + if int(alpha): + version += f"a{alpha}" + return version + + +def get_description(): + with open(os.path.join(BASEDIR, "README.md"), "r") as f: + long_description = f.read() + return long_description + + setup( name='palavreado', - version='0.2.0', + version=get_version(), packages=['palavreado'], url='https://github.com/OpenJarbas/palavreado', license='apache-2.0', author='jarbasai', author_email='jarbasai@mailfence.com', - install_requires=["simplematch", "quebra_frases"], - description='dead simple keyword based intent parser' + install_requires=required('requirements.txt'), + description='dead simple keyword based intent parser', + long_description=get_description(), + long_description_content_type="text/markdown" ) diff --git a/test/license_tests.py b/test/license_tests.py deleted file mode 100644 index 23de276..0000000 --- a/test/license_tests.py +++ /dev/null @@ -1,55 +0,0 @@ -import unittest -from pprint import pprint - -from lichecker import LicenseChecker - -# these packages dont define license in setup.py -# manually verified and injected -license_overrides = { - "kthread": "MIT", - 'yt-dlp': "Unlicense", - 'pyxdg': 'GPL-2.0', - 'ptyprocess': 'ISC license', - 'psutil': 'BSD3' -} -# explicitly allow these packages that would fail otherwise -whitelist = [ - 'idna' # BSD-like -] - -# validation flags -allow_nonfree = False -allow_viral = False -allow_unknown = False -allow_unlicense = True -allow_ambiguous = False - -pkg_name = "palavreado" - - -class TestLicensing(unittest.TestCase): - @classmethod - def setUpClass(self): - licheck = LicenseChecker(pkg_name, - license_overrides=license_overrides, - whitelisted_packages=whitelist, - allow_ambiguous=allow_ambiguous, - allow_unlicense=allow_unlicense, - allow_unknown=allow_unknown, - allow_viral=allow_viral, - allow_nonfree=allow_nonfree) - print("Package", pkg_name) - print("Version", licheck.version) - print("License", licheck.license) - print("Transient Requirements (dependencies of dependencies)") - pprint(licheck.transient_dependencies) - self.licheck = licheck - - def test_license_compliance(self): - print("Package Versions") - pprint(self.licheck.versions) - - print("Dependency Licenses") - pprint(self.licheck.licenses) - - self.licheck.validate() From 000fcf128b1e01fd7dbf043d48bb610a65476bf5 Mon Sep 17 00:00:00 2001 From: miro Date: Fri, 25 Oct 2024 23:25:24 +0100 Subject: [PATCH 2/5] feat:semver --- readme.md => README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename readme.md => README.md (100%) diff --git a/readme.md b/README.md similarity index 100% rename from readme.md rename to README.md From d209353778b84cdcf5607f6eecafca44de0cb1b4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 20 Dec 2025 04:48:29 +0000 Subject: [PATCH 3/5] Merge pull request #2 from TigreGotico/renovate/configure Configure Renovate --- renovate.json | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 renovate.json diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..5db72dd --- /dev/null +++ b/renovate.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:recommended" + ] +} From c50629efa84b596fa67a441fc895cca68a216cba Mon Sep 17 00:00:00 2001 From: JarbasAl Date: Sat, 20 Dec 2025 04:48:40 +0000 Subject: [PATCH 4/5] Increment Version to 0.2.1a1 --- palavreado/version.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/palavreado/version.py b/palavreado/version.py index 45c1596..cc3a2a1 100644 --- a/palavreado/version.py +++ b/palavreado/version.py @@ -1,6 +1,6 @@ # START_VERSION_BLOCK VERSION_MAJOR = 0 VERSION_MINOR = 2 -VERSION_BUILD = 0 -VERSION_ALPHA = 0 +VERSION_BUILD = 1 +VERSION_ALPHA = 1 # END_VERSION_BLOCK From 82eedb757dca915bd298e7207acde37e0084fe9b Mon Sep 17 00:00:00 2001 From: JarbasAl Date: Sat, 20 Dec 2025 04:48:58 +0000 Subject: [PATCH 5/5] Update Changelog --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..6ec42a1 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,13 @@ +# Changelog + +## [0.2.1a1](https://github.com/TigreGotico/palavreado/tree/0.2.1a1) (2025-12-20) + +[Full Changelog](https://github.com/TigreGotico/palavreado/compare/0.1.0...0.2.1a1) + +**Merged pull requests:** + +- Configure Renovate [\#2](https://github.com/TigreGotico/palavreado/pull/2) ([renovate[bot]](https://github.com/apps/renovate)) + + + +\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*