Repository navigation
106 lines (92 loc) · 3.11 KB
/
Copy pathpython-package.yml
File metadata and controls
106 lines (92 loc) · 3.11 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
# Run the test suite on push and on pull requests.
#
# This replaces an inherited matrix spanning Python 3.10-3.13 across Linux,
# macOS and Windows. That matrix was never run against this code: the suite has
# only ever been exercised on Python 3.12 (host) and inside the project's own
# 3.11 container. Claiming untested versions as a gate is worse than not gating
# them, because it turns the first push into a coin flip.
#
# 3.11 and 3.12 are kept because both are real: 3.11 is the Dockerfile base
# image, 3.12 is what the tests are run against interactively. Adding a version
# means actually running the suite on it first.
name: Test
on:
push:
branches: [master]
pull_request:
branches: [master]
# A newer push to the same branch makes the in-flight run irrelevant.
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
pytest:
name: pytest (python ${{ matrix.python-version }})
runs-on: ubuntu-latest
timeout-minutes: 25
strategy:
# Do not let one version's failure hide another's result.
fail-fast: false
matrix:
python-version: ['3.11', '3.12']
services:
postgres:
image: postgres:14-alpine
env:
POSTGRES_USER: algorithex_user
POSTGRES_PASSWORD: password
POSTGRES_DB: algorithex_db
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:6-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_NAME: algorithex_db
POSTGRES_USERNAME: algorithex_user
POSTGRES_PASSWORD: password
REDIS_HOST: localhost
REDIS_PORT: 6379
REDIS_PASSWORD: ''
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov
# The image does `pip install -e .` too. Without it CI tests a bare
# source tree that has no distribution metadata, which is not what
# anyone deploys -- and it silently skipped 70 test modules at
# collection before this was added.
pip install -e .
- name: Test
# Exit status is taken from pytest itself, not from the pipe: `pytest |
# tail` returns tail's status and would report success on a failed run.
run: |
set -o pipefail
python -m pytest -q 2>&1 | tail -40
- name: Check the static assets the dashboard serves
run: |
set -o pipefail
python -m pytest tests/test_static_cache_headers.py \
tests/test_live_feed_injection.py -q 2>&1 | tail -20