From 4238ba495629a3233b809f22fc21a072835c5f9b Mon Sep 17 00:00:00 2001 From: Ricky White Date: Mon, 30 Sep 2024 06:22:04 -0400 Subject: [PATCH 1/5] Add GitHub workflow files for CI/CD (#18) --- .github/dependabot.yaml | 12 ++++++++++++ .github/workflows/lint.yaml | 26 +++++++++++++++++++++++++ .github/workflows/publish.yaml | 35 ++++++++++++++++++++++++++++++++++ .github/workflows/test.yaml | 33 ++++++++++++++++++++++++++++++++ pyproject.toml | 2 +- 5 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 .github/dependabot.yaml create mode 100644 .github/workflows/lint.yaml create mode 100644 .github/workflows/publish.yaml create mode 100644 .github/workflows/test.yaml diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 0000000..4cc0a22 --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,12 @@ +version: 2 +updates: + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "weekly" + + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..33f5a29 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,26 @@ +name: Lint Python Code + +on: + pull_request: + branches: [ master ] + push: + branches: [ master ] + workflow_dispatch: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + cache: 'pip' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install ruff + + - name: Run Ruff + run: ruff check --output-format=github diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..06ea368 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,35 @@ +name: Publish to PyPI +on: + push: + tags: + - '*.*.*' + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install .[build] + + - name: Build package + run: python -m build + + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} + + - name: Create GitHub Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release create ${{ github.ref_name }} ./dist/* --generate-notes diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..9c8b239 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,33 @@ +name: Run Tests + +on: + push: + branches: [master] + pull_request: + branches: [master] + workflow_call: + workflow_dispatch: + +jobs: + testing: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: "pip" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install .[dev] + + - name: Run Pytest + run: | + pytest diff --git a/pyproject.toml b/pyproject.toml index bb37264..90f7c3e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,4 +57,4 @@ strict = true [[tool.mypy.overrides]] module = "feedparser" - ignore_missing_imports = true + ignore_missing_imports = true \ No newline at end of file From ac72a3495e9d05d6b1839aac1ae3d9ee96b33ebf Mon Sep 17 00:00:00 2001 From: Ricky White Date: Mon, 14 Oct 2024 16:52:41 -0400 Subject: [PATCH 2/5] CI/CD updates + Bump version (#19) * Update CI/CD to reflect article changes * Version bump --- .github/dependabot.yaml | 1 + .github/workflows/publish.yaml | 7 +++++++ pyproject.toml | 4 ++-- src/reader/__init__.py | 2 +- src/reader/__main__.py | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index 4cc0a22..b783175 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -1,3 +1,4 @@ +--- version: 2 updates: - package-ecosystem: "pip" diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 06ea368..cea9dae 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -28,6 +28,13 @@ jobs: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} + - name: Test publish package + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} + repository-url: https://test.pypi.org/legacy/ + - name: Create GitHub Release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/pyproject.toml b/pyproject.toml index 90f7c3e..42e2049 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "realpython-reader" -version = "1.1.2" +version = "1.1.3" description = "Read the latest Real Python tutorials" readme = "README.md" authors = [{ name = "Real Python", email = "info@realpython.com" }] @@ -31,7 +31,7 @@ requires-python = ">=3.7" [tool.bumpver] -current_version = "1.1.2" +current_version = "1.1.3" version_pattern = "MAJOR.MINOR.PATCH" commit_message = "bump version {old_version} -> {new_version}" commit = true diff --git a/src/reader/__init__.py b/src/reader/__init__.py index 9c5c2be..c7a1d21 100644 --- a/src/reader/__init__.py +++ b/src/reader/__init__.py @@ -19,7 +19,7 @@ # Version of realpython-reader package -__version__ = "1.1.2" +__version__ = "1.1.3" # Read URL of the Real Python feed from config file _cfg = tomllib.loads(resources.read_text("reader", "config.toml")) diff --git a/src/reader/__main__.py b/src/reader/__main__.py index 57d5284..8dce069 100644 --- a/src/reader/__main__.py +++ b/src/reader/__main__.py @@ -40,7 +40,7 @@ Version: -------- -- realpython-reader v1.1.2 +- realpython-reader v1.1.3 """ # Standard library imports import sys From 63620e0ac1b3f8f428d316511fe873c60804806d Mon Sep 17 00:00:00 2001 From: Geir Arne Hjelle Date: Mon, 14 Oct 2024 23:22:35 +0200 Subject: [PATCH 3/5] Fix token for TestPyPI (#20) --- .github/workflows/publish.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index cea9dae..688ab4e 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -32,7 +32,7 @@ jobs: uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} + password: ${{ secrets.TESTPYPI_API_TOKEN }} repository-url: https://test.pypi.org/legacy/ - name: Create GitHub Release From ad951f724fc14e41cef71c86c4cf45a80251e8b4 Mon Sep 17 00:00:00 2001 From: Ricky White Date: Mon, 14 Oct 2024 17:53:38 -0400 Subject: [PATCH 4/5] Add 3.13 to testing workflow and make 3.9 the min version (#21) --- .github/workflows/lint.yaml | 2 +- .github/workflows/publish.yaml | 2 +- .github/workflows/test.yaml | 2 +- pyproject.toml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 33f5a29..2f647cc 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: '3.13' cache: 'pip' - name: Install dependencies diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 688ab4e..512e334 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -12,7 +12,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: '3.13' - name: Install dependencies run: | diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9c8b239..2f6ec97 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 diff --git a/pyproject.toml b/pyproject.toml index 42e2049..4a06025 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ classifiers = [ ] keywords = ["feed", "reader", "tutorial"] dependencies = ["feedparser", "html2text", 'tomli; python_version < "3.11"'] -requires-python = ">=3.7" +requires-python = ">=3.9" [project.optional-dependencies] build = ["build", "twine"] From fe3712693f6220587d76c71f777a0d71b6ba14c6 Mon Sep 17 00:00:00 2001 From: Geir Arne Hjelle Date: Mon, 14 Oct 2024 23:58:08 +0200 Subject: [PATCH 5/5] bump version 1.1.3 -> 1.1.4 --- pyproject.toml | 4 ++-- src/reader/__init__.py | 2 +- src/reader/__main__.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4a06025..b2be1ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "realpython-reader" -version = "1.1.3" +version = "1.1.4" description = "Read the latest Real Python tutorials" readme = "README.md" authors = [{ name = "Real Python", email = "info@realpython.com" }] @@ -31,7 +31,7 @@ requires-python = ">=3.9" [tool.bumpver] -current_version = "1.1.3" +current_version = "1.1.4" version_pattern = "MAJOR.MINOR.PATCH" commit_message = "bump version {old_version} -> {new_version}" commit = true diff --git a/src/reader/__init__.py b/src/reader/__init__.py index c7a1d21..383f287 100644 --- a/src/reader/__init__.py +++ b/src/reader/__init__.py @@ -19,7 +19,7 @@ # Version of realpython-reader package -__version__ = "1.1.3" +__version__ = "1.1.4" # Read URL of the Real Python feed from config file _cfg = tomllib.loads(resources.read_text("reader", "config.toml")) diff --git a/src/reader/__main__.py b/src/reader/__main__.py index 8dce069..56e5fa7 100644 --- a/src/reader/__main__.py +++ b/src/reader/__main__.py @@ -40,7 +40,7 @@ Version: -------- -- realpython-reader v1.1.3 +- realpython-reader v1.1.4 """ # Standard library imports import sys