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/.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 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 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 diff --git a/flamingo/plugins/feeds.py b/flamingo/plugins/feeds.py index ccd746a..23d97a9 100644 --- a/flamingo/plugins/feeds.py +++ b/flamingo/plugins/feeds.py @@ -56,7 +56,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': @@ -65,9 +67,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']) @@ -101,11 +107,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 = [] @@ -163,7 +172,11 @@ def pre_build(self, context): fe.summary(summary, type='html') 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) diff --git a/setup.cfg b/setup.cfg index 89b5c37..00cd9cd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -11,10 +11,11 @@ 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.11 Programming Language :: Python :: 3 :: Only Programming Language :: Python :: Implementation Programming Language :: Python :: Implementation :: CPython 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') 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', diff --git a/tox.ini b/tox.ini index fc43593..5b4dc32 100644 --- a/tox.ini +++ b/tox.ini @@ -4,13 +4,15 @@ envlist=python [tox:jenkins] -envlist=lint,py36,py37,py38,py39 +envlist=lint,py37,py38,py39,py310,py311 +[testenv:.pkg] +setenv = + FLAMINGO_TEST=1 [testenv] passenv=* ignore_errors=True -setenv=FLAMINGO_TEST=1 deps = pytest