Skip to content

GitHub Actions

Purpose

Fast build/test/lint signal on every push and pull request - gates PRs before Jenkins' fuller pipeline ever runs.

File

.github/workflows/ci.yml

Triggers

on:
  push:
    branches: [master, "agent/**"]
  pull_request:
    branches: [master]

Backend job

Restore  →  dotnet restore ECommerce.sln
Build    →  dotnet build ECommerce.sln --configuration Release --no-restore
Test     →  dotnet test tests/ECommerce.Tests/ECommerce.Tests.csproj --configuration Release --no-build
Runs on ubuntu-latest, .NET 8.0.x (actions/setup-dotnet@v4). Test results are also logged as a .trx file (--logger "trx;LogFileName=test-results.trx").

Frontend job

npm ci
npm run lint
npm run build
Runs on ubuntu-latest, Node 22 (actions/setup-node@v4, matching frontend/Dockerfile's build stage - see Docker → Images "Why Node 22, not 20"), with npm's own cache keyed on frontend/package-lock.json.

Documentation job

A small job validating this documentation portal, added alongside (not replacing) the two jobs above:

docs:
  runs-on: ubuntu-latest
  steps:
    - uses: actions/checkout@v4
    - uses: actions/setup-python@v5
      with:
        python-version: '3.x'
    - name: Install docs dependencies
      run: pip install -r requirements-docs.txt
    - name: Build docs (strict)
      run: mkdocs build --strict
A broken internal link, a missing nav entry, or invalid MkDocs configuration fails this job - the same bar mkdocs build --strict enforces locally (see MkDocs validation below). It does not touch, weaken, or depend on the backend/frontend jobs in any way - a documentation-only change can't fail backend tests, and a backend/frontend change can't fail the docs build unless it also touches docs/devops/ or mkdocs.yml.

Branch validation

Every PR into master runs all three jobs regardless of which files changed - GitHub's own branch protection (configured on the repository, not in this file) is what actually blocks merging on a failed check; this workflow only produces the pass/fail signal.

Validation (run locally before pushing)

# Backend
cd backend
dotnet restore ECommerce.sln
dotnet build ECommerce.sln --configuration Release --no-restore
dotnet test tests/ECommerce.Tests/ECommerce.Tests.csproj --configuration Release --no-build
cd ..

# Frontend
cd frontend
npm ci
npm run lint
npm run build
cd ..

# Docs
.\.venv-docs\Scripts\Activate.ps1
mkdocs build --strict

Troubleshooting

  • Backend test failure only in CI, not locally - almost always an environment difference (Ubuntu vs. Windows line endings/paths, or a test relying on local machine state) - check the job's .trx artifact for the exact assertion that failed.
  • Frontend lint failure - npm run lint runs ESLint against src/; fix reported issues or (rare, deliberate) add an inline // eslint-disable-next-line with a comment explaining why.
  • Docs job failure - see MkDocs → strict build errors or run mkdocs build --strict locally to see the exact warning-turned-error.