Skip to content

Commit 75faa5e

Browse files
authored
Merge pull request #421 from facultyai/github-actions
GitHub Actions
2 parents 060499a + 7aa4d29 commit 75faa5e

File tree

8 files changed

+151
-34
lines changed

8 files changed

+151
-34
lines changed

.github/workflows/ci.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: CI
2+
3+
on: [push]
4+
5+
jobs:
6+
js:
7+
name: Lint and test JavaScript
8+
runs-on: 'ubuntu-latest'
9+
steps:
10+
- uses: actions/checkout@v1
11+
- name: Use Node.js 12
12+
uses: actions/setup-node@v1
13+
with:
14+
node-version: 12.x
15+
- name: Install dependencies
16+
run: npm ci
17+
- name: Lint source
18+
run: npm run lint
19+
- uses: actions/checkout@v1
20+
- name: Use Node.js 12
21+
uses: actions/setup-node@v1
22+
with:
23+
node-version: 12.x
24+
- name: Install dependencies
25+
run: npm ci
26+
- name: Run tests
27+
run: npm run test
28+
- name: Run demo test
29+
run: npm run test:demo
30+
build:
31+
name: Build package
32+
runs-on: 'ubuntu-latest'
33+
steps:
34+
- uses: actions/checkout@v1
35+
- name: Use Node.js 12
36+
uses: actions/setup-node@v1
37+
with:
38+
node-version: 12.x
39+
- name: Install dependencies
40+
run: npm ci
41+
- name: Set up Python 3.8
42+
uses: actions/setup-python@v1
43+
with:
44+
python-version: 3.8
45+
- name: Install Dash
46+
run: pip install dash[dev]
47+
- name: Build dash-bootstrap-components
48+
run: npm run build
49+
- name: Upload generated files
50+
uses: actions/upload-artifact@v2
51+
with:
52+
name: dash-bootstrap-components
53+
path: dash_bootstrap_components/_components
54+
python:
55+
name: Lint and test Python package
56+
needs: build
57+
runs-on: 'ubuntu-latest'
58+
strategy:
59+
max-parallel: 4
60+
matrix:
61+
python-version: [2.7, 3.5, 3.6, 3.7, 3.8]
62+
services:
63+
hub:
64+
image: selenium/hub:3.141.59-gold
65+
firefox:
66+
image: selenium/node-chrome:3.141.59-gold
67+
env:
68+
HUB_HOST: hub
69+
HUB_PORT: 4444
70+
71+
steps:
72+
- uses: actions/checkout@v1
73+
- name: Set up Python 3.8
74+
uses: actions/setup-python@v1
75+
with:
76+
python-version: 3.8
77+
- name: Set up Python ${{ matrix.python-version }}
78+
if: matrix.python-version != '3.8'
79+
uses: actions/setup-python@v1
80+
with:
81+
python-version: ${{ matrix.python-version }}
82+
- name: Install nox
83+
run: python3.8 -m pip install -U nox
84+
- name: Lint Python source
85+
if: matrix.python-version == 3.8
86+
run: nox -s lint
87+
- uses: actions/download-artifact@v2
88+
with:
89+
name: dash-bootstrap-components
90+
path: dash_bootstrap_components/_components
91+
- name: Test Python module
92+
run: nox -s test-${{ matrix.python-version }}

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
node_modules
33
lib
44

5-
# sass
6-
.sass-cache
5+
# testing
6+
.nox
7+
.pytest_cache
78

89
# dash-bootstrap-components artifacts
910
dash_bootstrap_components/bundle.js

.travis.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

noxfile.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import nox
2+
3+
SOURCES = [
4+
"dash_bootstrap_components",
5+
"docs",
6+
"examples",
7+
"noxfile.py",
8+
"setup.py",
9+
"tasks.py",
10+
]
11+
12+
13+
@nox.session()
14+
def lint(session):
15+
session.install("black", "flake8", "isort")
16+
session.run("black", "--check", *SOURCES)
17+
session.run("flake8", *SOURCES)
18+
session.run("isort", "--check", *SOURCES)
19+
20+
21+
@nox.session(python=["2.7", "3.5", "3.6", "3.7", "3.8"])
22+
def test(session):
23+
session.install("pytest")
24+
session.install("dash[testing]")
25+
session.install(".")
26+
session.run("pytest", "--headless")

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ ignore = E203, W503
4242
[isort]
4343
multi_line_output = 3
4444
include_trailing_comma = true
45+
known_first_party = components_page, examples, markdown_to_html, server
4546
known_third_party =
4647
dash,
4748
dash_bootstrap_components,

tasks.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
VERSION_TEMPLATE = """__version__ = "{version_string}"
1313
"""
1414

15+
TEST_VERSION_TEMPLATE = """from dash_bootstrap_components import __version__
16+
17+
18+
def test_version():
19+
assert __version__ == "{version_string}"
20+
"""
21+
1522
RELEASE_NOTES_TEMPLATE = """# Write the release notes here
1623
# Delete the version title to cancel
1724
Version {version_string}
@@ -180,6 +187,10 @@ def set_pyversion(version):
180187
with version_path.open("w") as f:
181188
f.write(VERSION_TEMPLATE.format(version_string=version))
182189

190+
test_version_path = HERE / "tests" / "test_version.py"
191+
with test_version_path.open("w") as f:
192+
f.write(TEST_VERSION_TEMPLATE.format(version_string=version))
193+
183194

184195
def set_jsversion(version):
185196
version = normalize_version(version)

tests/test_alert.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from dash import Dash
2+
from dash_bootstrap_components import Alert
3+
from dash_html_components import Div
4+
5+
6+
def test_gene001_simple_callback(dash_duo):
7+
app = Dash()
8+
9+
app.layout = Div([Alert("Test content", id="alert")])
10+
11+
dash_duo.start_server(app)
12+
13+
assert dash_duo.wait_for_element("#alert").text == "Test content"

tests/test_version.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from dash_bootstrap_components import __version__
2+
3+
4+
def test_version():
5+
assert __version__ == "0.10.4-dev"

0 commit comments

Comments
 (0)