Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port CI to GitHub Actions and miscellaneous maintenance work #43

Merged
merged 9 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions .github/workflows/main.yml → .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
27 changes: 0 additions & 27 deletions .travis.yml

This file was deleted.

15 changes: 6 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
25 changes: 19 additions & 6 deletions flamingo/plugins/feeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,28 @@

# set parameters needed for rss-feeds
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(

Check warning on line 37 in flamingo/plugins/feeds.py

View check run for this annotation

Codecov / codecov/patch

flamingo/plugins/feeds.py#L35-L37

Added lines #L35 - L37 were not covered by tests
href=feed_config['link_alternate'], rel='alternate'
)
SmithChart marked this conversation as resolved.
Show resolved Hide resolved

# setup podcast environment
if feed_config['type'] == 'podcast':
fg.load_extension('podcast')
fg.podcast.itunes_image(feed_config['podcast_image'])

Check warning on line 44 in flamingo/plugins/feeds.py

View check run for this annotation

Codecov / codecov/patch

flamingo/plugins/feeds.py#L43-L44

Added lines #L43 - L44 were not covered by tests
if 'itunes_owner' in feed_config:
fg.podcast.itunes_owner(**feed_config['itunes_owner'])

Check warning on line 46 in flamingo/plugins/feeds.py

View check run for this annotation

Codecov / codecov/patch

flamingo/plugins/feeds.py#L46

Added line #L46 was not covered by tests
if 'itunes_category' in feed_config:
fg.podcast.itunes_category(feed_config['itunes_category'])
fg.podcast.itunes_category(

Check warning on line 48 in flamingo/plugins/feeds.py

View check run for this annotation

Codecov / codecov/patch

flamingo/plugins/feeds.py#L48

Added line #L48 was not covered by tests
feed_config['itunes_category']
)
if 'itunes_explicit' in feed_config:
fg.podcast.itunes_explicit(feed_config['itunes_explicit'])
fg.podcast.itunes_explicit(

Check warning on line 52 in flamingo/plugins/feeds.py

View check run for this annotation

Codecov / codecov/patch

flamingo/plugins/feeds.py#L52

Added line #L52 was not covered by tests
feed_config['itunes_explicit']
)
if 'itunes_author' in feed_config:
fg.podcast.itunes_author(feed_config['itunes_author'])

Check warning on line 56 in flamingo/plugins/feeds.py

View check run for this annotation

Codecov / codecov/patch

flamingo/plugins/feeds.py#L56

Added line #L56 was not covered by tests

for i in feed_config['contents'](context):
fe = fg.add_entry()
Expand All @@ -72,18 +78,21 @@
fe_updated = ''

if 'published' in feed_config:
fe_published = feed_config['published'](i)

Check warning on line 81 in flamingo/plugins/feeds.py

View check run for this annotation

Codecov / codecov/patch

flamingo/plugins/feeds.py#L81

Added line #L81 was not covered by tests
else:
fe_published = ''

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(

Check warning on line 88 in flamingo/plugins/feeds.py

View check run for this annotation

Codecov / codecov/patch

flamingo/plugins/feeds.py#L86-L88

Added lines #L86 - L88 were not covered by tests
'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 = []
Expand All @@ -102,9 +111,9 @@

if feed_config['type'] == 'podcast':
if not fe_podcast_url:
missing_attributes.append('podcast->url')

Check warning on line 114 in flamingo/plugins/feeds.py

View check run for this annotation

Codecov / codecov/patch

flamingo/plugins/feeds.py#L114

Added line #L114 was not covered by tests
if not fe_podcast_size:
missing_attributes.append('podcast->size')

Check warning on line 116 in flamingo/plugins/feeds.py

View check run for this annotation

Codecov / codecov/patch

flamingo/plugins/feeds.py#L116

Added line #L116 was not covered by tests

if missing_attributes:
logger.error('%s is missing attributes: %s',
Expand All @@ -117,13 +126,13 @@
fe.id(fe_id)
fe.title(fe_title)
fe.updated(fe_updated)
fe.published(fe_published)

Check warning on line 129 in flamingo/plugins/feeds.py

View check run for this annotation

Codecov / codecov/patch

flamingo/plugins/feeds.py#L129

Added line #L129 was not covered by tests
fe.link(fe_link)

if i['content_body']:
exitcode, output = context.pre_render(i)
if 'html_filter' in feed_config:
output = feed_config['html_filter'](output)

Check warning on line 135 in flamingo/plugins/feeds.py

View check run for this annotation

Codecov / codecov/patch

flamingo/plugins/feeds.py#L135

Added line #L135 was not covered by tests
fe.content(output, type='html')

if i['authors']:
Expand All @@ -133,13 +142,17 @@
})

if i['summary']:
summary = str(i['summary'])

Check warning on line 145 in flamingo/plugins/feeds.py

View check run for this annotation

Codecov / codecov/patch

flamingo/plugins/feeds.py#L145

Added line #L145 was not covered by tests
if 'html_filter' in feed_config:
summary = feed_config['html_filter'](summary)
fe.summary(summary)

Check warning on line 148 in flamingo/plugins/feeds.py

View check run for this annotation

Codecov / codecov/patch

flamingo/plugins/feeds.py#L147-L148

Added lines #L147 - L148 were not covered by tests

if feed_config['type'] == 'podcast':
fe.enclosure(fe_podcast_url, str(fe_podcast_size), fe_podcast_type)
fe.enclosure(

Check warning on line 151 in flamingo/plugins/feeds.py

View check run for this annotation

Codecov / codecov/patch

flamingo/plugins/feeds.py#L151

Added line #L151 was not covered by tests
fe_podcast_url,
str(fe_podcast_size),
fe_podcast_type,
)

# generate output
if feed_config['type'] == 'atom':
Expand All @@ -148,7 +161,7 @@
elif feed_config['type'] in ['rss', 'podcast']:
content['content_body'] = fg.rss_str().decode()
else:
raise ValueError(f'Unkown Feed type {feed_config["type"]}')

Check warning on line 164 in flamingo/plugins/feeds.py

View check run for this annotation

Codecov / codecov/patch

flamingo/plugins/feeds.py#L164

Added line #L164 was not covered by tests

context.contents.add(**content)

Expand Down
4 changes: 3 additions & 1 deletion flamingo/plugins/sphinx_themes/sphinx_theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@
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[

Check warning on line 192 in flamingo/plugins/sphinx_themes/sphinx_theme.py

View check run for this annotation

Codecov / codecov/patch

flamingo/plugins/sphinx_themes/sphinx_theme.py#L192

Added line #L192 was not covered by tests
'docutils_version_info'
] = docutils.__version_info__[:5]

return deepcopy(self._static_file_template_context_cache)

Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_core_project_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__))

Expand Down
2 changes: 1 addition & 1 deletion tests/test_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
8 changes: 5 additions & 3 deletions tests/test_plugin_Git.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand Down
6 changes: 4 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down