Repository navigation
150 lines (125 loc) · 4.63 KB
/
Copy pathci.yml
File metadata and controls
150 lines (125 loc) · 4.63 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: CI
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
verify:
name: Lint, typecheck, tests and build
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Set up Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: 24
cache: npm
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint
- name: Typecheck
run: npm run typecheck
- name: Unit tests
run: npm test
- name: Production build
run: npm run build
site-quality:
name: Browser and SEO checks
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Set up Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: 24
cache: npm
- name: Set up .NET for browser checks
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6
with:
dotnet-version: 10.0.x
- name: Install dependencies
run: npm ci
- name: Check desktop and mobile browser behavior
env:
E2E_DOTNET: '1'
run: npm run e2e
- name: Crawl production build and verify SEO
run: npm run launch-check
- name: Upload browser failure screenshots
if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: browser-screenshots-${{ github.run_attempt }}
path: e2e/.out/*.png
include-hidden-files: true
if-no-files-found: ignore
retention-days: 7
backend:
name: Backend build and tests
runs-on: ubuntu-24.04
timeout-minutes: 15
services:
postgres:
image: postgres:17-alpine
env:
# Fixed credentials are only for this disposable CI database.
POSTGRES_DB: procoderji_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres -d procoderji_test"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Set up .NET
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6
with:
dotnet-version: 10.0.x
- name: Restore backend dependencies
run: dotnet restore backend/ProCoderJi.slnx --locked-mode
- name: Build backend
run: dotnet build backend/ProCoderJi.slnx --configuration Release --no-restore
- name: Test backend
run: dotnet test backend/ProCoderJi.slnx --configuration Release --no-build --collect:"XPlat Code Coverage" --results-directory "$RUNNER_TEMP/backend-test-results"
- name: Verify API coverage collection
run: |
python3 - "$RUNNER_TEMP/backend-test-results" <<'PY'
import sys
import xml.etree.ElementTree as ET
from pathlib import Path
reports = list(Path(sys.argv[1]).rglob("coverage.cobertura.xml"))
covered = any(
int(line.get("hits", "0")) > 0
for report in reports
for package in ET.parse(report).findall("./packages/package")
if package.get("name") == "ProCoderJi.Api"
for line in package.findall(".//line")
)
if not covered:
raise SystemExit("Coverage collection did not record executed ProCoderJi.Api lines.")
print("Coverage collection recorded executed ProCoderJi.Api lines.")
PY
- name: Verify PostgreSQL migrations
# Validates the PostgreSQL schema path; Google sign-in needs separate live checks.
env:
ASPNETCORE_ENVIRONMENT: Development
Database__Provider: Postgres
ConnectionStrings__Platform: 'Host=localhost;Port=5432;Database=procoderji_test;Username=postgres;Password=postgres'
PublicOrigin: http://localhost:3000
run: dotnet run --project backend/src/ProCoderJi.Api --configuration Release --no-build --no-launch-profile -- --migrate