Skip to content

ci: use workspace glob to start services in CI #165

@jakebromberg

Description

@jakebromberg

From PR #157 review:

Rather than hardcoding each service we could use the start npm script for each workspace in the apps directory like this: npm run start --workspace=apps/**. Then if we ever want to spin up another service it wouldn't need to be updated here.

This would require an update to the existing start scripts to add the timeout logic.

The current CI "Start services" step hardcodes each app:

node apps/auth/dist/app.js > /tmp/auth.log 2>&1 &
node apps/backend/dist/app.js > /tmp/backend.log 2>&1 &
timeout 30 bash -c 'until curl -sf http://localhost:8083/healthcheck ...'
timeout 30 bash -c 'until curl -sf http://localhost:8081/healthcheck ...'

To generalize this:

  1. Add a start (or start:ci) script to each workspace under apps/ that starts the process, waits for the healthcheck, and backgrounds itself.
  2. Replace the hardcoded CI step with npm run start --workspace=apps/** (or similar).
  3. Ensure the "Show service logs on failure" step still works with the new approach.

This way, adding a new service under apps/ requires no CI workflow changes.

Credit: @AyBruno

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions