Pablo Iranzo Gómez: How to automate via Travis CI publishing of new pelican pages to GitHub pages

Table of contents

Background

Elegant theme for pelican has been undergoing a big change from individual-driven effort to community, as part of this, one of the tasks to accomplish, has been the decoupling from author blog to project site for documentation.

As we wanted this process to be both automated and allowed us to demonstrate via dogfooding that the theme works and how it looks, the idea was to automate the rendering of pelican website with new documents.

Under the hood

Setting an automated build required several steps to be done:

One of the key pieces is a properly configured .travis.yaml like the one we started using:

Image setup

So, from above file we do:

All of this depends on Travis Image being used and their documentation

Preparation of environment

Now, we’ll prepare the environment for our tests:

We do install pip, setuptools, repository and test requirements, peru and tox.

Peru is used to grab additional dependencies for elegant (plugins, latest theme, etc)

Actual tests

This is really easy in our case:

We run ‘tox’ that allows to automate Python virtualenv and tests and then, use the Makefile from Pelican to build the site and tests plugins, etc

If everything succeeds, we’re ready for the next step (publishing)

After tests passed

All the environment setup and tests have succeed now, we do need to push the site ‘live’

This piece does the final step, first removes info about the repo containing the actual documentation and allows us to initialize a new one, that we make it point towards the repo we’re pushing (so that we keep separate actual website content from ‘rendered’ website).

In the final step, ‘make github’ uses the makefile provided with pelican to push the changes to the ‘master’ branch of the target repository, that then, is ready to be served via github pages as a regular web server would do.

Wrap up

So, right now we’ve accomplished several things:

Hope you enjoy it!

Pablo


Source From: fedoraplanet.org.
Original article title: Pablo Iranzo Gómez: How to automate via Travis CI publishing of new pelican pages to GitHub pages.
This full article can be read at: Pablo Iranzo Gómez: How to automate via Travis CI publishing of new pelican pages to GitHub pages.

Advertisement


Random Article You May Like

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*