Skip to content

Commit cb8b5cd

Browse files
authored
Add github workflows. (#40)
* Add github workflows which run tests. * Add several badges.
1 parent 1d79a49 commit cb8b5cd

File tree

7 files changed

+94
-50
lines changed

7 files changed

+94
-50
lines changed

.github/workflows/base-test.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: Base-Test
5+
6+
on:
7+
workflow_call:
8+
9+
jobs:
10+
test:
11+
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
python-version: ["3.8", "3.9", "3.10", "3.11"]
17+
django-version: ["32", "40", "41", "42"]
18+
include:
19+
- python-version: "3.7"
20+
django-version: "32"
21+
22+
name: Python${{ matrix.python-version }} Django${{ matrix.django-version }}
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v3
26+
- name: Set up Python ${{ matrix.python-version }}
27+
uses: actions/setup-python@v3
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
- name: Install dependencies
31+
run: |
32+
python -m pip install --upgrade pip
33+
python -m pip install tox
34+
- name: Lint code
35+
run: tox -e lint
36+
- name: Start clickhouse cluster
37+
run: docker compose up -d --wait
38+
- name: Run test
39+
# Run tox using the version of Python in `PATH`
40+
run: tox -e py-django${{ matrix.django-version }}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: Test before pull request
5+
6+
on:
7+
pull_request:
8+
branches: [ "main" ]
9+
10+
jobs:
11+
test:
12+
uses: ./.github/workflows/base-test.yml

.github/workflows/test-main.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: test
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
10+
jobs:
11+
test:
12+
uses: ./.github/workflows/base-test.yml

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
### 1.1.2
22
- Use [flake8](https://flake8.pycqa.org/) to lint code.
3+
- Add GitHub action which runs tests.
34

45
### 1.1.1
56
- [Black](https://github.com/psf/black) code style.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
Django ClickHouse Database Backend
22
===
3+
[![PyPI - Version](https://img.shields.io/pypi/v/django-clickhouse-backend)](https://pypi.org/project/django-clickhouse-backend)
4+
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-clickhouse-backend)](https://pypi.org/project/django-clickhouse-backend)
5+
[![PyPI django version](https://img.shields.io/pypi/frameworkversions/django/django-clickhouse-backend)](https://pypi.org/project/django-clickhouse-backend)
6+
[![PyPI - Downloads](https://img.shields.io/pypi/dm/django-clickhouse-backend)](https://pypi.org/project/django-clickhouse-backend)
7+
[![GitHub licence](https://img.shields.io/github/license/jayvynl/django-clickhouse-backend)](https://github.com/jayvynl/django-clickhouse-backend/blob/main/LICENSE)
8+
[![GitHub Action: Test](https://github.com/jayvynl/django-clickhouse-backend/actions/workflows/test-main.yml/badge.svg)](https://github.com/jayvynl/django-clickhouse-backend/actions/workflows/test-main.yml)
39
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
410

511
Django clickhouse backend is a [django database backend](https://docs.djangoproject.com/en/4.1/ref/databases/) for

compose.yaml

Lines changed: 22 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,52 @@
1+
x-base-service: &base-service
2+
image: clickhouse/clickhouse-server:23.6.2.18
3+
restart: always
4+
environment:
5+
- "CLICKHOUSE_DB=other"
6+
ulimits:
7+
nofile:
8+
soft: 262144
9+
hard: 262144
10+
healthcheck:
11+
test: ["CMD", "clickhouse-client", "-q", "SELECT 1"]
12+
interval: 30s
13+
timeout: 5s
14+
retries: 3
15+
116
services:
217
node1:
3-
image: clickhouse/clickhouse-server:23.6.2.18
18+
<<: *base-service
419
container_name: clickhouse-node1
5-
restart: always
6-
environment:
7-
- "CLICKHOUSE_DB=other"
820
volumes:
921
- "node1:/var/lib/clickhouse/"
1022
- "./clickhouse-config/node1/:/etc/clickhouse-server/config.d/"
1123
ports:
1224
- "127.0.0.1:9000:9000"
13-
ulimits:
14-
nofile:
15-
soft: 262144
16-
hard: 262144
17-
healthcheck:
18-
test: ["CMD", "wget", "--spider", "-q", "localhost:8123/ping"]
19-
interval: 30s
20-
timeout: 5s
2125
node2:
22-
image: clickhouse/clickhouse-server:23.6.2.18
26+
<<: *base-service
2327
container_name: clickhouse-node2
24-
restart: always
25-
environment:
26-
- "CLICKHOUSE_DB=other"
2728
volumes:
2829
- "node2:/var/lib/clickhouse/"
2930
- "./clickhouse-config/node2/:/etc/clickhouse-server/config.d/"
3031
ports:
3132
- "127.0.0.1:9001:9000"
32-
ulimits:
33-
nofile:
34-
soft: 262144
35-
hard: 262144
36-
healthcheck:
37-
test: ["CMD", "wget", "--spider", "-q", "localhost:8123/ping"]
38-
interval: 30s
39-
timeout: 5s
4033
node3:
41-
image: clickhouse/clickhouse-server:23.6.2.18
34+
<<: *base-service
4235
container_name: clickhouse-node3
43-
restart: always
44-
environment:
45-
- "CLICKHOUSE_DB=other"
4636
volumes:
4737
- "node3:/var/lib/clickhouse/"
4838
- "./clickhouse-config/node3/:/etc/clickhouse-server/config.d/"
4939
ports:
5040
- "127.0.0.1:9002:9000"
51-
ulimits:
52-
nofile:
53-
soft: 262144
54-
hard: 262144
55-
healthcheck:
56-
test: ["CMD", "wget", "--spider", "-q", "localhost:8123/ping"]
57-
interval: 30s
58-
timeout: 5s
5941
node4:
60-
image: clickhouse/clickhouse-server:23.6.2.18
42+
<<: *base-service
6143
container_name: clickhouse-node4
62-
restart: always
63-
environment:
64-
- "CLICKHOUSE_DB=other"
6544
volumes:
6645
- "node4:/var/lib/clickhouse/"
6746
- "./clickhouse-config/node4/:/etc/clickhouse-server/config.d/"
6847
ports:
6948
- "127.0.0.1:9003:9000"
70-
ulimits:
71-
nofile:
72-
soft: 262144
73-
hard: 262144
74-
healthcheck:
75-
test: ["CMD", "wget", "--spider", "-q", "localhost:8123/ping"]
76-
interval: 30s
77-
timeout: 5s
49+
7850
volumes:
7951
node1:
8052
name: clickhouse-node1
@@ -84,6 +56,7 @@ volumes:
8456
name: clickhouse-node3
8557
node4:
8658
name: clickhouse-node4
59+
8760
networks:
8861
default:
89-
name: clickhouse-net
62+
name: clickhouse-net

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ commands =
1919
description = lint code
2020
skip_install = true
2121
deps =
22-
flake8==6.1.0
22+
flake8
2323
commands =
2424
flake8 --max-line-length=88 --extend-ignore=E203,E501 {[variables]code}
2525

0 commit comments

Comments
 (0)