Skip to content

Commit 731cfe3

Browse files
author
Jelmer Bot
committed
add github actions
1 parent d1eff71 commit 731cfe3

File tree

7 files changed

+236
-4
lines changed

7 files changed

+236
-4
lines changed

.github/workflows/Docs.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Documentation
2+
concurrency:
3+
group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }}
4+
cancel-in-progress: true
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
jobs:
13+
pages:
14+
runs-on: ubuntu-20.04
15+
environment:
16+
name: github-pages
17+
url: ${{ steps.deployment.outputs.page_url }}
18+
permissions:
19+
pages: write
20+
id-token: write
21+
steps:
22+
- id: deployment
23+
uses: sphinx-notes/pages@v3
24+
with:
25+
cache: True
26+
documentation_path: ./doc
27+
requirements_path: ./doc/requirements.txt

.github/workflows/Publish.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Publish Python Package
2+
concurrency:
3+
group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }}
4+
cancel-in-progress: true
5+
6+
on:
7+
push:
8+
tags:
9+
- v*
10+
workflow_dispatch:
11+
12+
jobs:
13+
publish_pypi:
14+
name: Publish to PyPi
15+
runs-on: ubuntu-20.04
16+
permissions:
17+
# IMPORTANT: this permission is mandatory for trusted publishing
18+
id-token: write
19+
environment:
20+
name: pypi
21+
url: https://pypi.org/p/multi_mst
22+
steps:
23+
- name: Setup Python
24+
uses: actions/setup-python@v4
25+
with:
26+
python-version: 3.9
27+
28+
- name: Install dependencies
29+
run: |
30+
pip install -U wheelhouse_uploader pyyaml
31+
32+
- name: Download wheels and sdist
33+
uses: dawidd6/[email protected]
34+
with:
35+
github_token: ${{ secrets.PUSH_TOKEN }}
36+
workflow: Wheels.yml
37+
workflow_conclusion: success
38+
branch: main
39+
path: .
40+
41+
- name: Move files to dist
42+
run: |
43+
mkdir dist
44+
mv sdist/* dist/
45+
mv wheels/* dist/
46+
47+
- name: Publish package to (Test)PyPI
48+
uses: pypa/[email protected]
49+
# Comment lines below to publish to PyPi instead of test PyPi
50+
# with:
51+
# repository-url: https://test.pypi.org/legacy/

.github/workflows/Tests.yml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: Tests
2+
concurrency:
3+
group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }}
4+
cancel-in-progress: true
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
pull_request:
11+
branches:
12+
- main
13+
workflow_dispatch:
14+
15+
jobs:
16+
build_sdist:
17+
name: Build sdist
18+
runs-on: ubuntu-20.04
19+
outputs:
20+
SDIST_NAME: ${{ steps.sdist.outputs.SDIST_NAME }}
21+
steps:
22+
- uses: actions/checkout@v3
23+
with:
24+
fetch-depth: 0
25+
26+
- uses: actions/setup-python@v4
27+
name: Install python
28+
with:
29+
python-version: 3.9
30+
cache: 'pip'
31+
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install -r requirements.txt
36+
pip install twine flake8
37+
38+
- name: Lint with flake8
39+
run: |
40+
# stop the build if there are Python syntax errors or undefined names
41+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
42+
43+
- name: Build sdist
44+
id: sdist
45+
run: |
46+
python setup.py sdist
47+
python ci/export_sdist_name.py
48+
49+
- name: Check README rendering for PyPI
50+
run: twine check dist/*
51+
52+
- name: Upload sdist result
53+
uses: actions/upload-artifact@v3
54+
with:
55+
name: sdist
56+
path: dist/*.tar.gz
57+
if-no-files-found: error
58+
59+
build_wheels:
60+
name: Build wheel for cp${{ matrix.python }}-${{ matrix.platform_id }}-${{ matrix.manylinux_image }}
61+
needs: build_sdist
62+
runs-on: ${{ matrix.os }}
63+
strategy:
64+
fail-fast: false
65+
matrix:
66+
include:
67+
- os: windows-latest
68+
python: 39
69+
platform_id: win_amd64
70+
- os: windows-latest
71+
python: 310
72+
platform_id: win_amd64
73+
- os: windows-latest
74+
python: 311
75+
platform_id: win_amd64
76+
77+
# Linux 64 bit manylinux2014
78+
- os: ubuntu-latest
79+
python: 39
80+
platform_id: manylinux_x86_64
81+
manylinux_image: manylinux2014
82+
- os: ubuntu-latest
83+
python: 310
84+
platform_id: manylinux_x86_64
85+
manylinux_image: manylinux2014
86+
- os: ubuntu-latest
87+
python: 311
88+
platform_id: manylinux_x86_64
89+
manylinux_image: manylinux2014
90+
91+
# MacOS x86_64
92+
- os: macos-latest
93+
python: 39
94+
platform_id: macosx_x86_64
95+
- os: macos-latest
96+
python: 310
97+
platform_id: macosx_x86_64
98+
- os: macos-latest
99+
python: 311
100+
platform_id: macosx_x86_64
101+
steps:
102+
- name: Download sdist
103+
uses: actions/download-artifact@v3
104+
with:
105+
name: sdist
106+
path: dist/
107+
108+
- name: Setup Python
109+
uses: actions/setup-python@v4
110+
with:
111+
python-version: '3.9' # update once build dependencies are available
112+
113+
- name: Build and Test wheels
114+
uses: pypa/cibuildwheel@51f5c7fe68ff24694d5a6ac0eb3ad476ddd062a8 # v2.13.0
115+
with:
116+
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
117+
env:
118+
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }}
119+
CIBW_ARCHS: all
120+
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }}
121+
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_image }}
122+
CIBW_TEST_REQUIRES: pytest matplotlib pandas networkx
123+
CIBW_TEST_COMMAND: pytest {package}/tests
124+
CIBW_BUILD_VERBOSITY: 1
125+
126+
- name: Store artifacts
127+
uses: actions/upload-artifact@v3
128+
with:
129+
name: wheels
130+
path: wheelhouse/*.whl
131+
if-no-files-found: ignore
132+
133+

MANIFEST.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ include pyproject.toml
33
include LICENSE
44
include MANIFEST.in
55
include requirements.txt
6-
recursive-include docs *
7-
recursive-exclude docs/_build *
6+
recursive-include doc *
7+
recursive-exclude doc/_build *
88
recursive-include notebooks *.ipynb *.py
99
recursive-include notebooks/data *
1010
recursive-exclude notebooks/data/generated *
11-
recursive-exclude notebooks/.ipynb_checkpoints *
11+
recursive-exclude notebooks/**/.ipynb_checkpoints *
1212
recursive-exclude notebooks/images *

ci/export_sdist_name.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env python3
2+
3+
"""
4+
Determine the name of the sdist and export to GitHub output named SDIST_NAME.
5+
6+
To run:
7+
$ python3 -m build --sdist
8+
$ ./ci/determine_sdist_name.py
9+
"""
10+
import os
11+
from pathlib import Path
12+
import sys
13+
14+
15+
paths = [p.name for p in Path("dist").glob("*.tar.gz")]
16+
if len(paths) != 1:
17+
sys.exit(f"Only a single sdist is supported, but found: {paths}")
18+
19+
print(paths[0])
20+
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
21+
f.write(f"SDIST_NAME={paths[0]}\n")

doc/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ jupyterlab_pygments>=0.1.1
66
ipykernel
77
nbsphinx
88
numpydoc
9+
sphinx_rtd_theme

multi_mst/k_mst/k_mst.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ def fit(self, X, y=None, **fit_params):
172172
clean_data = X
173173

174174
kwargs = self.get_params()
175-
print(kwargs, self.umap_kwargs)
176175
self.mst_indices_, self.mst_distances_, self._umap = kMST(
177176
clean_data, umap_kwargs=self.umap_kwargs, **kwargs
178177
)

0 commit comments

Comments
 (0)