Skip to content

Commit 14bfce8

Browse files
authored
Merge pull request #445 from facultyai/flit
Updated CI/CD + package with flit
2 parents b379967 + f97a96f commit 14bfce8

File tree

12 files changed

+289
-221
lines changed

12 files changed

+289
-221
lines changed

.github/actions/push_docs/action.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Push Docs
2+
description: Push Docs to Heroku
3+
inputs:
4+
heroku-api-token:
5+
description: API token for Heroku
6+
required: true
7+
heroku-app-name:
8+
description: App name
9+
required: true
10+
commit_user_name:
11+
description: Name used for the commit user
12+
required: false
13+
default: GitHub Actions
14+
commit_user_email:
15+
description: Email address used for the commit user
16+
required: false
17+
default: actions@github.com
18+
runs:
19+
using: "composite"
20+
steps:
21+
- run: |
22+
git checkout -b inv-push-docs
23+
git add docs/examples/vendor/*.py -f
24+
git -c user.name="${{ inputs.commit_user_name }}" -c user.email="${{ inputs.commit_user_email }}" commit -m "Add examples" --allow-empty
25+
git subtree split --prefix docs -b inv-push-docs-subtree
26+
git push -f https://heroku:${{ inputs.heroku-api-token }}@git.heroku.com/${{ inputs.heroku-app-name }}.git inv-push-docs-subtree:master
27+
git checkout master
28+
git branch -D inv-push-docs inv-push-docs-subtree
29+
shell: bash

.github/workflows/build-docs.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Build docs
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- docs/**
9+
- examples/**
10+
11+
jobs:
12+
build_docs:
13+
name: Build and release documentation
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Set up Python 3.8
18+
uses: actions/setup-python@v1
19+
with:
20+
python-version: 3.8
21+
- name: Install Python dependencies
22+
run: python -m pip install invoke semver termcolor
23+
- name: Copy examples to docs/
24+
run: invoke copy-examples
25+
- uses: ./.github/actions/push_docs
26+
with:
27+
heroku-api-token: ${{ secrets.HEROKU_API_TOKEN }}
28+
heroku-app-name: ${{ secrets.HEROKU_APP_NAME }}

.github/workflows/release.yml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: Publish release
2+
3+
on:
4+
pull_request:
5+
types:
6+
- closed
7+
8+
jobs:
9+
release:
10+
name: Release
11+
if: ${{ github.event.pull_request.merged && startsWith(github.head_ref, 'release/') }}
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
with:
16+
token: ${{ secrets.GH_ACCESS_TOKEN_TOM }}
17+
- id: get-version
18+
run: echo "::set-output name=version::$(echo ${{ github.head_ref }} | sed 's|release/||')"
19+
- name: Use Node.js 12
20+
uses: actions/setup-node@v1
21+
with:
22+
node-version: 12.x
23+
- name: Install dependencies
24+
run: npm install
25+
- name: Set up Python 3.8
26+
uses: actions/setup-python@v1
27+
with:
28+
python-version: 3.8
29+
- name: Install Python dependencies
30+
run: python -m pip install dash[dev] flit invoke semver termcolor
31+
- name: Publish release to npm
32+
run: npm publish
33+
env:
34+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
35+
- name: Publish release to PyPI
36+
run: flit publish
37+
env:
38+
FLIT_USERNAME: ${{ secrets.FLIT_USERNAME }}
39+
FLIT_PASSWORD: ${{ secrets.FLIT_PASSWORD }}
40+
- name: Commit updated package-lock.json
41+
uses: stefanzweifel/git-auto-commit-action@v4
42+
with:
43+
commit_message: Release ${{ steps.get-version.outputs.version }}
44+
branch: master
45+
push_options: --force
46+
file_pattern: package-lock.json
47+
- name: Create GitHub release
48+
id: create-release
49+
uses: actions/create-release@v1
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
with:
53+
tag_name: ${{ steps.get-version.outputs.version }}
54+
release_name: Release ${{ steps.get-version.outputs.version }}
55+
body: ${{ github.event.pull_request.body }}
56+
prerelease: false
57+
- name: Post-release cleanup
58+
run: invoke postrelease ${{ steps.get-version.outputs.version }}
59+
- uses: stefanzweifel/git-auto-commit-action@v4
60+
with:
61+
commit_message: Back to dev
62+
branch: master
63+
push_options: --force
64+
file_pattern: package.json tests/test_version.py dash_bootstrap_components/__init__.py
65+
66+
prerelease:
67+
name: Prerelease
68+
if: ${{ github.event.pull_request.merged && startsWith(github.head_ref, 'prerelease/') }}
69+
runs-on: ubuntu-latest
70+
steps:
71+
- uses: actions/checkout@v2
72+
with:
73+
token: ${{ secrets.GH_ACCESS_TOKEN_TOM }}
74+
- id: get-version
75+
run: echo "::set-output name=version::$(echo ${{ github.head_ref }} | sed 's|prerelease/||')"
76+
- name: Use Node.js 12
77+
uses: actions/setup-node@v1
78+
with:
79+
node-version: 12.x
80+
- name: Install dependencies
81+
run: npm install
82+
- name: Set up Python 3.8
83+
uses: actions/setup-python@v1
84+
with:
85+
python-version: 3.8
86+
- name: Install Python dependencies
87+
run: python -m pip install dash[dev] flit invoke semver termcolor
88+
- name: Publish prerelease to npm
89+
run: npm publish
90+
env:
91+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
92+
- name: Publish prerelease to PyPI
93+
run: flit publish
94+
env:
95+
FLIT_USERNAME: ${{ secrets.FLIT_USERNAME }}
96+
FLIT_PASSWORD: ${{ secrets.FLIT_PASSWORD }}
97+
- name: Commit updated package-lock.json
98+
uses: stefanzweifel/git-auto-commit-action@v4
99+
with:
100+
commit_message: Release ${{ steps.get-version.outputs.version }}
101+
branch: master
102+
push_options: --force
103+
file_pattern: package-lock.json
104+
- name: Create GitHub prerelease
105+
id: create-prerelease
106+
uses: actions/create-release@v1
107+
env:
108+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
109+
with:
110+
tag_name: ${{ steps.get-version.outputs.version }}
111+
release_name: Prerelease ${{ steps.get-version.outputs.version }}
112+
body: ${{ github.event.pull_request.body }}
113+
prerelease: true
114+
- name: Post-release cleanup
115+
run: invoke postrelease ${{ steps.get-version.outputs.version }}
116+
- uses: stefanzweifel/git-auto-commit-action@v4
117+
with:
118+
commit_message: Back to dev
119+
branch: master
120+
push_options: --force
121+
file_pattern: package.json tests/test_version.py dash_bootstrap_components/__init__.py

.github/workflows/ci.yml renamed to .github/workflows/tests.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: Tests
22

33
on: [push]
44

@@ -16,13 +16,6 @@ jobs:
1616
run: npm ci
1717
- name: Lint source
1818
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
2619
- name: Run tests
2720
run: npm run test
2821
- name: Run demo test
@@ -43,7 +36,7 @@ jobs:
4336
with:
4437
python-version: 3.8
4538
- name: Install Dash
46-
run: pip install dash[dev]
39+
run: python -m pip install dash[dev]
4740
- name: Build dash-bootstrap-components
4841
run: npm run build
4942
- name: Upload generated files
@@ -67,7 +60,6 @@ jobs:
6760
env:
6861
HUB_HOST: hub
6962
HUB_PORT: 4444
70-
7163
steps:
7264
- uses: actions/checkout@v1
7365
- name: Set up Python 3.8

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<a href="https://github.com/facultyai/dash-bootstrap-components/issues/new?template=feature.md">Request a feature</a>
1717
<br>
1818
<br>
19-
<img alt="GitHub Actions" src="https://github.com/facultyai/dash-bootstrap-components/workflows/CI/badge.svg?branch=master">
19+
<img alt="GitHub Actions" src="https://github.com/facultyai/dash-bootstrap-components/workflows/Tests/badge.svg?branch=master">
2020
<img alt="GitHub" src="https://img.shields.io/github/license/facultyai/dash-bootstrap-components">
2121
<img alt="PyPI" src="https://img.shields.io/pypi/v/dash-bootstrap-components">
2222
<img alt="Conda (channel only)" src="https://img.shields.io/conda/vn/conda-forge/dash-bootstrap-components">

dash_bootstrap_components/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
"""Bootstrap themed components for use in Plotly Dash"""
12
import os
23
import sys
34

45
from . import themes # noqa
56
from . import _components
67
from ._components import * # noqa
78
from ._table import _generate_table_from_df
8-
from ._version import __version__ # noqa
99

10+
__version__ = "0.10.6-dev"
1011
_current_path = os.path.dirname(os.path.abspath(__file__))
1112

1213
METADATA_PATH = os.path.join(_current_path, "_components", "metadata.json")

dash_bootstrap_components/_version.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

landing-page.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<a href="https://github.com/facultyai/dash-bootstrap-components/issues/new?template=feature.md">Request a feature</a>
1515
<br>
1616
<br>
17-
<img alt="GitHub Actions" src="https://github.com/facultyai/dash-bootstrap-components/workflows/CI/badge.svg?branch=master">
17+
<img alt="GitHub Actions" src="https://github.com/facultyai/dash-bootstrap-components/workflows/Tests/badge.svg?branch=master">
1818
<img alt="GitHub" src="https://img.shields.io/github/license/facultyai/dash-bootstrap-components">
1919
<img alt="PyPI" src="https://img.shields.io/pypi/v/dash-bootstrap-components">
2020
<img alt="Conda (channel only)" src="https://img.shields.io/conda/vn/conda-forge/dash-bootstrap-components">

noxfile.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"docs",
66
"examples",
77
"noxfile.py",
8-
"setup.py",
98
"tasks.py",
109
]
1110

pyproject.toml

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,61 @@
1+
[build-system]
2+
requires = ["flit_core >=2,<4"]
3+
build-backend = "flit_core.buildapi"
4+
5+
[tool.flit.metadata]
6+
dist-name = "dash-bootstrap-components"
7+
module = "dash_bootstrap_components"
8+
author = "Faculty"
9+
author-email = "opensource@faculty.ai"
10+
home-page = "https://dash-bootstrap-components.opensource.faculty.ai"
11+
classifiers = [
12+
"Framework :: Dash",
13+
"License :: OSI Approved :: Apache Software License",
14+
"Programming Language :: Python :: 2.7",
15+
"Programming Language :: Python :: 3.5",
16+
"Programming Language :: Python :: 3.6",
17+
"Programming Language :: Python :: 3.7",
18+
"Programming Language :: Python :: 3.8"
19+
]
20+
requires = ["dash>=1.9.0"]
21+
description-file = "landing-page.md"
22+
requires-python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4"
23+
24+
[tool.flit.metadata.requires-extra]
25+
pandas = ["numpy", "pandas"]
26+
27+
[tool.flit.metadata.urls]
28+
Source = "https://github.com/facultyai/dash-bootstrap-components/"
29+
"Bug Reports" = "https://github.com/facultyai/dash-bootstrap-components/issues"
30+
31+
[tool.flit.sdist]
32+
include = [
33+
"dash_bootstrap_components/_components/*.py",
34+
"dash_bootstrap_components/_components/*.js",
35+
"dash_bootstrap_components/_components/*.json"
36+
]
37+
exclude = [
38+
".github",
39+
"demo",
40+
"docs",
41+
"examples",
42+
"R",
43+
"readme-images",
44+
"src",
45+
"tests",
46+
"webpack",
47+
".babelrc",
48+
".gitignore",
49+
".prettierrc",
50+
".Rbuildignore",
51+
"gulpfile.js",
52+
"jest.config.js",
53+
"noxfile.py",
54+
"package.json",
55+
"package-lock.json",
56+
"tasks.py"
57+
]
58+
159
[tool.black]
260
line-length = 79
361
exclude = "dash_bootstrap_components/_components|node_modules"
4-
5-
[build-system]
6-
requires = ["setuptools >= 40.8.0", "wheel"]
7-
build-backend = "setuptools.build_meta"

0 commit comments

Comments
 (0)