Skip to content

Run full test suite in GitHub Actions with disposable test env#6

Closed
devarshishimpi wants to merge 1 commit into
mainfrom
bug/setup-codra-tests-in-github-actions
Closed

Run full test suite in GitHub Actions with disposable test env#6
devarshishimpi wants to merge 1 commit into
mainfrom
bug/setup-codra-tests-in-github-actions

Conversation

@devarshishimpi
Copy link
Copy Markdown
Owner

@devarshishimpi devarshishimpi commented May 15, 2026

Description

Sets up CI to run the full Codra test suite on PRs, pushes to main, and manual workflow dispatches.

Changes include:

  • Adds a Postgres service container for GitHub Actions test runs.
  • Runs migrations before Vitest through npm test.
  • Moves test env values out of test helpers and into env files / workflow env.
  • Adds .env.test.example for local test setup.
  • Updates .dev.vars.example to match the local .dev.vars env names.
  • Removes DB test skipping so all 56 tests run locally and in CI.
  • Trims CI env vars to only what the current tests actually require.
  • Increases Vitest timeout for slower DB-backed integration tests.

Closes #1

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Chore (refactoring, dependency updates, etc.)

How Has This Been Tested?

  • Unit Tests
  • Integration Tests
  • Manual Dashboard Verification
  • Manual GitHub Webhook Verification

Checklist:

  • I have starred Codra on GitHub
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes
  • I have signed the CLA

@devarshishimpi devarshishimpi linked an issue May 15, 2026 that may be closed by this pull request
Copy link
Copy Markdown

@codra-app-personal codra-app-personal Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codra Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 42186fb1a6

ℹ️ About Codra in GitHub

Your team has set up Codra to review pull requests in this repo. Reviews are triggered when you:

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codra-app review"

If Codra has suggestions, it will comment; otherwise it will react with 👍.

Codra can also answer questions or update the PR. Try commenting "@codra-app address that feedback".

Comment thread .dev.vars.example
Comment thread .dev.vars.example
Comment thread .dev.vars.example
Comment thread .env.test.example
Copy link
Copy Markdown

@codra-app-personal codra-app-personal Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codra Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 42186fb1a6

ℹ️ About Codra in GitHub

Your team has set up Codra to review pull requests in this repo. Reviews are triggered when you:

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codra-app review"

If Codra has suggestions, it will comment; otherwise it will react with 👍.

Codra can also answer questions or update the PR. Try commenting "@codra-app address that feedback".

Comment thread .dev.vars.example
# Comma-separated list of GitHub usernames allowed to access the dashboard
DASHBOARD_ALLOWED_USERS="username1,username2"
# --- Integration tests ---
TEST_DATABASE_URL="postgresql://user:password@localhost:5432/codra"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Removal of critical warning and unsafe example for TEST_DATABASE_URL

The previous version of .dev.vars.example included a critical warning (line 38) stating that TEST_DATABASE_URL MUST be a separate database to avoid data loss during test sweeps. The updated version removes this warning and changes the example database name from 'codra_test' to 'codra'. This increases the risk of developers accidentally running integration tests against their development or production database, potentially leading to catastrophic data loss.

Suggested change
TEST_DATABASE_URL="postgresql://user:password@localhost:5432/codra"
# --- Integration tests ---
# MUST be a separate database to avoid data loss during test sweeps.
TEST_DATABASE_URL="postgresql://user:password@localhost:5432/codra_test"

Comment thread .dev.vars.example
# Create or identify the DLQ queue, then set CF_DLQ_ID to that queue's ID.
# Generate token at https://dash.cloudflare.com/profile/api-tokens (Queues:Edit permission)
CF_API_TOKEN="REPLACE_WITH_CLOUDFLARE_API_TOKEN"
# --- Cloudflare API ---
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Removal of required CF_DLQ_ID variable

The variable CF_DLQ_ID, which was explicitly marked as '(Required)' in the previous version for Cloudflare DLQ inspection and management, has been removed from the example file. If the application still depends on this variable for DLQ functionality, new developers will be missing a critical configuration key, leading to runtime errors or broken functionality in the /api/dlq endpoints.

Suggested change
# --- Cloudflare API ---
CF_ACCOUNT_ID="REPLACE_WITH_YOUR_CLOUDFLARE_ACCOUNT_ID"
CF_API_TOKEN="REPLACE_WITH_CLOUDFLARE_API_TOKEN"
CF_DLQ_ID="REPLACE_WITH_YOUR_DLQ_QUEUE_ID"

Comment thread .dev.vars.example
CF_API_TOKEN="REPLACE_WITH_CLOUDFLARE_API_TOKEN"

# --- Application Settings ---
# --- Application URLs and mode ---
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Removal of BOT_USERNAME configuration

The BOT_USERNAME variable has been removed from the example file. If the application logic still references this variable for bot identification or configuration, it will be missing from the environment of new developers who rely on this example file for setup.

