Project automation with Travis, GitHub Pages and Quay

Pablo Iranzo Gómez (pablo.iranzo@gmail.com)

2019-01-16 16:00:00+01:00

Project hosting and automation

/me: Pablo Iranzo Gómez ( https://iranzo.github.io )

You got a shinny new project? What now?

  • Code usually also requires a webpage
    • Documentation, General Information, Developer information, etc
  • Web costs money
    • Hosting, Domain, Maintenance, etc

Some Philosophy

Empty your mind, be shapeless, formless, like water. Now you put water in a cup, it becomes the cup, you put water into a bottle, it becomes the bottle You put water in a teacup, it becomes the teapot Now water can flow or it can crash. Be water my friend

Note: Automation: Be lazy, have someone else doing it for you.

Git Hub / Gitlab

  • Lot of source code is hosted at github or gitlab, but it’s a code repository.
  • We want a website!!

Pages come to play

Both provide a ‘static’ webserver to be used for your projects for free.

G(H/L) serve from a branch in your repo (usually ‘yourusername.github.io’ repo)

You can buy a domain and point it to your website.

Static doesn’t mean end of fun

There are many ‘static’ content generators that provide rich features:

  • styles
  • links
  • image resizing
  • even ‘search’

Some static generators

Importance of language is for developing ‘plugins’, not content.

  • Jekyll (Ruby)
  • Pelican (Python)

They ‘render’ markdown into html

There’s even more fun

  • Github provides Jekyll support
  • Github, Gitlab, etc allow to plug in third-party CI

Think about endless possibilities!!!

Some food for thought

  • Repos have branches
  • Repos can have automation
  • External automation like Travis CI can do things for you

Note: We’ve all the pieces to push a new markdown file and have it triggering a website update and publish

Is a static webpage ugly?

  • There are lot of templates http://www.pelicanthemes.com
  • Each theme have different feature set
  • Choose wisely! (Small screens, html5, etc)
    • If not, changing themes is quite easy: update, and ‘render’ using new one.

** DEMO on Pelican + Theme **

Travis-ci.org

Automation for projects:

  • Free for OpenSource projects
  • Configured via .travis.yml
  • Some other settings via Web UI (env vars, etc)

Example (setup environment)

Example continuation (actions!)

Publish to remote repo

Fancy things

  • Build one repo and deploy to another branch/repo
  • Upload pypi package
  • Call triggers
  • etc

Real world use cases

  • Run ‘tox’ for UT’s
  • Test latest theme and plugins render
  • Render documentation website on docs update
  • Render latest CV
  • Build and publish container

Wrap up

Ok, automation is ready, our project validates commits, PR’s, website generation…

What else?

Containers!!

Container creation - Quay

Quay and DockerHub allow to automate build on branch commit

Docker Hub

On each commit, a new container will be built

You said to be water…

Yes!

Try https://github.com/iranzo/blog-o-matic/

Fork to your repo and get: - minimal setup steps (github token, travis-ci activation) - Automated setup of Pelican + Elegant theme via travis-ci job that builds on each commit. - Ready to be submitted to search engines via sitemap, and web claiming

Questions?

Pablo.Iranzo@gmail.com https://iranzo.github.io