Skip to content

CI

CI #302

Workflow file for this run

name: CI
on: [push, pull_request]
# on:
# push:
# branches: 'master'
# schedule:
# - cron: '0 0 * * *'
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "14.x"
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Setup pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip-3.9-${{ hashFiles('package.json') }}
restore-keys: |
pip-3.9-
pip-
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup yarn cache
uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install wheel twine setuptools packaging jupyterlab~=3.0 jupyter_packaging~=0.7.9
jlpm
- name: Create server extension # and pip install
run: |
jlpm run build:prod
- name: Package extension
run: |
python setup.py sdist bdist_wheel
- name: upload python build artifacts
uses: actions/upload-artifact@v2
with:
name: dist
path: dist
- name: upload typescript build artifacts
uses: actions/upload-artifact@v2
with:
name: lib
path: lib
# test:
# needs: build
# runs-on: ubuntu-20.04
# strategy:
# matrix:
# jupyterlab_version: ["jupyterlab==3.*"]
# # jupyterlab_version: ["jupyterlab==3.*", "jupyterlab==2.*"] # TODO: fix jupyterlab 2 tests
# services:
# minio:
# image: lazybit/minio
# ports:
# - 9000:9000
# env:
# MINIO_ACCESS_KEY: ACCESS_KEY
# MINIO_SECRET_KEY: SECRET_KEY
# volumes:
# - /minio-data:/data
# options: --health-cmd "curl --fail http://localhost:9000/minio/health/live" --health-interval 30s --health-timeout 5s --health-retries 3
# steps:
# - uses: actions/checkout@v2
# - name: download build artifacts
# uses: actions/download-artifact@v2
# - uses: actions/setup-python@v2
# with:
# python-version: "3.9"
#
# - name: Install JupyterLab
# run: pip install ${{ matrix.jupyterlab_version }}
#
# - name: Install extension
# run: pip install dist/*.whl && jupyter serverextension enable --py jupyterlab_s3_browser
#
# - name: Install extension (JupyterLab 2 only)
# run: jupyter labextension install .
# if: ${{ matrix.jupyterlab_version == 'jupyterlab==2.*' }}
#
# - name: allow cypress to access minio-data mount
# run: sudo chown -R 1001:1001 /minio-data
#
# - uses: cypress-io/github-action@v2
# with:
# start: jupyter lab --no-browser --ServerApp.password='' --ServerApp.token='' --NotebookApp.token='' --NotebookApp.password=''
# browser: chrome
# headless: true
# wait-on: "http://localhost:8888/lab"
# wait-on-timeout: 120
# env:
# JUPYTERLAB_S3_ENDPOINT: http://localhost:9000
# JUPYTERLAB_S3_ACCESS_KEY_ID: ACCESS_KEY
# JUPYTERLAB_S3_SECRET_ACCESS_KEY: SECRET_KEY
# CYPRESS_S3_FOLDER: /minio-data
# CYPRESS_CI: true
#
# - uses: actions/upload-artifact@v1
# if: failure()
# with:
# name: cypress-screenshots
# path: cypress/screenshots
#
# - uses: actions/upload-artifact@v1
# if: always()
# with:
# name: cypress-videos
# path: cypress/videos
#
publish:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [build, test]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "14.x"
- name: Download build artifacts
uses: actions/download-artifact@v2
- run: yarn
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Publish labextension NPM
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
skip_existing: true