Skip to content

Commit 8c380e6

Browse files
authored
Merge pull request #116 from automl/better-action-workflow
ci: Test against 3.9, 3.10 and 3.11
2 parents a835f52 + f02d3ea commit 8c380e6

File tree

4 files changed

+73
-40
lines changed

4 files changed

+73
-40
lines changed

.github/workflows/docs.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: docs
22

3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
5+
cancel-in-progress: true
6+
37
on:
48
# Trigger manually
59
workflow_dispatch:
@@ -22,19 +26,22 @@ env:
2226
jobs:
2327
build-and-deploy:
2428
runs-on: ubuntu-latest
29+
defaults:
30+
run:
31+
shell: bash # Default to using bash on all
2532
steps:
2633
- name: Checkout
27-
uses: actions/checkout@v2
34+
uses: actions/checkout@v4
2835

2936
- name: Setup Python
30-
uses: actions/setup-python@v2
37+
uses: actions/setup-python@v5
3138
with:
3239
python-version: 3.9
3340

3441
- name: Install dependencies
3542
run: |
3643
pip install .
37-
pip install .[dev]
44+
pip install ".[dev]"
3845
3946
- name: Make docs
4047
run: |

.github/workflows/pytest.yml

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,50 @@
11
name: tests
2-
on: [ push ]
2+
3+
# Cancel previous tests for this branch if a new commit is pushed
4+
concurrency:
5+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
6+
cancel-in-progress: true
7+
8+
on:
9+
# Allow manual trigger of workflow
10+
workflow_dispatch:
11+
12+
# Run tests on push/merge to main
13+
push:
14+
branches:
15+
- main
16+
17+
# Run tests on anything that has a pull request to main/development
18+
pull_request:
19+
branches:
20+
- main
21+
- development
22+
323
jobs:
424
pytest:
5-
name: PyTest
6-
runs-on: ubuntu-latest
7-
steps:
8-
- uses: actions/checkout@v2
9-
- name: Add conda to system path
10-
run: |
11-
# $CONDA is an environment variable pointing to the root of the miniconda directory
12-
echo $CONDA/bin >> $GITHUB_PATH
25+
name: Test ${{ matrix.python-version }}-${{ matrix.os }}
26+
runs-on: ${{ matrix.os }}
27+
defaults:
28+
run:
29+
shell: bash # Default to using bash on all
30+
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
python-version: ["3.9", "3.10"] # "3.11" fails due to swig
35+
os: ["ubuntu-latest"] # "macos-latest", "windows-latest" fails due to swig
1336

37+
steps:
38+
- uses: actions/checkout@v4
1439
- name: Setup Python 3.9
15-
uses: actions/setup-python@v2
40+
uses: actions/setup-python@v5
1641
with:
17-
python-version: 3.9
42+
python-version: ${{ matrix.python-version }}
1843

1944
- name: Install dependencies
2045
run: |
21-
conda install -c anaconda swig
22-
make install-dev
23-
24-
- name: Run pytest
46+
pip install swig
47+
python -m pip install ".[dev]"
48+
49+
- name: Run pytest
2550
run: pytest tests

pyproject.toml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,53 +3,53 @@
33

44
[tool.pytest.ini_options]
55
testpaths = ["tests"] # path to the test directory
6-
minversion = "3.8"
6+
minversion = "3.9"
77
addopts = "--cov=deepcave" # Should be package name
88

99
[tool.coverage.run]
1010
branch = true
1111
context = "deepcave" # Should be package name
1212
omit = [
13-
"deepcave/__init__.py", # Has variables only needed for setup.py
13+
"deepcave/__init__.py", # Has variables only needed for setup.py
1414
]
1515

1616
[tool.coverage.report]
1717
show_missing = true
1818
skip_covered = true
1919
exclude_lines = [
20-
"pragma: no cover",
21-
'\.\.\.',
22-
"raise NotImplementedError",
23-
"if TYPE_CHECKING",
20+
"pragma: no cover",
21+
'\.\.\.',
22+
"raise NotImplementedError",
23+
"if TYPE_CHECKING",
2424
] # These are lines to exclude from coverage
2525

2626
[tool.black]
27-
target-version = ['py38']
27+
target-version = ['py39']
2828
line-length = 100
2929

3030
[tool.isort]
31-
py_version = "38"
31+
py_version = "39"
3232
profile = "black" # Play nicely with black
3333
src_paths = ["deepcave", "tests"]
3434
known_types = ["typing", "abc"] # We put these in their own section "types"
3535
known_test = ["tests"]
3636
known_first_party = ["deepcave"]
3737
sections = [
38-
"FUTURE",
39-
"TYPES",
40-
"STDLIB",
41-
"THIRDPARTY",
42-
"FIRSTPARTY",
43-
"TEST",
44-
"LOCALFOLDER",
38+
"FUTURE",
39+
"TYPES",
40+
"STDLIB",
41+
"THIRDPARTY",
42+
"FIRSTPARTY",
43+
"TEST",
44+
"LOCALFOLDER",
4545
] # section ordering
4646
multi_line_output = 3 # https://pycqa.github.io/isort/docs/configuration/multi_line_output_modes.html
4747

4848
[tool.pydocstyle]
4949
convention = "numpy"
5050
add-ignore = [ # http://www.pydocstyle.org/en/stable/error_codes.html
51-
"D105", # Missing docstring in magic method
52-
"D212", # Multi-line docstring summary should start at the first line
51+
"D105", # Missing docstring in magic method
52+
"D212", # Multi-line docstring summary should start at the first line
5353
]
5454

5555
[tool.mypy]
@@ -68,5 +68,5 @@ module = ["setuptools.*"] # Add modules that give import errors here
6868
ignore_missing_imports = true
6969

7070
[[tool.mypy.overrides]]
71-
module = ["tests.*"] # pytest uses decorators which are not typed in 3.8
71+
module = ["tests.*"] # pytest uses decorators which are not typed in 3.9
7272
disallow_untyped_decorators = false # decorators in testing are not all annotated

setup.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# -*- encoding: utf-8 -*-
1+
from __future__ import annotations
2+
23
import setuptools
34
from deepcave import version
45

56

67
def read_file(file_name):
78
with open(file_name, encoding="utf-8") as fh:
8-
text = fh.read()
9-
return text
9+
return fh.read()
1010

1111

1212
extras_require = {
@@ -50,7 +50,7 @@ def read_file(file_name):
5050
exclude=["*.tests", "*.tests.*", "tests.*", "tests"],
5151
),
5252
include_package_data=True,
53-
python_requires=">=3.9, <3.10",
53+
python_requires=">=3.9, <3.11",
5454
install_requires=read_file("./requirements.txt").split("\n"),
5555
extras_require=extras_require,
5656
entry_points={
@@ -60,6 +60,7 @@ def read_file(file_name):
6060
platforms=["Linux"],
6161
classifiers=[
6262
"Programming Language :: Python :: 3.9",
63+
"Programming Language :: Python :: 3.10",
6364
"Development Status :: 3 - Alpha",
6465
"Natural Language :: English",
6566
"Environment :: Console",

0 commit comments

Comments
 (0)