-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (106 loc) · 3.72 KB
/
lighthouse.yml
File metadata and controls
121 lines (106 loc) · 3.72 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
name: Lighthouse
on:
pull_request:
branches: [main]
paths:
- 'frontend/**'
- 'backend/**'
- '.github/workflows/lighthouse.yml'
workflow_dispatch:
concurrency:
group: lighthouse-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
jobs:
lighthouse:
name: Lighthouse — /knowledge-maps/:id
runs-on: ubuntu-latest
services:
sqlserver:
image: mcr.microsoft.com/azure-sql-edge:1.0.7
env:
ACCEPT_EULA: "Y"
MSSQL_SA_PASSWORD: Strong!Passw0rd
MSSQL_PID: Developer
ports:
- 1433:1433
options: >-
--health-cmd "timeout 3 bash -c 'exec 3<>/dev/tcp/localhost/1433' 2>/dev/null"
--health-interval 10s
--health-timeout 5s
--health-retries 10
--health-start-period 30s
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 3s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Enable pnpm
run: corepack enable
- name: Install frontend deps
working-directory: frontend
run: pnpm install --frozen-lockfile
- name: Build web-portal (production)
working-directory: frontend
run: ./node_modules/.bin/nx build web-portal --configuration=production
- name: Seed the database
working-directory: backend
env:
Infrastructure__SqlConnectionString: "Server=localhost,1433;Database=CCE;User Id=sa;Password=Strong!Passw0rd;TrustServerCertificate=True;"
Infrastructure__RedisConnectionString: "localhost:6379"
run: dotnet run --project src/CCE.Seeder -- --demo
- name: Boot External API in background
working-directory: backend
env:
ASPNETCORE_URLS: http://localhost:5001
ASPNETCORE_ENVIRONMENT: Development
Keycloak__Authority: http://localhost:8080/realms/cce
Keycloak__Audience: cce-api
Keycloak__RequireHttpsMetadata: "false"
Infrastructure__SqlConnectionString: "Server=localhost,1433;Database=CCE;User Id=sa;Password=Strong!Passw0rd;TrustServerCertificate=True;"
Infrastructure__RedisConnectionString: "localhost:6379"
run: |
nohup dotnet run --project src/CCE.Api.External --no-launch-profile > /tmp/api.log 2>&1 &
for i in $(seq 1 30); do
sleep 2
if curl -fsS http://localhost:5001/health > /dev/null; then
echo "API up"; exit 0
fi
done
echo "API failed to start"; tail -50 /tmp/api.log; exit 1
- name: Serve production SPA
working-directory: frontend
run: |
npx --yes serve -l 4200 dist/apps/web-portal/browser > /tmp/serve.log 2>&1 &
for i in $(seq 1 10); do
sleep 1
if curl -fsS http://localhost:4200/ | grep -q "<html"; then
echo "SPA up"; exit 0
fi
done
echo "SPA failed to start"; tail -20 /tmp/serve.log; exit 1
- name: Run Lighthouse
uses: treosh/lighthouse-ci-action@v11
with:
urls: |
http://localhost:4200/knowledge-maps/01eec8cb-87ea-cd59-7e72-16e3639a59f3
uploadArtifacts: true
temporaryPublicStorage: true
configPath: ./.github/workflows/lighthouserc.json
- name: Tail API log on failure
if: failure()
run: tail -80 /tmp/api.log || true