Repository navigation
88 lines (78 loc) · 3.07 KB
/
Copy pathtest-crud.yml
File metadata and controls
88 lines (78 loc) · 3.07 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
name: Tests
on:
pull_request:
paths:
- 'components/rsptx/db/**'
- 'components/rsptx/configuration/**'
- 'components/rsptx/validation/**'
- 'components/rsptx/response_helpers/**'
- 'components/rsptx/endpoint_validators/**'
- 'bases/rsptx/book_server_api/**'
- 'bases/rsptx/assignment_server_api/**'
- 'test/**'
- '.github/workflows/test-crud.yml'
- 'pyproject.toml'
- 'uv.lock'
jobs:
crud-tests:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: runestone
POSTGRES_PASSWORD: runestone
POSTGRES_DB: runestone_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
SERVER_CONFIG: test
TEST_DBURL: postgresql://runestone:runestone@localhost:5432/runestone_test
DROP_TABLES: "Yes"
# Routes that render a book page read BOOK_PATH directly. No books are
# built here, so point it at the stub tree created below.
BOOK_PATH: ${{ github.workspace }}/test_books
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install dependencies
# uv installs the default groups (dev + docs, see [tool.uv] in
# pyproject.toml), matching what `poetry install` pulled in before.
#
# pycairo publishes no Linux wheels, so installing it means compiling
# against system cairo headers the runner doesn't have. It is only here
# transitively (pretext[prefigure] -> prefig[text] -> pycairo) and none
# of these tests touch pretext, so skip it rather than apt-installing
# libcairo2-dev and building a C extension on every run.
run: uv sync --no-install-package pycairo
- name: Create stub static asset directories
run: |
mkdir -p bases/rsptx/assignment_server_api/react
mkdir -p bases/rsptx/assignment_server_api/staticAssets
# doAssignment loads the book's webpack manifest for the student's
# base course; testuser1 is seeded into "overview". An empty manifest
# is enough -- the tests check routing, not the script tags.
mkdir -p test_books/overview/published/overview/_static
echo '{"js": [], "css": []}' > \
test_books/overview/published/overview/_static/webpack_static_imports.json
# settings.error_path is BOOK_PATH/tickets; the 500 handler writes
# tracebacks there.
mkdir -p test_books/tickets
- name: Run tests
# --no-sync: `uv run` otherwise re-syncs the environment, which would
# undo the pycairo exclusion above and fail the same way.
run: uv run --no-sync pytest -v --tb=short