How we use GitHub Actions for continuous integration and automation¶
What GitHub Actions do¶
We use GitHub Actions on consumerfinance.gov to perform the following tasks:
- Run automated lint checkers
- Run automated unit tests
- Measure unit test coverage
- Build and deploy this documentation to GitHub on the
gh-pages
branch. - Clean up stored artifacts
How GitHub Actions are configured¶
We use the following constraints to optimize our CI builds for speed and utility:
- Our linting and unit tests run on pull requests only, including subsequent pushes to a pull request's branch. Tests are not run on the
main
branch. - Our documentation is deployed on merges and pushes to the
main
branch only, and not on pull requests. - We do not run builds of any kind on any other branches that are not
main
, and that are not pull request branches. - We store coverage artifacts in between the unit test jobs and the coverage jobs. This requires us to run an action every hour using the purge-artifacts action to clean up these stored artifacts.
We use a combination of:
- Build matrices to run the same tests on different versions of our dependnecies
- Additional services to provide, for example, PostgreSQL for our tests
Our workflows are defined in our .github/workflows
directory.
An extra task for satellite repositories¶
For our satellite apps, we use GitHub Actions (or Travis, if a repo hasn't been migrated to Actions yet) to build and attach a deployment wheel file to every release.
An example is the .whl
file on this release of the retirement app.