diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 10d7e38..a771291 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,3 +1,4 @@ +--- # this file is *not* meant to cover or endorse the use of GitHub Actions, but rather to # help make automated releases for this project @@ -15,48 +16,48 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v3 - with: - python-version: '3.9' - - name: Install build and deploy dependencies - run: | - python -m pip install -U setuptools wheel build - if [ -f requirements-deploy.txt ]; then pip install -r requirements-deploy.txt; fi - pip install . - - name: Parse changelog - id: parse_changelog - run: | - changelog2version --changelog_file changelog.md --print | python -c "import sys, json; print(json.load(sys.stdin)['info']['description'])" > latest_description.txt - echo 'LATEST_DESCRIPTION<<"EOT"' >> $GITHUB_OUTPUT - cat latest_description.txt >> $GITHUB_OUTPUT - echo '"EOT"' >> $GITHUB_OUTPUT - latest_version=$(changelog2version --changelog_file changelog.md --print | python -c "import sys, json; print(json.load(sys.stdin)['info']['version'])") - echo "latest_version=$latest_version" >> $GITHUB_ENV - - name: Build package - run: | - changelog2version \ - --changelog_file changelog.md \ - --version_file src/changelog2version/version.py \ - --version_file_type py \ - --debug - python -m build . - - name: Publish package - uses: pypa/gh-action-pypi-publish@release/v1.5 - with: - password: ${{ secrets.PYPI_API_TOKEN }} - skip_existing: true - verbose: true - print_hash: true - - name: Create Release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ env.latest_version }} - release_name: ${{ env.latest_version }} - body: ${{ steps.parse_changelog.outputs.LATEST_DESCRIPTION }} - draft: false - prerelease: false + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.9' + - name: Install build and deploy dependencies + run: | + python -m pip install -U setuptools wheel build + if [ -f requirements-deploy.txt ]; then pip install -r requirements-deploy.txt; fi + pip install . + - name: Parse changelog + id: parse_changelog + run: | + changelog2version --changelog_file changelog.md --print | python -c "import sys, json; print(json.load(sys.stdin)['info']['description'])" > latest_description.txt + echo 'LATEST_DESCRIPTION<<"EOT"' >> $GITHUB_OUTPUT + cat latest_description.txt >> $GITHUB_OUTPUT + echo '"EOT"' >> $GITHUB_OUTPUT + latest_version=$(changelog2version --changelog_file changelog.md --print | python -c "import sys, json; print(json.load(sys.stdin)['info']['version'])") + echo "latest_version=$latest_version" >> $GITHUB_ENV + - name: Build package + run: | + changelog2version \ + --changelog_file changelog.md \ + --version_file src/changelog2version/version.py \ + --version_file_type py \ + --debug + python -m build . + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1.5 + with: + password: ${{ secrets.PYPI_API_TOKEN }} + skip_existing: true + verbose: true + print_hash: true + - name: Create Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ env.latest_version }} + release_name: ${{ env.latest_version }} + body: ${{ steps.parse_changelog.outputs.LATEST_DESCRIPTION }} + draft: false + prerelease: false diff --git a/.github/workflows/test-release.yaml b/.github/workflows/test-release.yaml index ee4e863..5da510e 100644 --- a/.github/workflows/test-release.yaml +++ b/.github/workflows/test-release.yaml @@ -1,3 +1,4 @@ +--- # this file is *not* meant to cover or endorse the use of GitHub Actions, but rather to # help make automated releases for this project @@ -12,61 +13,61 @@ jobs: test-deploy: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v3 - with: - python-version: '3.9' - - name: Install deploy dependencies - run: | - python -m pip install -U setuptools wheel build - if [ -f requirements-deploy.txt ]; then pip install -r requirements-deploy.txt; fi - pip install . - - name: Parse changelog - id: parse_changelog - run: | - changelog2version --changelog_file changelog.md --print | python -c "import sys, json; print(json.load(sys.stdin)['info']['description'])" > latest_description.txt - echo 'LATEST_DESCRIPTION<<"EOT"' >> $GITHUB_OUTPUT - cat latest_description.txt >> $GITHUB_OUTPUT - echo '"EOT"' >> $GITHUB_OUTPUT - latest_version=$(changelog2version --changelog_file changelog.md --print | python -c "import sys, json; print(json.load(sys.stdin)['info']['version'])") - echo "latest_version=$latest_version" >> $GITHUB_ENV - - name: Build package - run: | - changelog2version \ - --changelog_file changelog.md \ - --version_file src/changelog2version/version.py \ - --version_file_type py \ - --additional_version_info="-rc${{ github.run_number }}.dev${{ github.event.number }}" \ - --debug - python -m build . - - name: Test built package - run: | - twine check dist/*.tar.gz - - name: Archive build package artifact - uses: actions/upload-artifact@v3 - with: - # https://docs.github.com/en/actions/learn-github-actions/contexts#github-context - # ${{ github.repository }} and ${{ github.ref_name }} can't be used for artifact name due to unallowed '/' - name: dist_py.${{ github.event.repository.name }}_sha.${{ github.sha }}_build.${{ github.run_number }} - path: dist/*.tar.gz - retention-days: 14 - - name: Publish package - uses: pypa/gh-action-pypi-publish@release/v1.5 - with: - repository_url: https://test.pypi.org/legacy/ - password: ${{ secrets.TEST_PYPI_API_TOKEN }} - skip_existing: true - verbose: true - print_hash: true - - name: Create Prerelease - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ env.latest_version }}-rc${{ github.run_number }}.dev${{ github.event.number }} - release_name: ${{ env.latest_version }}-rc${{ github.run_number }}.dev${{ github.event.number }} - body: ${{ steps.parse_changelog.outputs.LATEST_DESCRIPTION }} - draft: false - prerelease: true + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.9' + - name: Install deploy dependencies + run: | + python -m pip install -U setuptools wheel build + if [ -f requirements-deploy.txt ]; then pip install -r requirements-deploy.txt; fi + pip install . + - name: Parse changelog + id: parse_changelog + run: | + changelog2version --changelog_file changelog.md --print | python -c "import sys, json; print(json.load(sys.stdin)['info']['description'])" > latest_description.txt + echo 'LATEST_DESCRIPTION<<"EOT"' >> $GITHUB_OUTPUT + cat latest_description.txt >> $GITHUB_OUTPUT + echo '"EOT"' >> $GITHUB_OUTPUT + latest_version=$(changelog2version --changelog_file changelog.md --print | python -c "import sys, json; print(json.load(sys.stdin)['info']['version'])") + echo "latest_version=$latest_version" >> $GITHUB_ENV + - name: Build package + run: | + changelog2version \ + --changelog_file changelog.md \ + --version_file src/changelog2version/version.py \ + --version_file_type py \ + --additional_version_info="-rc${{ github.run_number }}.dev${{ github.event.number }}" \ + --debug + python -m build . + - name: Test built package + run: | + twine check dist/*.tar.gz + - name: Archive build package artifact + uses: actions/upload-artifact@v3 + with: + # https://docs.github.com/en/actions/learn-github-actions/contexts#github-context + # ${{ github.repository }} and ${{ github.ref_name }} can't be used for artifact name due to unallowed '/' + name: dist_py.${{ github.event.repository.name }}_sha.${{ github.sha }}_build.${{ github.run_number }} + path: dist/*.tar.gz + retention-days: 14 + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1.5 + with: + repository_url: https://test.pypi.org/legacy/ + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + skip_existing: true + verbose: true + print_hash: true + - name: Create Prerelease + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ env.latest_version }}-rc${{ github.run_number }}.dev${{ github.event.number }} + release_name: ${{ env.latest_version }}-rc${{ github.run_number }}.dev${{ github.event.number }} + body: ${{ steps.parse_changelog.outputs.LATEST_DESCRIPTION }} + draft: false + prerelease: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3de2086..14faf46 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,3 +1,4 @@ +--- # 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 @@ -19,37 +20,37 @@ jobs: # runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ['3.7', '3.8', '3.9', '3.10'] + python-version: ['3.8', '3.9', '3.10', '3.11'] # os: [ubuntu-latest, macos-latest, windows-latest] steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - # python-version: '3.9' - - name: Install dependencies - run: | - python -m pip install .[dev] - python -m pip install .[test] - - name: Test with tox - run: | - python -m tox -e py - # echo "Passing :P" - - name: Install deploy dependencies - run: | - python -m pip install -U setuptools wheel build - if [ -f requirements-deploy.txt ]; then pip install -r requirements-deploy.txt; fi - pip install . - - name: Build package - run: | - changelog2version \ - --changelog_file changelog.md \ - --version_file src/changelog2version/version.py \ - --version_file_type py \ - --debug - python -m build . - - name: Test built package - run: | - twine check dist/*.tar.gz + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + # python-version: '3.9' + - name: Install dependencies + run: | + python -m pip install .[dev] + python -m pip install .[test] + - name: Test with tox + run: | + python -m tox -e py + # echo "Passing :P" + - name: Install deploy dependencies + run: | + python -m pip install -U setuptools wheel build + if [ -f requirements-deploy.txt ]; then pip install -r requirements-deploy.txt; fi + pip install . + - name: Build package + run: | + changelog2version \ + --changelog_file changelog.md \ + --version_file src/changelog2version/version.py \ + --version_file_type py \ + --debug + python -m build . + - name: Test built package + run: | + twine check dist/*.tar.gz diff --git a/.github/workflows/unittest.yaml b/.github/workflows/unittest.yaml index 374a5cf..0a302c6 100644 --- a/.github/workflows/unittest.yaml +++ b/.github/workflows/unittest.yaml @@ -1,3 +1,4 @@ +--- # this file is *not* meant to cover or endorse the use of GitHub Actions, but rather to # help make automated releases for this project @@ -12,24 +13,24 @@ jobs: test-and-coverage: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v3 - with: - python-version: '3.9' - - name: Execute tests - run: | - pip install .[test] - python create_report_dirs.py - nose2 --config tests/unittest.cfg - - name: Create coverage report - run: | - coverage xml - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./reports/coverage/coverage.xml - flags: unittests - fail_ci_if_error: true - # path_to_write_report: ./reports/coverage/codecov_report.txt - verbose: true + - uses: actions/checkout@v2 + - uses: actions/setup-python@v3 + with: + python-version: '3.9' + - name: Execute tests + run: | + pip install .[test] + python create_report_dirs.py + nose2 --config tests/unittest.cfg + - name: Create coverage report + run: | + coverage xml + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./reports/coverage/coverage.xml + flags: unittests + fail_ci_if_error: true + # path_to_write_report: ./reports/coverage/codecov_report.txt + verbose: true diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..24d0614 --- /dev/null +++ b/.yamllint @@ -0,0 +1,13 @@ +--- + +extends: default + +ignore: + - .tox + - .venv + +rules: + line-length: + level: warning + ignore: + - .github/workflows/* diff --git a/changelog.md b/changelog.md index 81c3457..169217f 100644 --- a/changelog.md +++ b/changelog.md @@ -17,6 +17,13 @@ r"^\#\# \[\d{1,}[.]\d{1,}[.]\d{1,}\] \- \d{4}\-\d{2}-\d{2}$" --> ## Released +## [0.10.1] - 2024-10-02 +### Fixed +- add support for `Python 3.11` +- update `twine` version to `5.1.1` or newer to fix KeyError issue +- drop release testing with `Python 3.7` +- yaml syntax is correct for all workflow files + ## [0.10.0] - 2023-07-08 ### Added - `--validate` argument can be used to validate an existing version file against the latest changelog entry @@ -166,8 +173,9 @@ r"^\#\# \[\d{1,}[.]\d{1,}[.]\d{1,}\] \- \d{4}\-\d{2}-\d{2}$" - Data folder after fork -[Unreleased]: https://github.com/brainelectronics/changelog2version/compare/0.10.0...main +[Unreleased]: https://github.com/brainelectronics/changelog2version/compare/0.10.1...main +[0.10.1]: https://github.com/brainelectronics/changelog2version/tree/0.10.1 [0.10.0]: https://github.com/brainelectronics/changelog2version/tree/0.10.0 [0.9.0]: https://github.com/brainelectronics/changelog2version/tree/0.9.0 [0.8.0]: https://github.com/brainelectronics/changelog2version/tree/0.8.0 diff --git a/requirements-deploy.txt b/requirements-deploy.txt index bed57a2..f4cdfdb 100644 --- a/requirements-deploy.txt +++ b/requirements-deploy.txt @@ -1,4 +1,4 @@ # List external packages here # Avoid fixed versions # # to upload package to PyPi or other package hosts -twine>=4.0.1,<5 +twine>=5.1.1,<6 diff --git a/setup.py b/setup.py index c7c1142..fdc1f40 100644 --- a/setup.py +++ b/setup.py @@ -5,10 +5,11 @@ https://github.com/pypa/sampleproject """ -# Always prefer setuptools over distutils -from setuptools import setup, find_packages import pathlib +# Always prefer setuptools over distutils +from setuptools import find_packages, setup + here = pathlib.Path(__file__).parent.resolve() # Get the long description from the README file @@ -99,6 +100,7 @@ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3 :: Only", ], # This field adds keywords for your project which will appear on the