-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (114 loc) · 3.96 KB
/
Copy pathci.yml
File metadata and controls
119 lines (114 loc) · 3.96 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
name: CI
on:
push:
branches: [ master]
pull_request:
jobs:
python:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: profiling
POSTGRES_PASSWORD: profiling
POSTGRES_DB: website_profiling
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U profiling -d website_profiling"
--health-interval 5s
--health-timeout 3s
--health-retries 5
env:
DATABASE_URL: postgres://profiling:profiling@localhost:5432/website_profiling
WEBSITE_PROFILING_ROOT: ${{ github.workspace }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Install dependencies
run: pip install -r requirements.txt
- name: Apply EF Core migrations
run: dotnet run --project services/Schema/src/Schema.Migrator --configuration Release
- name: Pytest (core, 100% coverage)
run: pytest tests/ -q -m "not browser"
- name: Pytest (reporting coverage gate)
run: |
pytest tests/reporting/ \
--cov=website_profiling.reporting --cov-config=.coveragerc.reporting \
--cov-report=term-missing --cov-fail-under=100 -q -o addopts=
- name: Pytest (tools coverage gate)
run: |
pytest tests/tools/ tests/clients/ \
--cov=website_profiling.tools --cov-config=.coveragerc.tools \
--cov-report=term-missing --cov-fail-under=100 -q -o addopts=
- name: CLI smoke
run: python -m src --help
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build backend image
run: docker build -t website-profiling:ci .
- name: Build web image
run: docker build -t website-profiling-web:ci ./web --build-arg VITE_BFF_BASE_URL=http://localhost:8090
- name: Browser crawl tests in image
run: |
docker run --rm \
website-profiling:ci \
/opt/venv/bin/pytest tests/test_crawl_fetchers.py tests/test_crawler_browser_e2e.py -m browser -q -o addopts=
- name: Compose smoke (full stack)
env:
BACKEND_IMAGE: website-profiling:ci
WEB_IMAGE: website-profiling-web:ci
run: |
docker compose -f docker-compose.pull.yml up -d --wait
curl -fsS http://127.0.0.1:8090/health
curl -fsS http://127.0.0.1:8094/health
curl -fsS http://127.0.0.1:8090/api/jobs
curl -fsS http://127.0.0.1:8090/api/report/meta
curl -fsS http://127.0.0.1:3000/home
docker compose -f docker-compose.pull.yml down -v
web:
runs-on: ubuntu-latest
defaults:
run:
working-directory: web
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: npm
cache-dependency-path: web/package-lock.json
- name: Install
run: npm ci
- name: Build
run: npm run build
- name: Typecheck
run: npm run typecheck
- name: Lint
run: npm run lint
- name: Test
run: npm test
dotnet:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Test .NET services
run: dotnet test services/WebsiteProfiling.slnx
- name: Generated client drift gate
run: |
dotnet tool install -g NSwag.ConsoleCore
export PATH="$PATH:$HOME/.dotnet/tools"
(cd services/Bff && nswag run nswag.json)
git diff --exit-code services/Bff/src/Bff.Application/Generated/FastApiClient.g.cs \
|| (echo "::error::FastApiClient.g.cs is stale — run services/Bff/generate-client.sh and commit." && exit 1)