File tree Expand file tree Collapse file tree 4 files changed +68
-6
lines changed Expand file tree Collapse file tree 4 files changed +68
-6
lines changed Original file line number Diff line number Diff line change
1
+ name : CI
2
+
3
+ on :
4
+ push :
5
+ branches : [ main ]
6
+ pull_request :
7
+ branches : [ main ]
8
+
9
+ jobs :
10
+ build :
11
+ name : ' Build and test fjsplib using ${{ matrix.python-version }}'
12
+ runs-on : ubuntu-latest
13
+ strategy :
14
+ fail-fast : true
15
+ matrix :
16
+ python-version : ['3.9', '3.12']
17
+ steps :
18
+ - uses : actions/checkout@v4
19
+ - uses : actions/setup-python@v5
20
+ with :
21
+ python-version : ${{ matrix.python-version }}
22
+ - name : Update pip and poetry
23
+ run : |
24
+ python -m pip install --upgrade pip
25
+ pip install poetry
26
+ - name : Cache Python dependencies
27
+ uses : actions/cache@v4
28
+ id : cache-python
29
+ with :
30
+ path : ~/.cache/pypoetry
31
+ key : ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}
32
+ - name : Install Python dependencies
33
+ if : steps.cache-python.outputs.cache-hit != 'true'
34
+ run : poetry install
35
+ - name : Cache pre-commit
36
+ uses : actions/cache@v4
37
+ id : cache-pre-commit
38
+ with :
39
+ path : ~/.cache/pre-commit/
40
+ key : pre-commit-${{ env.pythonLocation }}-${{ hashFiles('.pre-commit-config.yaml') }}
41
+ - name : Install pre-commit
42
+ if : steps.cache-pre-commit.outputs.cache-hit != 'true'
43
+ run : poetry run pre-commit install --install-hooks
44
+ - name : Run pre-commit
45
+ run : poetry run pre-commit run --all-files
46
+ - name : Run tests
47
+ run : poetry run pytest
48
+ - if : matrix.python-version == '3.9'
49
+ name : Upload coverage reports to Codecov
50
+ uses : codecov/codecov-action@v4.0.1
51
+ env :
52
+ CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
53
+ slug : leonlan/FJSPLIB
Original file line number Diff line number Diff line change 1
1
# FJSPLIB
2
+ ![ PyPI] ( https://img.shields.io/pypi/v/FJSPLIB?style=flat-square )
3
+ ![ License] ( https://img.shields.io/pypi/l/FJSPLIB?style=flat-square )
4
+ ![ CI] ( https://img.shields.io/github/actions/workflow/status/leonlan/FJSPLIB/.github%2Fworkflows%2FCI.yml?style=flat-square )
5
+ ![ Codecov] ( https://img.shields.io/codecov/c/github/leonlan/FJSPLIB?style=flat-square )
2
6
3
7
FJSPLIB is a Python package for reading and writing flexible job shop problem (FJSP) instances.
Original file line number Diff line number Diff line change 1
1
from dataclasses import dataclass
2
2
from pathlib import Path
3
+ from typing import Union
3
4
4
5
ProcessingData = list [tuple [int , int ]]
5
6
Arc = tuple [int , int ]
@@ -115,7 +116,7 @@ def read(loc: Path) -> Instance:
115
116
)
116
117
117
118
118
- def file2lines (loc : Path | str ) -> list [list [int ]]:
119
+ def file2lines (loc : Union [ Path , str ] ) -> list [list [int ]]:
119
120
with open (loc , "r" ) as fh :
120
121
lines = [line for line in fh .readlines () if line .strip ()]
121
122
Original file line number Diff line number Diff line change @@ -11,20 +11,23 @@ repository = "https://github.com/leonlan/FJSPLIB"
11
11
python = " ^3.9"
12
12
numpy = " ^1.26.4"
13
13
14
-
15
14
[tool .poetry .group .dev .dependencies ]
16
- pytest = " ^7.1.2"
17
15
pre-commit = " ^2.19.0"
16
+ pytest = " ^7.1.2"
17
+ pytest-cov = " >=2.6.1"
18
18
19
19
20
20
[tool .black ]
21
21
line-length = 79
22
22
23
23
24
+ [tool .mypy ]
25
+ ignore_missing_imports = true
26
+
27
+
24
28
[tool .ruff ]
25
29
line-length = 79
26
30
27
-
28
31
[tool .ruff .lint ]
29
32
ignore-init-module-imports = true
30
33
select = [
@@ -36,8 +39,9 @@ case-sensitive = true
36
39
known-first-party = [" fjsplib" , " tests" ]
37
40
38
41
39
- [tool .mypy ]
40
- ignore_missing_imports = true
42
+ [tool .pytest .ini_options ]
43
+ addopts = " --cov=. --cov-report=xml --cov-report=term"
44
+ testpaths = " tests"
41
45
42
46
43
47
[build-system ]
You can’t perform that action at this time.
0 commit comments