Skip to content

Commit fd912d3

Browse files
authored
Merge pull request #12 from lias-laboratory/patch-workflow
patches workflow for building only on main pushes
2 parents 4d97c46 + 777d934 commit fd912d3

File tree

5 files changed

+75
-6
lines changed

5 files changed

+75
-6
lines changed

.github/workflows/build_wheels.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ name: Build and upload to PyPI
22

33
on:
44
workflow_dispatch:
5-
pull_request:
6-
branches:
7-
- main
85
push:
96
branches:
107
- main
@@ -17,7 +14,7 @@ jobs:
1714
name: Build wheels on ${{ matrix.os }}
1815
runs-on: ${{ matrix.os }}
1916
strategy:
20-
#fail-fast: false #commented until windows support is added
17+
fail-fast: false
2118
matrix:
2219
# macos-13 is an intel runner, macos-14 is apple silicon
2320
os: [ubuntu-latest, windows-latest, macos-13, macos-14]

.github/workflows/pr_build.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: PR Build and Test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
run_pytest:
11+
name: Run pytest
12+
uses: ./.github/workflows/tests.yml
13+
14+
build_test_wheels:
15+
name: Test build on Ubuntu
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Build wheels
21+
uses: pypa/[email protected]
22+
with:
23+
package-dir: .
24+
output-dir: ./wheelhouse
25+
config-file: "{package}/pyproject.toml"
26+
27+
- name: Test import
28+
run: |
29+
pip install ./wheelhouse/*.whl
30+
python -c "import radius_clustering; print(f'Successfully imported version {radius_clustering.__version__}')"
31+
32+
build_test_sdist:
33+
name: Test source distribution
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- name: Build sdist
39+
run: pipx run build --sdist
40+
41+
- name: Test sdist
42+
run: |
43+
pip install ./dist/*.tar.gz
44+
python -c "import radius_clustering; print(f'Successfully imported version {radius_clustering.__version__}')"

.github/workflows/tests.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Run Tests
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
jobs:
8+
pytest:
9+
name: Run pytest
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Set up Python
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: '3.10'
18+
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
python -m pip install pytest
23+
python -m pip install -e .
24+
25+
- name: Run tests with pytest
26+
run: |
27+
pytest -v

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "radius-clustering"
7-
version = "1.1.0"
7+
dynamic = ["version"]
88
description = "A Clustering under radius constraints algorithm using minimum dominating sets"
99
readme = "README.md"
1010
authors = [
@@ -80,6 +80,7 @@ doc = [
8080

8181
[tool.setuptools]
8282
packages.find = {where = ["src"], include = ["radius_clustering", "radius_clustering.*"]}
83+
version = {attr = "radius_clustering.__version__"}
8384

8485
[tool.pytest.ini_options]
8586
pythonpath = "src"

src/radius_clustering/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
__all__ = ["RadiusClustering"]
55

66
# Optionally, you can set a version number for your package
7-
__version__ = "1.0.0"
7+
__version__ = "1.2.0"

0 commit comments

Comments
 (0)