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¶
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
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¶
Runs onubuntu-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
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
.trxartifact for the exact assertion that failed. - Frontend lint failure -
npm run lintruns ESLint againstsrc/; fix reported issues or (rare, deliberate) add an inline// eslint-disable-next-linewith a comment explaining why. - Docs job failure - see MkDocs → strict build errors
or run
mkdocs build --strictlocally to see the exact warning-turned-error.
Related pages¶
- Jenkins - the fuller pipeline that runs after this passes
- CI/CD overview