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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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 @@ -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'
)
SmithChart marked this conversation as resolved.
Show resolved Hide resolved

# setup podcast environment
if feed_config['type'] == 'podcast':
Expand All @@ -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'])

Expand Down Expand Up @@ -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 = []
Expand Down Expand Up @@ -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':
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 @@ 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)

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