Skip to content

ci: backend-tests.yml GitHub Actions workflow is malformed — CI never runs on backend changes #2

Description

@Uchechukwu-Ekezie

Description

The .github/workflows/backend-tests.yml CI workflow file has an invalid YAML structure that causes GitHub Actions to silently ignore the workflow. As a result, no automated tests run on any backend pull request or push.

Root Cause

The on.pull_request.paths filter block contains YAML for job steps (- name: Upload test results, Docker CLI commands) rather than path glob patterns. This is structurally invalid — paths expects a list of strings, not a list of maps. GitHub Actions parses the file, finds no valid jobs: block, and skips execution with no error surfaced to contributors.

Current (broken) structure:

on:
  pull_request:
    paths:
      - 'backend/**'
      - name: Upload test results        # ← Step definition in wrong location
        if: always()
        uses: actions/upload-artifact@v3
        ...
      - name: Validate deployment compose config  # ← Same problem
        run: docker compose -f deployment/docker-compose.yml config

Required structure:

on:
  pull_request:
    paths:
      - 'backend/**'

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Upload test results
        ...

Impact

  • Every PR touching backend/ merges without CI validation
  • Tests in backend/src/test/ (api.integration, riskManagements, idempotency, queue, etc.) never execute in CI
  • Bugs can silently enter main branch
  • e2e-tests.yml is correctly formatted and serves as valid reference

Steps to Verify

  1. Open any PR that modifies a file under backend/
  2. Observe that no "backend-tests" check appears in the PR status checks
  3. Compare .github/workflows/backend-tests.yml to .github/workflows/e2e-tests.yml

Proposed Fix

Restructure backend-tests.yml with a proper jobs: section:

name: Backend Tests

on:
  push:
    branches: [main, develop]
    paths:
      - 'backend/**'
  pull_request:
    paths:
      - 'backend/**'

jobs:
  unit-tests:
    name: Unit & Integration Tests
    runs-on: ubuntu-latest

    services:
      postgres:
        image: postgres:15-alpine
        env:
          POSTGRES_USER: portfolio_user
          POSTGRES_PASSWORD: portfolio_pass
          POSTGRES_DB: stellar_portfolio
        ports:
          - 5432:5432
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
      redis:
        image: redis:7-alpine
        ports:
          - 6379:6379

    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '18'
          cache: 'npm'
          cache-dependency-path: backend/package-lock.json
      - name: Install dependencies
        working-directory: backend
        run: npm ci
      - name: Run tests
        working-directory: backend
        env:
          DATABASE_URL: postgresql://portfolio_user:portfolio_pass@localhost:5432/stellar_portfolio
          REDIS_URL: redis://localhost:6379
          NODE_ENV: test
        run: npm test
      - name: Upload test results
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: backend-test-results
          path: backend/test-results/

  validate-compose:
    name: Validate Docker Compose
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Validate compose config
        run: docker compose -f deployment/docker-compose.yml config

Files Affected

  • .github/workflows/backend-tests.yml — needs full rewrite
  • .github/workflows/e2e-tests.yml — correct reference implementation

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official Campaign

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions