-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (52 loc) · 1.61 KB
/
python-ci.yml
File metadata and controls
65 lines (52 loc) · 1.61 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
name: Python CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
pip install .[test]
pip install pytest
- name: Start CockroachDB (latest)
run: |
docker run -d \
--name crdb \
-p 26257:26257 \
-p 8080:8080 \
cockroachdb/cockroach:latest \
start-single-node --insecure
- name: Set CRDB_URL environment variable
run: echo "CRDB_URL=cockroachdb://root@localhost:26257/defaultdb?sslmode=disable" >> $GITHUB_ENV
- name: Wait for DB to be ready
run: sleep 5
- name: Initialize test database
run: |
docker exec crdb ./cockroach sql --insecure --host=localhost -e "
USE defaultdb;
CREATE TABLE users (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name STRING
);
INSERT INTO users (name) VALUES
('Alice'), ('Bob'), ('Virag'), ('Allen'), ('Andrew'), ('David');
"
- name: Build package
run: python -m build
- name: Install project
run: pip install .
- name: Run all tests
run: pytest -ra -q -m "not integration or integration"
- name: Check for log file
run: test -f logs/crdb_dump.log