Suggested change
# --- Application URLs and mode ---
APP_URL="http://localhost:8787"
BOT_USERNAME="codra-app-dev"
AUTH_CALLBACK_URL="http://localhost:8787/auth/github/callback"

Comment thread .env.test.example
GITHUB_CLIENT_ID="fake-dashboard-client-id"
GITHUB_CLIENT_SECRET="fake-dashboard-client-secret"
AUTH_CALLBACK_URL="https://codra.test/auth/github/callback"
DASHBOARD_ALLOWED_USERS="devarshishimpi"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Hardcoded specific username in example file

The variable DASHBOARD_ALLOWED_USERS contains a specific username ('devarshishimpi'). Example environment files should generally use generic placeholders (e.g., 'your-github-username') to avoid coupling the project template to a specific individual's identity.

Suggested change
DASHBOARD_ALLOWED_USERS="devarshishimpi"
DASHBOARD_ALLOWED_USERS="your-github-username"

Copy link
Copy Markdown

@codra-app-personal codra-app-personal Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codra Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 42186fb1a6

ℹ️ About Codra in GitHub

Your team has set up Codra to review pull requests in this repo. Reviews are triggered when you:

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codra-app review"

If Codra has suggestions, it will comment; otherwise it will react with 👍.

Codra can also answer questions or update the PR. Try commenting "@codra-app address that feedback".

Comment thread .dev.vars.example
# Comma-separated list of GitHub usernames allowed to access the dashboard
DASHBOARD_ALLOWED_USERS="username1,username2"
# --- Integration tests ---
TEST_DATABASE_URL="postgresql://user:password@localhost:5432/codra"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Removal of critical warning and unsafe example for TEST_DATABASE_URL

The previous version of .dev.vars.example included a critical warning (line 38) stating that TEST_DATABASE_URL MUST be a separate database to avoid data loss during test sweeps. The updated version removes this warning and changes the example database name from 'codra_test' to 'codra'. This increases the risk of developers accidentally running integration tests against their development or production database, potentially leading to catastrophic data loss.

Suggested change
TEST_DATABASE_URL="postgresql://user:password@localhost:5432/codra"
# --- Integration tests ---
# MUST be a separate database to avoid data loss during test sweeps.
TEST_DATABASE_URL="postgresql://user:password@localhost:5432/codra_test"

Comment thread .dev.vars.example
# Create or identify the DLQ queue, then set CF_DLQ_ID to that queue's ID.
# Generate token at https://dash.cloudflare.com/profile/api-tokens (Queues:Edit permission)
CF_API_TOKEN="REPLACE_WITH_CLOUDFLARE_API_TOKEN"
# --- Cloudflare API ---
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Removal of required CF_DLQ_ID variable

The variable CF_DLQ_ID, which was explicitly marked as '(Required)' in the previous version for Cloudflare DLQ inspection and management, has been removed from the example file. If the application still depends on this variable for DLQ functionality, new developers will be missing a critical configuration key, leading to runtime errors or broken functionality in the /api/dlq endpoints.

Suggested change
# --- Cloudflare API ---
CF_ACCOUNT_ID="REPLACE_WITH_YOUR_CLOUDFLARE_ACCOUNT_ID"
CF_API_TOKEN="REPLACE_WITH_CLOUDFLARE_API_TOKEN"
CF_DLQ_ID="REPLACE_WITH_YOUR_DLQ_QUEUE_ID"

Comment thread .dev.vars.example
CF_API_TOKEN="REPLACE_WITH_CLOUDFLARE_API_TOKEN"

# --- Application Settings ---
# --- Application URLs and mode ---
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Removal of BOT_USERNAME configuration

The BOT_USERNAME variable has been removed from the example file. If the application logic still references this variable for bot identification or configuration, it will be missing from the environment of new developers who rely on this example file for setup.

Suggested change
# --- Application URLs and mode ---
APP_URL="http://localhost:8787"
BOT_USERNAME="codra-app-dev"
AUTH_CALLBACK_URL="http://localhost:8787/auth/github/callback"

Comment thread .env.test.example
GITHUB_CLIENT_ID="fake-dashboard-client-id"
GITHUB_CLIENT_SECRET="fake-dashboard-client-secret"
AUTH_CALLBACK_URL="https://codra.test/auth/github/callback"
DASHBOARD_ALLOWED_USERS="devarshishimpi"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Hardcoded specific username in example file

The variable DASHBOARD_ALLOWED_USERS contains a specific username ('devarshishimpi'). Example environment files should generally use generic placeholders (e.g., 'your-github-username') to avoid coupling the project template to a specific individual's identity.

Suggested change
DASHBOARD_ALLOWED_USERS="devarshishimpi"
DASHBOARD_ALLOWED_USERS="your-github-username"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setup Codra Tests in GitHub actions

1 participant