Goal
The goal is to be able to open a pull request and have Github automatically run quality checks and run tests.

Github Actions
Before adding any Github workflows, I need the ability to run the application in the background (otherwise it’ll block next steps in its job).
I introduced a dup
Make target that runs the app in daemon mode, as well as a down
target to tear down the containers:
dup:
docker compose up --build -d
down:
docker compose down
I then started off with this simple workflow with two jobs: a lint
and test
that runs when a PR is opened to master.
# .github/workflows/quality-checks.yaml
name: Quality Checks
on:
pull_request:
branches: [ "master" ]
jobs:
lint:
name: Run Linters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: echo "🚀Starting app"
- run: make dup
- run: echo "🔎Running linters"
- run: make lint
test:
name: Run Test Suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: echo "🚀Starting app"
- run: make dup
- run: echo "🧪Running tests"
- run: make test
Once merged to master, I updated the repository settings to prevent merging of pull requests when there’s a failing status check.

Linting and Formatting
I identified a gap in my current Makefile — the lint
target actually writes the changes and doesn’t report back with a status code to signify that a change is made. This makes it unsuitable as a status check.
I had to introduce a new format
target for development usage. I then updated lint
to do a check, which is exactly what linting should do.
format:
docker compose exec app black .
lint:
docker compose exec app black --check .
docker compose exec app flake8 .
Conclusion
Pull requests that fail the specified status checks can no longer be merged to master. See this PR for example.
The source is available at the feature/002-pr-checks
branch