Skip to content

jameshounshell/github-actions-demo

Repository files navigation

Github Actions Demo

Simple CI

This repo demonstrates a simple CI build using Makefile and Github Actions
All of the operations of a common CI can be executed locally using Makefile
The Make targets are then chained together in the Github Actions

The demo app

/app contains a simple REST API app (Python Flask) that doles out the data in /data

Example API endpoints:

  • /things: List all things
  • /things/<id>: List specific thing

Local Development and Testing

All development commands can be found in the Makefile
pipenv is used to wrap virtualenv/pip/pyenv

Container Build and Testing

tl:dr: run make dtest to to build, run, smoke test, then kill the container
All build test commands can be found in the Makefile
WARNING: If using Windows you must use WSL2 for correct networking between WSL and Docker for Windows

  • About the container
    • This container is based on hub.docker.com/_/python
    • The Dockerfile can be found at ./Dockerfile
    • Instead of using the Flask development server, we serve the app using Gunicorn with 4 workers
  • Run the unit tests in a container
    • make dunit
  • Build the container
    • make dbuild
  • Run the container
    • make drun
  • Curl the app's main endpoint to verify it's online
    • make dcurl
  • Make sure to teardown afterwards
    • make dkill

CI - Github Actions

CI is run on push/merge to the master branch

TODO

Credits

This project was created to complete to a interview take-home assignment
I have embelished a bit and published it to display my code style and tastes

About

Dockerized Python app with Github Actions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published