From 6c14d00cda95587f4cfe63f83052116bf9d67468 Mon Sep 17 00:00:00 2001 From: Bastian Krause Date: Thu, 28 Sep 2023 18:37:59 +0200 Subject: [PATCH 1/9] tests: fix typos Signed-off-by: Bastian Krause --- tests/test_core_project_templates.py | 2 +- tests/test_documentation.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_core_project_templates.py b/tests/test_core_project_templates.py index e895951..8a15e50 100644 --- a/tests/test_core_project_templates.py +++ b/tests/test_core_project_templates.py @@ -24,7 +24,7 @@ def test_project_template(template_name, run): import os if not os.environ.get('EXTENDED_BUILD_TESTS', ''): - pytest.skip('EXTENDED_BUILD_TESTS is disabeld') + pytest.skip('EXTENDED_BUILD_TESTS is disabled') flamingo_path = os.path.dirname(os.path.dirname(__file__)) diff --git a/tests/test_documentation.py b/tests/test_documentation.py index afba071..ef4a8a1 100644 --- a/tests/test_documentation.py +++ b/tests/test_documentation.py @@ -4,7 +4,7 @@ def test_documentation(run): import os if not os.environ.get('EXTENDED_BUILD_TESTS', ''): - pytest.skip('EXTENDED_BUILD_TESTS is disabeld') + pytest.skip('EXTENDED_BUILD_TESTS is disabled') if (sys.version_info.major, sys.version_info.minor, ) != (3, 6, ): pytest.skip('documentation python3.6') From ee7b916712ebb6aacedb9f9567e4a414bb2b63f7 Mon Sep 17 00:00:00 2001 From: Bastian Krause Date: Fri, 29 Sep 2023 15:25:37 +0200 Subject: [PATCH 2/9] tests/plugin_git: do not rely on tags in repo `git describe` will fail if no tags are available. This happens with clones without tags, e.g. `git clone --no-tags [...]`, forks without tags and is the default of actions/checkout@v4 [1]. Add the `--always` option to `git describe` to show the "uniquely abbreviated commit object as fallback" [2]. [1] https://github.com/actions/checkout/blob/v4/README.md#usage [2] https://git-scm.com/docs/git-describe#Documentation/git-describe.txt---always Signed-off-by: Bastian Krause --- tests/test_plugin_Git.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/test_plugin_Git.py b/tests/test_plugin_Git.py index 07eb29f..7c56d40 100644 --- a/tests/test_plugin_Git.py +++ b/tests/test_plugin_Git.py @@ -20,12 +20,14 @@ def git_is_not_installed(): def test_git(flamingo_env, run): - version = run('git describe')[1].strip() + version = run('git describe --always')[1].strip() flamingo_env.settings.PLUGINS = [ 'flamingo.plugins.Git', ] + flamingo_env.settings.GIT_VERSION_CMD = 'git describe --always' + flamingo_env.write('/content/article.rst', """ Article @@ -44,7 +46,7 @@ def test_git(flamingo_env, run): def test_invalid_command(flamingo_env, run, caplog): import logging - version = run('git describe')[1].strip() + version = run('git describe --always')[1].strip() flamingo_env.settings.PLUGINS = [ 'flamingo.plugins.Git', @@ -74,7 +76,7 @@ def test_invalid_command(flamingo_env, run, caplog): def test_invalid_return_code(flamingo_env, run, caplog): - version = run('git describe')[1].strip() + version = run('git describe --always')[1].strip() flamingo_env.settings.PLUGINS = [ 'flamingo.plugins.Git', From 0ddbf4c2498001ed46bf22bafa97a77c682805c9 Mon Sep 17 00:00:00 2001 From: Bastian Krause Date: Thu, 28 Sep 2023 19:29:21 +0200 Subject: [PATCH 3/9] tox: move setenv=FLAMINGO_TEST=1 to "testenv:.pkg" section Since tox 4, "packaging environments no longer inherit their settings from the testenv section" [1]. This becomes an issue for flamingo because the environment variable FLAMINGO_TEST is checked in its setup.py. Fix this by moving the setenv directive to the build environment section. passenv= in flamingo is not affected because other env lookups are performed outside of its setup.py. [1] https://tox.wiki/en/4.11.3/upgrading.html#packaging-configuration-and-inheritance Signed-off-by: Bastian Krause --- tox.ini | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index fc43593..6c2f489 100644 --- a/tox.ini +++ b/tox.ini @@ -6,11 +6,13 @@ envlist=python [tox:jenkins] envlist=lint,py36,py37,py38,py39 +[testenv:.pkg] +setenv = + FLAMINGO_TEST=1 [testenv] passenv=* ignore_errors=True -setenv=FLAMINGO_TEST=1 deps = pytest From 6fb74a793252641c0fa573e2d197765269bd235b Mon Sep 17 00:00:00 2001 From: Bastian Krause Date: Fri, 29 Sep 2023 15:00:55 +0200 Subject: [PATCH 4/9] setup/tox: fix supported Python versions Testing with Python 3.6 has been dropped a while ago, while Python 3.10 testing was added. Advertise these versions and adjust the tox environments accordingly. Fixes: ae476f3 (".travis: Python versions update") Signed-off-by: Bastian Krause --- setup.cfg | 2 +- tox.ini | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 89b5c37..7818dc5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -11,10 +11,10 @@ classifiers = License :: OSI Approved :: Apache Software License Natural Language :: English Operating System :: Unix - Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 Programming Language :: Python :: 3 :: Only Programming Language :: Python :: Implementation Programming Language :: Python :: Implementation :: CPython diff --git a/tox.ini b/tox.ini index 6c2f489..7c45c60 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ envlist=python [tox:jenkins] -envlist=lint,py36,py37,py38,py39 +envlist=lint,py37,py38,py39,py310 [testenv:.pkg] setenv = From 0ece7e0b95a91e8ceab26b9f01fa5149b5329cb4 Mon Sep 17 00:00:00 2001 From: Bastian Krause Date: Sat, 30 Sep 2023 13:41:01 +0200 Subject: [PATCH 5/9] plugins: fix linter warnings Fix warnings emitted by `tox -e lint`. Use recommendations from black [1] for affected lines only. [1] https://github.com/psf/black Signed-off-by: Bastian Krause --- flamingo/plugins/feeds.py | 25 ++++++++++++++----- .../plugins/sphinx_themes/sphinx_theme.py | 4 ++- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/flamingo/plugins/feeds.py b/flamingo/plugins/feeds.py index f8a080d..bf5630f 100644 --- a/flamingo/plugins/feeds.py +++ b/flamingo/plugins/feeds.py @@ -34,7 +34,9 @@ def pre_build(self, context): if feed_config['type'] in ['rss', 'podcast']: fg.description(feed_config['description']) fg.link(href=feed_config['link'], rel='self') - fg.link(href=feed_config['link_alternate'], rel='alternate') + fg.link( + href=feed_config['link_alternate'], rel='alternate' + ) # setup podcast environment if feed_config['type'] == 'podcast': @@ -43,9 +45,13 @@ def pre_build(self, context): if 'itunes_owner' in feed_config: fg.podcast.itunes_owner(**feed_config['itunes_owner']) if 'itunes_category' in feed_config: - fg.podcast.itunes_category(feed_config['itunes_category']) + fg.podcast.itunes_category( + feed_config['itunes_category'] + ) if 'itunes_explicit' in feed_config: - fg.podcast.itunes_explicit(feed_config['itunes_explicit']) + fg.podcast.itunes_explicit( + feed_config['itunes_explicit'] + ) if 'itunes_author' in feed_config: fg.podcast.itunes_author(feed_config['itunes_author']) @@ -79,11 +85,14 @@ def pre_build(self, context): if 'podcast' in i: fe_podcast_url = i['podcast'].get('url', '') fe_podcast_size = i['podcast'].get('size', 0) - fe_podcast_type = i['podcast'].get('type', 'audio/mpeg') + fe_podcast_type = i['podcast'].get( + 'type', 'audio/mpeg' + ) else: fe_podcast_url = '' fe_podcast_size = '' - fe_podcast_type = 'audio/mpeg' # default value; will never be reported as missing + # default value; will never be reported as missing + fe_podcast_type = 'audio/mpeg' # check entry attributes missing_attributes = [] @@ -139,7 +148,11 @@ def pre_build(self, context): fe.summary(summary) if feed_config['type'] == 'podcast': - fe.enclosure(fe_podcast_url, str(fe_podcast_size), fe_podcast_type) + fe.enclosure( + fe_podcast_url, + str(fe_podcast_size), + fe_podcast_type, + ) # generate output if feed_config['type'] == 'atom': diff --git a/flamingo/plugins/sphinx_themes/sphinx_theme.py b/flamingo/plugins/sphinx_themes/sphinx_theme.py index 162aece..bfae861 100644 --- a/flamingo/plugins/sphinx_themes/sphinx_theme.py +++ b/flamingo/plugins/sphinx_themes/sphinx_theme.py @@ -189,7 +189,9 @@ def gen_static_file_template_context(self): self._static_file_template_context_cache = { **self.config.get_theme_options(), } - self._static_file_template_context_cache['docutils_version_info'] = docutils.__version_info__[:5] + self._static_file_template_context_cache[ + 'docutils_version_info' + ] = docutils.__version_info__[:5] return deepcopy(self._static_file_template_context_cache) From 92a64eddbcefc1e8b894127eff140345a15d90db Mon Sep 17 00:00:00 2001 From: Bastian Krause Date: Fri, 29 Sep 2023 15:01:33 +0200 Subject: [PATCH 6/9] test/advertise Python 3.11 support Signed-off-by: Bastian Krause --- setup.cfg | 1 + tox.ini | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 7818dc5..00cd9cd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -15,6 +15,7 @@ classifiers = 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 Programming Language :: Python :: Implementation Programming Language :: Python :: Implementation :: CPython diff --git a/tox.ini b/tox.ini index 7c45c60..5b4dc32 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ envlist=python [tox:jenkins] -envlist=lint,py37,py38,py39,py310 +envlist=lint,py37,py38,py39,py310,py311 [testenv:.pkg] setenv = From 5f8176ffc4841d39119133748893aee6a6b29957 Mon Sep 17 00:00:00 2001 From: Bastian Krause Date: Fri, 29 Sep 2023 14:59:11 +0200 Subject: [PATCH 7/9] github/travis: port CI to GitHub actions Signed-off-by: Bastian Krause --- .github/workflows/ci.yaml | 39 +++++++++++++++++++++++++++++++++++++++ .travis.yml | 27 --------------------------- 2 files changed, 39 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/ci.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..4730146 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,39 @@ +name: CI tests + +on: [push, pull_request, workflow_dispatch] + +jobs: + lint: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ['3.11'] + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: pip install --upgrade setuptools tox + - name: Run tox + run: tox -e lint + + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: pip install --upgrade setuptools tox codecov + - name: Run tox + run: tox -e py + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 94a92ba..0000000 --- a/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -os: linux -dist: focal -language: python - -stages: -- lint -- test - -jobs: - include: - - stage: lint - env: TOXENV=lint - -python: -- 3.7 -- 3.8 -- 3.9 -- 3.10 - -install: -- pip install "setuptools>=36.3" tox codecov - -script: -- tox - -after_success: -- codecov From 9256560cae3796e824074092bf96fff41cdcafe9 Mon Sep 17 00:00:00 2001 From: Bastian Krause Date: Sat, 30 Sep 2023 14:23:44 +0200 Subject: [PATCH 8/9] github: rename "main" workflow to "docs" While at it, drop the sample comment and name the workflow accordingly. This gets displayed unter the "actions" tab as well as on the status badge. Signed-off-by: Bastian Krause --- .github/workflows/{main.yml => docs.yml} | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) rename .github/workflows/{main.yml => docs.yml} (89%) diff --git a/.github/workflows/main.yml b/.github/workflows/docs.yml similarity index 89% rename from .github/workflows/main.yml rename to .github/workflows/docs.yml index 1679148..07079df 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/docs.yml @@ -1,5 +1,4 @@ -# Sample workflow for building and deploying a Jekyll site to GitHub Pages -name: Deploy Jekyll with GitHub Pages dependencies preinstalled +name: docs on: # Runs on pushes targeting the default branch From 7fa6c660df1ccd3c3d660b020dc4166b925b5737 Mon Sep 17 00:00:00 2001 From: Bastian Krause Date: Fri, 29 Sep 2023 15:01:47 +0200 Subject: [PATCH 9/9] README: update badges Drop the now unused Travis and LGTM badges. Add badges for GitHub actions CI and documentation build tests. Signed-off-by: Bastian Krause --- README.rst | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/README.rst b/README.rst index d21b9c9..408421a 100644 --- a/README.rst +++ b/README.rst @@ -10,9 +10,12 @@ flamingo .. image:: https://img.shields.io/pypi/l/flamingo.svg :alt: pypi.org :target: https://pypi.org/project/flamingo -.. image:: https://img.shields.io/travis/com/pengutronix/flamingo/master.svg - :alt: Travis branch - :target: https://travis-ci.com/pengutronix/flamingo +.. image:: https://github.com/pengutronix/flamingo/actions/workflows/ci.yaml/badge.svg + :alt: CI Test Status + :target: https://github.com/Bastian-Krause/flamingo/actions/workflows/ci.yaml +.. image:: https://github.com/pengutronix/flamingo/actions/workflows/docs.yaml/badge.svg + :alt: Documentation Build Status + :target: https://github.com/Bastian-Krause/flamingo/actions/workflows/docs.yaml .. image:: https://img.shields.io/pypi/pyversions/flamingo.svg :alt: pypi.org :target: https://pypi.org/project/flamingo @@ -22,12 +25,6 @@ flamingo .. image:: https://img.shields.io/codecov/c/github/pengutronix/flamingo.svg :alt: codecov.io :target: https://codecov.io/gh/pengutronix/flamingo/ -.. image:: https://img.shields.io/lgtm/alerts/g/pengutronix/flamingo.svg - :alt: lgtm.com - :target: https://lgtm.com/projects/g/pengutronix/flamingo/ -.. image:: https://img.shields.io/lgtm/grade/python/g/pengutronix/flamingo.svg - :alt: lgtm.com - :target: https://lgtm.com/projects/g/pengutronix/flamingo/ Flamingo is a python3-based, pelican-inspired static site generator, made by