webviz-config #2826
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: webviz-config | |
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-config: | |
runs-on: ubuntu-latest | |
env: | |
PYTHONWARNINGS: default # We want to see e.g. DeprecationWarnings | |
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 setuptools_scm version | |
if: github.event_name == 'release' | |
# Need to instruct setuptools_scm to use the GitHub provided tag, despite local git changes (due to build step) | |
run: echo "SETUPTOOLS_SCM_PRETEND_VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_ENV | |
- name: 🐍 Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: 📦 Install npm dependencies | |
run: | | |
npm ci --ignore-scripts | |
npm run postinstall | |
- name: 📦 Install webviz-config with dependencies | |
run: | | |
pip install --upgrade pip | |
pip install . | |
pip install --pre --upgrade webviz-core-components # Testing against our latest release (including pre-releases) | |
- name: 📦 Install extra deployment dependencies | |
if: matrix.python-version != '3.10' # Check tests pass also without optional dependencies | |
run: | | |
pip install .[deployment] | |
- name: 📦 Install test dependencies | |
run: | | |
pip install .[tests] | |
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: | | |
black --check webviz_config tests setup.py | |
pylint webviz_config tests setup.py | |
bandit -r -c ./bandit.yml webviz_config tests setup.py | |
# mypy --package webviz_config --ignore-missing-imports --disallow-untyped-defs --show-error-codes | |
- name: 🤖 Run tests | |
run: | | |
webviz preferences --theme default | |
pytest ./tests --headless --forked | |
webviz docs --portable ./docs_build --skip-open | |
webviz schema | |
- name: 🐳 Build Docker example image | |
run: | | |
export GIT_POINTER_WEBVIZ_CONFIG=$GITHUB_REF | |
webviz build ./examples/basic_example.yaml --portable ./some_portable_app | |
pushd ./some_portable_app | |
docker build . | |
rm -rf ./some_portable_app | |
- 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: | | |
python -m pip install --upgrade setuptools wheel twine | |
python setup.py sdist bdist_wheel | |
twine upload dist/* | |
- name: 📚 Update GitHub pages | |
if: github.event_name == 'release' && matrix.python-version == '3.8' | |
run: | | |
cp -R ./docs_build ../docs_build | |
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 * | |
cp -R ../docs_build/* . | |
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 |