CI CD Github Actions design - lago-morph/chiller GitHub Wiki

Deprecated

Please see chiller-doc/ci.md, chiller-doc/cdel.md and chiller-doc/cdep.md. This page is no longer maintained.


Actions

Test and build

Triggers

  • on create pull request to branch called "release-*"

Steps

  • locally merge into release branch - if cannot automatically merge, fail (user should clean up their branch before making the pull request)
  • make sure database is working
    • unit test chiller_api/db/schema.sql with postgres container and psql
  • build python packages
  • unit test chiller_api
    • start with postgres container as service
    • install chiller_api package
    • run chiller_api unit test
  • build chiller_api container
    • build chiller_api container with tag chiller_api:${{ github.sha }}
    • if successful upload container to ghcr.io
  • integration test chiller_api
    • start with postgres and chiller_api as services
    • install chiller_api_client
    • run chiller_api_client integration tests
  • unit test chiller_frontend
    • install chiller_api client and chiller_frontend packages
    • run chiller_frontend unit test
  • integration test chiller_frontend
    • start with postgres and chiller_api as services
    • install chiller_api client and chiller_frontend packages
    • run chiller_frontend integration test
  • build chiller_frontend container
    • build chiller_frontend container with tag chiller_frontend:${{ github.sha }}
    • if successful upload container to ghcr.io
  • browser test chiller_frontend
    • start with postgres, chiller_api, and chiller_frontend as services (using tag :${{ github.sha }})
    • install python3-selenium
    • run frontend browser test
  • PLACEHOLDER unit test, integration test, and build then publish helm charts with name based on commit hash
  • PLACEHOLDER unit test, integration test terraform scripts to create deployment test environments and production environment

Label release branch merge

Triggers

  • on approve pull request into release branch

Steps

  • Tag merge commit with RC--YYYY-MM-DD.HH-MM-SS
  • Tag merge commit with RC--LATEST (this might have to delete previous one? Or do tags just update if you use same name?)
  • Add tags for containers uploaded to ghcr to the same tag names as using in github
  • PLACEHOLDER publish helm charts with same tags as used for containers
  • PLACEHOLDER publish terraform scripts with same tags as used for containers

Create runtime environment (reusable)

This action can only be called by other actions

Steps

  • Create environment based on terraform script specified
  • Run tests associated with script

System test new environment (reusable)

This action can only be called by other actions

Steps

  • Run workflow - create runtime environment (system test)
  • Deploy helm chart for given version
  • Run automated system test scripts for given version

Create templated actions

Triggers

  • on creation of branch named release-*

Steps

  • Create github actions specific to this branch that call "Create system test environment" and "Run deployment test"

Delete templated actions

Triggers

  • on deletion of branch named release-*

Steps

  • Delete github actions specific to this branch that call "Create system test environment" and "Run deployment test"

Run deployment test (template - instance created for each release-* branch? Or can we parameterize easily?)

Triggers

  • on manual activation
  • on create pull request into main

Steps

  1. System test new environment
  • Run workflow system test new environment (dev release version of code, system test terraform)
  • If failure, create issue, exit
  • If success, remove environment just created
  1. System test upgrade
  • Run workflow system test new environment (production version of code, system test terraform)
  • If failure, create issue, exit
  • Deploy helm chart as upgrade for dev release version
  • Run automated system test scripts for dev release version
  • If failure, create issue, exit
  • If success, remove environment just created
  1. Load test
  • Run workflow system test new environment (dev release version of code, load test terraform)
  • If failure, create issue, exit
  • deploy load testing helm chart for simulated users
  • run load test
  • If failure, create issue, exit
  • If success, remove environment just created

Create system test environment (template - created for main and each release-* branch - or can we parameterize somehow?)

Triggers

  • on demand only

Steps

  • Run workflow system test new environment (dev release version of code, system test terraform)
  • If failure, create issue (test failed), exit
  • If success, create issue (reminder to delete environment), exit

Tear down environment

Triggers

  • on issue closed (marked as environment issue)

Steps

  • Tear down referenced environment

Deploy into production

Triggers

  • on approve pull request into main

Steps

  • Back up production database
  • Deploy update helm chart
  • Start automated monitoring process with metrics for deployment
  • if monitoring indicates problem
    • roll back install
    • delete merge into main
    • create issue
  • if monitoring indicates ok
    • label merge commit with version
    • label containers on ghcr with version (e.g., 1.0.0) and LATEST tags
    • publish helm charts with same labels as containers

Deploy into new production environment

Triggers

  • on manual activation

Steps

  • if environment already exists, create issue, exit
  • Run workflow system test new environment (latest main release of code, production terraform)
  • If failure, create issue, exit (note that when issue is closed environment will be automatically torn down)