Skip to content

Commit 5b697b5

Browse files
committed
fix(CI): initial CI with semantic-release
This also fixes any pre-commit issues. Signed-off-by: Patrick Avery <[email protected]>
1 parent 5054cb9 commit 5b697b5

File tree

9 files changed

+147
-3
lines changed

9 files changed

+147
-3
lines changed

.codespellrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[codespell]
2+
skip = **/package-lock.json

.flake8

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[flake8]
2+
3+
# Just assume black did a good job with the line lengths
4+
ignore =
5+
E501
6+
7+
per-file-ignores =
8+
# These directories will always contain "from ... import *"
9+
trame/*:F401,F403
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: Test and Release
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
pre-commit:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- uses: actions/setup-python@v2
16+
with:
17+
python-version: "3.9"
18+
19+
# Install and run pre-commit
20+
- run: |
21+
pip install pre-commit
22+
pre-commit install
23+
pre-commit run --all-files
24+
25+
pytest:
26+
name: Pytest ${{ matrix.config.name }}
27+
runs-on: ${{ matrix.config.os }}
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
python-version: [3.9]
32+
config:
33+
- {
34+
name: "Linux",
35+
os: ubuntu-latest
36+
}
37+
- {
38+
name: "MacOSX",
39+
os: macos-latest
40+
}
41+
- {
42+
name: "Windows",
43+
os: windows-latest
44+
}
45+
46+
defaults:
47+
run:
48+
shell: bash
49+
50+
steps:
51+
- name: Checkout
52+
uses: actions/checkout@v2
53+
54+
- name: Set up Python ${{ matrix.python-version }}
55+
uses: actions/setup-python@v2
56+
with:
57+
python-version: ${{ matrix.python-version }}
58+
59+
- name: Install and Run Tests
60+
run: |
61+
pip install .
62+
pip install -r tests/requirements.txt
63+
pytest -s ./tests
64+
65+
test-npm-build:
66+
runs-on: ubuntu-latest
67+
68+
steps:
69+
- name: Checkout
70+
uses: actions/checkout@v2
71+
72+
- name: Set Up Node
73+
uses: actions/setup-node@v3
74+
with:
75+
node-version: 14
76+
77+
- name: Build Vue Components
78+
run: |
79+
cd vue-components
80+
npm ci
81+
npm run build
82+
83+
release:
84+
needs: [pre-commit, pytest, test-npm-build]
85+
runs-on: ubuntu-latest
86+
if: github.event_name == 'push'
87+
88+
steps:
89+
- name: Checkout
90+
uses: actions/checkout@v2
91+
with:
92+
fetch-depth: 0
93+
94+
- name: Set Up Node
95+
uses: actions/setup-node@v3
96+
with:
97+
node-version: 14
98+
99+
- name: Build Vue Components
100+
run: |
101+
cd vue-components
102+
npm ci
103+
npm run build
104+
105+
- name: Python Semantic Release
106+
uses: relekang/[email protected]
107+
with:
108+
github_token: ${{ secrets.GITHUB_TOKEN }}
109+
repository_username: __token__
110+
repository_password: ${{ secrets.PYPI_API_TOKEN }}

.pre-commit-config.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: 22.3.0
4+
hooks:
5+
- id: black
6+
entry: black --check
7+
8+
- repo: https://github.com/codespell-project/codespell
9+
rev: v2.1.0
10+
hooks:
11+
- id: codespell
12+
13+
- repo: https://github.com/PyCQA/flake8
14+
rev: 4.0.1
15+
hooks:
16+
- id: flake8

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ Using the component method
5757
5858
fig, ax = plt.subplots(**figure_size)
5959
60-
widget = matplotlib.Figure(figure=None) # could pass fig at constrution
60+
widget = matplotlib.Figure(figure=None) # could pass fig at construction
6161
widget.update(fig)

setup.cfg

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = trame-matplotlib
3-
version = 2.0.0rc6
3+
version = 2.0.0
44
description = Markdown widget for trame
55
long_description = file: README.rst
66
long_description_content_type = text/x-rst
@@ -28,3 +28,6 @@ packages = find:
2828
include_package_data = True
2929
install_requires =
3030
trame-client
31+
32+
[semantic_release]
33+
version_pattern = setup.cfg:version = (\d+\.\d+\.\d+)

tests/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pytest

tests/test_import.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def test_import():
2+
from trame.widgets.matplotlib import Figure # noqa: F401

trame_matplotlib/widgets/matplotlib.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
try:
66
import mpld3
7-
except:
7+
except ImportError:
88
print(
99
"\nmpld3 is missing, if you want your matplotlib figure to work install it\n $ pip install mpld3\n"
1010
)
@@ -34,6 +34,7 @@ class Figure(AbstractElement):
3434
>>> component2 = Figure()
3535
>>> component2.update(fig1)
3636
"""
37+
3738
_next_id = 0
3839

3940
def __init__(self, figure=None, **kwargs):

0 commit comments

Comments
 (0)