Skip to content

Commit 4e2f195

Browse files
committed
add ci tests
1 parent e34b485 commit 4e2f195

File tree

7 files changed

+183
-1
lines changed

7 files changed

+183
-1
lines changed

.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[*]
2+
charset = utf-8
3+
end_of_line = lf
4+
insert_final_newline = true
5+
indent_style = space
6+
indent_size = 4
7+
8+
[{*.yaml, *.yml}]
9+
indent_size = 2
10+
11+
[*.py]
12+
# See Ruff config
13+
max_line_length = 120

.github/workflows/ci.yaml

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: CI
2+
"on":
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
schedule:
10+
- cron: "0 0 * * *"
11+
concurrency:
12+
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
13+
cancel-in-progress: true
14+
jobs:
15+
lint:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
python-version: ["3.12"]
20+
steps:
21+
- uses: actions/checkout@v4
22+
- uses: eifinger/setup-rye@v4
23+
id: setup-rye
24+
with:
25+
enable-cache: true
26+
cache-prefix: ${{ matrix.python-version }}
27+
- name: Pin python-version ${{ matrix.python-version }}
28+
if: steps.setup-rye.outputs.cache-hit != 'true'
29+
run: rye pin ${{ matrix.python-version }}
30+
- name: Format check
31+
run: rye fmt --check
32+
- name: Lint check
33+
run: rye lint
34+
test:
35+
runs-on: ubuntu-latest
36+
strategy:
37+
matrix:
38+
python-version: ["3.10", "3.11", "3.12"]
39+
steps:
40+
- uses: actions/checkout@v4
41+
- uses: eifinger/setup-rye@v4
42+
id: setup-rye
43+
with:
44+
enable-cache: true
45+
cache-prefix: ${{ matrix.python-version }}
46+
- name: Pin python-version ${{ matrix.python-version }}
47+
if: steps.setup-rye.outputs.cache-hit != 'true'
48+
run: rye pin ${{ matrix.python-version }}
49+
- name: Install dependencies
50+
if: steps.setup-rye.outputs.cache-hit != 'true'
51+
run: |
52+
rye sync --no-lock
53+
- name: Test
54+
run: rye test -- --cov-report term-missing
55+
build:
56+
runs-on: ubuntu-latest
57+
strategy:
58+
matrix:
59+
python-version: ["3.12"]
60+
steps:
61+
- uses: actions/checkout@v4
62+
with:
63+
fetch-depth: 10
64+
fetch-tags: true
65+
- uses: eifinger/setup-rye@v4
66+
id: setup-rye
67+
with:
68+
enable-cache: true
69+
cache-prefix: ${{ matrix.python-version }}
70+
- name: Pin python-version ${{ matrix.python-version }}
71+
if: steps.setup-rye.outputs.cache-hit != 'true'
72+
run: rye pin ${{ matrix.python-version }}
73+
- name: Build
74+
run: rye build --clean
75+
- uses: actions/upload-artifact@v4
76+
with:
77+
name: dist_${{ github.ref }}
78+
path: dist

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ dist/
66
wheels/
77
*.egg-info
88

9+
.coverage*
10+
htmlcov
11+
912
# venv
1013
.venv
1114

.pre-commit-config.yaml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: rye-lint
5+
name: rye-lint
6+
description: "Lint Python via 'rye lint'"
7+
entry: rye lint --fix
8+
language: system
9+
types_or: [python, pyi]
10+
args: []
11+
require_serial: true
12+
additional_dependencies: []
13+
minimum_pre_commit_version: "2.9.2"
14+
- id: rye-format
15+
name: rye-format
16+
description: "Format Python via 'rye fmt'"
17+
entry: rye fmt
18+
language: system
19+
types_or: [python, pyi]
20+
args: []
21+
require_serial: true
22+
additional_dependencies: []
23+
minimum_pre_commit_version: "2.9.2"
24+
- id: rye-test
25+
name: rye-test
26+
description: "Test Python via 'rye test'"
27+
entry: rye test
28+
language: system
29+
types_or: [python, pyi]
30+
args: []
31+
pass_filenames: false
32+
require_serial: true
33+
additional_dependencies: []
34+
minimum_pre_commit_version: "2.9.2"

pyproject.toml

+15-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ version-file = "src/simpy_playground/_version.py"
4646

4747
[tool.rye]
4848
managed = true
49-
dev-dependencies = []
49+
dev-dependencies = [
50+
"pytest>=8.2.2",
51+
"pytest-cov>=5.0.0",
52+
"pre-commit>=3.7.1",
53+
"pyright>=1.1.371",
54+
]
5055

5156
[tool.hatch.metadata]
5257
allow-direct-references = true
@@ -56,3 +61,12 @@ include = ["src/simpy_playground"]
5661

5762
[tool.hatch.build.targets.wheel]
5863
packages = ["src/simpy_playground"]
64+
65+
[tool.ruff]
66+
target-version = "py310"
67+
line-length = 120
68+
69+
[tool.pytest.ini_options]
70+
minversion = "6.0"
71+
addopts = "-ra -q -vvv --cov=simpy_playground"
72+
testpaths = ["tests"]

requirements-dev.lock

+35
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,40 @@
1010
# universal: false
1111

1212
-e file:.
13+
cfgv==3.4.0
14+
# via pre-commit
15+
coverage==7.5.4
16+
# via pytest-cov
17+
distlib==0.3.8
18+
# via virtualenv
19+
exceptiongroup==1.2.1
20+
# via pytest
21+
filelock==3.15.4
22+
# via virtualenv
23+
identify==2.6.0
24+
# via pre-commit
25+
iniconfig==2.0.0
26+
# via pytest
27+
nodeenv==1.9.1
28+
# via pre-commit
29+
# via pyright
30+
packaging==24.1
31+
# via pytest
32+
platformdirs==4.2.2
33+
# via virtualenv
34+
pluggy==1.5.0
35+
# via pytest
36+
pre-commit==3.7.1
37+
pyright==1.1.371
38+
pytest==8.2.2
39+
# via pytest-cov
40+
pytest-cov==5.0.0
41+
pyyaml==6.0.1
42+
# via pre-commit
1343
simpy==4.1.1
1444
# via simpy-playground
45+
tomli==2.0.1
46+
# via coverage
47+
# via pytest
48+
virtualenv==20.26.3
49+
# via pre-commit

tests/test_main.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from simpy_playground.__main__ import main
2+
3+
4+
def test_main():
5+
main()

0 commit comments

Comments
 (0)