-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (107 loc) · 4.14 KB
/
Copy pathci.yml
File metadata and controls
130 lines (107 loc) · 4.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: CI (build & test)
# AR-04 — automated quality gates for the .NET backend and the React/Vite frontend.
# The backend job stands up a PostgreSQL service so the WebApplicationFactory integration
# tests (LV-10) actually run instead of skipping, closing the gap that let the LV-04..07
# bug class reach only manual testing.
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
backend:
name: Backend (build + test)
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_DB: evolith_tracker
POSTGRES_USER: evolith
POSTGRES_PASSWORD: localdev
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U evolith -d evolith_tracker"
--health-interval 10s
--health-timeout 5s
--health-retries 10
env:
# Matches the default connection the app + *LiveTests / integration tests expect,
# so the DB-availability probe passes and the integration tests run for real.
EVOLITH_TRACKER_DB: "Host=localhost;Port=5432;Database=evolith_tracker;Username=evolith;Password=localdev"
ConnectionStrings__DefaultConnection: "Host=localhost;Port=5432;Database=evolith_tracker;Username=evolith;Password=localdev"
# TenantProjectionDbContext (DS-07) reads MasterDataDb; unset it defaults to
# localhost/user "postgres" and auth fails. Share the CI Postgres like local.
ConnectionStrings__MasterDataDb: "Host=localhost;Port=5432;Database=evolith_tracker;Username=evolith;Password=localdev"
DOTNET_NOLOGO: "true"
DOTNET_CLI_TELEMETRY_OPTOUT: "true"
defaults:
run:
working-directory: src/apps/tracker-api
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.x"
- name: Restore
run: dotnet restore Tracker.sln
- name: Build (0 warnings enforced)
run: dotnet build Tracker.sln --no-restore -c Release -warnaserror
- name: Apply EF Core migrations
run: |
dotnet tool install --global dotnet-ef
export PATH="$PATH:$HOME/.dotnet/tools"
# Two DbContexts exist (DS-07 added TenantProjectionDbContext for the
# MasterData tenant-projection schema). `database update` is ambiguous
# without --context. Pass --connection explicitly so both apply against
# the CI Postgres regardless of design-time config resolution (the
# TenantProjection context otherwise falls back to localhost/postgres).
CI_CONN="Host=localhost;Port=5432;Database=evolith_tracker;Username=evolith;Password=localdev"
for ctx in TrackerDbContext TenantProjectionDbContext; do
dotnet ef database update \
--context "$ctx" \
--connection "$CI_CONN" \
--project Tracker.Infrastructure \
--startup-project Tracker.Presentation \
--configuration Release
done
- name: Test
run: dotnet test Tracker.sln --no-build -c Release --logger "trx;LogFileName=test-results.trx"
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: backend-test-results
path: src/apps/tracker-api/**/TestResults/*.trx
if-no-files-found: ignore
frontend:
name: Frontend (lint + typecheck + build)
runs-on: ubuntu-latest
defaults:
run:
working-directory: src
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: src/package-lock.json
- name: Install dependencies
run: npm ci
- name: Lint
run: npx nx lint tracker-web
- name: Typecheck
run: npx nx typecheck tracker-web
- name: Build
run: npx nx build tracker-web