forked from OurHike/OurHike
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (67 loc) · 2.18 KB
/
Copy pathbackend-tests.yml
File metadata and controls
78 lines (67 loc) · 2.18 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
name: Backend tests
on:
# `main` only. Matching every branch here would double every PR's CI:
# pushing to a PR branch fires BOTH the push event and the pull_request
# event for the same commit, running each job twice for an identical
# result. The pull_request trigger below already covers branches.
#
# This run is still worth keeping for main itself - it is post-merge
# validation against the real merge commit, which is exactly what caught
# the flaky staleness boundary test in #32 (green on the PR, red on the
# merge).
push:
branches: [main]
pull_request:
branches: [main]
jobs:
pytest-duckdb:
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.14"
- name: Install dependencies
run: pip install -r requirements-dev.txt
- name: Lint
run: python -m ruff check .
- name: Check formatting
run: python -m ruff format --check .
- name: Run tests (DuckDB - fast, local-dev-equivalent)
run: python -m pytest -v
pytest-postgres:
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: ourhike
POSTGRES_PASSWORD: ourhike
POSTGRES_DB: ourhike_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
# The real correctness gate: same test suite as the DuckDB job above,
# against the real production database engine (Postgres) instead of
# the local-dev DuckDB convenience layer. See backend/README.md.
DATABASE_URL: postgresql+psycopg://ourhike:ourhike@localhost:5432/ourhike_test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.14"
- name: Install dependencies
run: pip install -r requirements-dev.txt
- name: Run tests (Postgres)
run: python -m pytest -v