Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: CI

on: [push]

jobs:
js:
name: Lint and test JavaScript
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v1
- name: Use Node.js 12
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install dependencies
run: npm ci
- name: Lint source
run: npm run lint
- uses: actions/checkout@v1
- name: Use Node.js 12
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm run test
- name: Run demo test
run: npm run test:demo
build:
name: Build package
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v1
- name: Use Node.js 12
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install dependencies
run: npm ci
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install Dash
run: pip install dash[dev]
- name: Build dash-bootstrap-components
run: npm run build
- name: Upload generated files
uses: actions/upload-artifact@v2
with:
name: dash-bootstrap-components
path: dash_bootstrap_components/_components
python:
name: Lint and test Python package
needs: build
runs-on: 'ubuntu-latest'
strategy:
max-parallel: 4
matrix:
python-version: [2.7, 3.5, 3.6, 3.7, 3.8]
services:
hub:
image: selenium/hub:3.141.59-gold
firefox:
image: selenium/node-chrome:3.141.59-gold
env:
HUB_HOST: hub
HUB_PORT: 4444

steps:
- uses: actions/checkout@v1
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Set up Python ${{ matrix.python-version }}
if: matrix.python-version != '3.8'
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install nox
run: python3.8 -m pip install -U nox
- name: Lint Python source
if: matrix.python-version == 3.8
run: nox -s lint
- uses: actions/download-artifact@v2
with:
name: dash-bootstrap-components
path: dash_bootstrap_components/_components
- name: Test Python module
run: nox -s test-${{ matrix.python-version }}
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
node_modules
lib

# sass
.sass-cache
# testing
.nox
.pytest_cache

# dash-bootstrap-components artifacts
dash_bootstrap_components/bundle.js
Expand Down
32 changes: 0 additions & 32 deletions .travis.yml

This file was deleted.

26 changes: 26 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import nox

SOURCES = [
"dash_bootstrap_components",
"docs",
"examples",
"noxfile.py",
"setup.py",
"tasks.py",
]


@nox.session()
def lint(session):
session.install("black", "flake8", "isort")
session.run("black", "--check", *SOURCES)
session.run("flake8", *SOURCES)
session.run("isort", "--check", *SOURCES)


@nox.session(python=["2.7", "3.5", "3.6", "3.7", "3.8"])
def test(session):
session.install("pytest")
session.install("dash[testing]")
session.install(".")
session.run("pytest", "--headless")
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ ignore = E203, W503
[isort]
multi_line_output = 3
include_trailing_comma = true
known_first_party = components_page, examples, markdown_to_html, server
known_third_party =
dash,
dash_bootstrap_components,
Expand Down
11 changes: 11 additions & 0 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
VERSION_TEMPLATE = """__version__ = "{version_string}"
"""

TEST_VERSION_TEMPLATE = """from dash_bootstrap_components import __version__


def test_version():
assert __version__ == "{version_string}"
"""

RELEASE_NOTES_TEMPLATE = """# Write the release notes here
# Delete the version title to cancel
Version {version_string}
Expand Down Expand Up @@ -180,6 +187,10 @@ def set_pyversion(version):
with version_path.open("w") as f:
f.write(VERSION_TEMPLATE.format(version_string=version))

test_version_path = HERE / "tests" / "test_version.py"
with test_version_path.open("w") as f:
f.write(TEST_VERSION_TEMPLATE.format(version_string=version))


def set_jsversion(version):
version = normalize_version(version)
Expand Down
13 changes: 13 additions & 0 deletions tests/test_alert.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from dash import Dash
from dash_bootstrap_components import Alert
from dash_html_components import Div


def test_gene001_simple_callback(dash_duo):
app = Dash()

app.layout = Div([Alert("Test content", id="alert")])

dash_duo.start_server(app)

assert dash_duo.wait_for_element("#alert").text == "Test content"
5 changes: 5 additions & 0 deletions tests/test_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from dash_bootstrap_components import __version__


def test_version():
assert __version__ == "0.10.4-dev"