File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree 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 11# 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 )
26
37FJSPLIB is a Python package for reading and writing flexible job shop problem (FJSP) instances.
Original file line number Diff line number Diff line change 11from dataclasses import dataclass
22from pathlib import Path
3+ from typing import Union
34
45ProcessingData = list [tuple [int , int ]]
56Arc = tuple [int , int ]
@@ -115,7 +116,7 @@ def read(loc: Path) -> Instance:
115116 )
116117
117118
118- def file2lines (loc : Path | str ) -> list [list [int ]]:
119+ def file2lines (loc : Union [ Path , str ] ) -> list [list [int ]]:
119120 with open (loc , "r" ) as fh :
120121 lines = [line for line in fh .readlines () if line .strip ()]
121122
Original file line number Diff line number Diff line change @@ -11,20 +11,23 @@ repository = "https://github.com/leonlan/FJSPLIB"
1111python = " ^3.9"
1212numpy = " ^1.26.4"
1313
14-
1514[tool .poetry .group .dev .dependencies ]
16- pytest = " ^7.1.2"
1715pre-commit = " ^2.19.0"
16+ pytest = " ^7.1.2"
17+ pytest-cov = " >=2.6.1"
1818
1919
2020[tool .black ]
2121line-length = 79
2222
2323
24+ [tool .mypy ]
25+ ignore_missing_imports = true
26+
27+
2428[tool .ruff ]
2529line-length = 79
2630
27-
2831[tool .ruff .lint ]
2932ignore-init-module-imports = true
3033select = [
@@ -36,8 +39,9 @@ case-sensitive = true
3639known-first-party = [" fjsplib" , " tests" ]
3740
3841
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"
4145
4246
4347[build-system ]
You can’t perform that action at this time.
0 commit comments