-
Notifications
You must be signed in to change notification settings - Fork 16
134 lines (115 loc) Β· 5.4 KB
/
webviz-core-components.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: webviz-core-components
on:
push:
branches:
- master
pull_request:
branches:
- master
release:
types:
- published
schedule:
# Run CI daily and check that tests are working with latest dependencies
- cron: "0 0 * * *"
jobs:
webviz-core-components:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: π Checkout commit locally
uses: actions/checkout@v3
- name: π Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8 # For compiling the JavaScript part we need dash<2.5, which is not supported on recent versions of Python
- name: βΉοΈ Node and npm versions
run: |
node -v
npm -v
- name: π¦ Install build dependencies
run: |
npm ci --ignore-scripts --prefix ./react
npm run copy-package-json --prefix ./react
pip install "dash<2.5" # Build issue upstream in dash==2.5
pip install .[dependencies]
pip install dash[dev]
- name: βΉοΈ Installed npm packages (depth = 0)
run: npm list --depth=0 --prefix react/
- name: ποΈ Build JavaScript part
run: |
npm run build --prefix ./react
- name: π Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: π¦ Install webviz-core-components with dependencies
run: |
pip install --upgrade pip
pip install .
- name: π¦ Install test dependencies
run: |
pip install .[tests]
pip install dash[testing]
wget https://chromedriver.storage.googleapis.com/$(wget https://chromedriver.storage.googleapis.com/LATEST_RELEASE -q -O -)/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
- name: π§Ύ List all installed packages
run: pip freeze
- name: π΅οΈ Check code style & linting
if: matrix.python-version == '3.8'
run: |
npm run validate --prefix ./react
black --check webviz_core_components tests setup.py usage.py
pylint webviz_core_components/ tests/*.py setup.py usage.py
bandit -r -c ./bandit.yml webviz_core_components tests setup.py usage.py
- name: π€ Run tests
run: |
npm run test --prefix ./react
pytest ./tests --headless
- name: βοΈ Set next as npm publish tag if prerelease
if: github.event.release.prerelease
run: echo "NPM_PUBLISH_TAG=next" >> $GITHUB_ENV
- name: πΌ Build and publish Node.js package
if: github.event_name == 'release' && matrix.python-version == '3.8'
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
working-directory: ./react
run: |
cp ../README.md .
npm version --no-git-tag-version ${GITHUB_REF//refs\/tags\//}
npm config set '//registry.npmjs.org/:_authToken' '${NPM_TOKEN}'
npm config set always-auth true
# Use 'latest' tag if $NPM_PUBLISH_TAG is not set:
npm publish --access public --tag ${NPM_PUBLISH_TAG:-latest}
- name: π’ Build and deploy Python package
if: github.event_name == 'release' && matrix.python-version == '3.8'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypi_webviz_token }}
run: |
export SETUPTOOLS_SCM_PRETEND_VERSION=${GITHUB_REF//refs\/tags\//}
python -m pip install --upgrade setuptools wheel twine
python setup.py sdist bdist_wheel
twine upload dist/*
- name: π Build Storybook
run: npm run build-storybook --prefix ./react
- name: π Update Storybook
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || contains(github.event.head_commit.message, '[deploy test]')) && matrix.python-version == '3.8'
run: |
cp -r ./react/storybook-static ..
git config --local user.email "webviz-github-action"
git config --local user.name "webviz-github-action"
git fetch origin gh-pages
git checkout --track origin/gh-pages
git clean -f -f -d -x
git rm -r --ignore-unmatch *
mv ../storybook-static .
git add .
if git diff-index --quiet HEAD; then
echo "No changes in documentation. Skip documentation deploy."
else
git commit -m "Update Github Pages"
git push "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" gh-pages
fi