-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (86 loc) · 2.68 KB
/
Copy pathci.yml
File metadata and controls
90 lines (86 loc) · 2.68 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
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'
- name: Install dependencies
run: pip install -r requirements.txt
- name: Apply migrations
run: alembic upgrade head
- 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/ \
--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 image
run: docker build -t website-profiling:ci .
- 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 (postgres + web)
env:
WEB_IMAGE: website-profiling:ci
run: |
docker compose -f docker-compose.pull.yml up -d --wait
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: Typecheck
run: npm run typecheck
- name: Lint
run: npm run lint
- name: Test
run: npm test