Skip to content

Commit e90dbc9

Browse files
add github actions
1 parent 50af8ba commit e90dbc9

5 files changed

Lines changed: 87 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: ["**"]
6+
pull_request:
7+
8+
jobs:
9+
lint:
10+
name: Lint (ruff + black)
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.11"
19+
20+
- name: Install dev tools
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install -r requirements-dev.txt
24+
25+
- name: Ruff (lint)
26+
run: ruff check .
27+
28+
- name: Black (format check)
29+
run: black --check --diff .
30+
31+
test:
32+
name: Tests (pytest)
33+
runs-on: ubuntu-latest
34+
needs: lint
35+
strategy:
36+
matrix:
37+
python-version: ["3.10", "3.11", "3.12"]
38+
steps:
39+
- uses: actions/checkout@v4
40+
41+
- name: Set up Python ${{ matrix.python-version }}
42+
uses: actions/setup-python@v5
43+
with:
44+
python-version: ${{ matrix.python-version }}
45+
46+
- name: Cache pip
47+
uses: actions/cache@v4
48+
with:
49+
path: ~/.cache/pip
50+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
51+
restore-keys: |
52+
${{ runner.os }}-pip-
53+
54+
- name: Install deps
55+
run: |
56+
python -m pip install --upgrade pip
57+
pip install -r requirements.txt;
58+
- name: Run pytest
59+
run: pytest -q

pyproject.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[tool.black]
2+
line-length = 100
3+
target-version = ["py311"]
4+
5+
[tool.ruff]
6+
line-length = 100
7+
target-version = "py311"
8+
exclude = [
9+
".git",
10+
".venv",
11+
"venv",
12+
"env",
13+
"__pycache__",
14+
"build",
15+
"dist"
16+
]
17+
18+
[tool.ruff.lint]
19+
select = ["E", "F", "I"]
20+
ignore = []

pytest.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[pytest]
2+
addopts = -q
3+
testpaths = tests
4+
python_files = test_*.py

service/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# write required libraries.
2-
jupyterlab==4.4.6
2+
jupyterlab==4.4.6
3+
pytest==8.4.1

tests/test_smoke.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def test_smoke():
2+
assert 1 + 1 == 2

0 commit comments

Comments
 (0)