mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
255 lines
7.4 KiB
YAML
255 lines
7.4 KiB
YAML
version: 2.1
|
|
executors:
|
|
ubuntu_docker:
|
|
docker:
|
|
# Match target OS of TLJH
|
|
- image: ubuntu:18.04
|
|
working_directory: ~/repo
|
|
|
|
|
|
commands:
|
|
setup_venv:
|
|
description: Setup hub venv
|
|
steps:
|
|
- run:
|
|
name: Setup venv
|
|
command: |
|
|
python3 -m venv /srv/venv
|
|
echo 'export PATH=/srv/venv/bin:$PATH' >> $BASH_ENV
|
|
|
|
install_python:
|
|
description: Install python3, venv, git and make
|
|
steps:
|
|
- run:
|
|
name: install python
|
|
command: |
|
|
apt-get update --yes && apt-get install --yes python3 python3-venv git make
|
|
|
|
setup_pkgs:
|
|
description: Setup pkgs for integration and upgrade tests
|
|
steps:
|
|
- run:
|
|
name: setup python3
|
|
command: |
|
|
apk add --no-cache python3 pytest
|
|
- run:
|
|
# Need this to indentify the circle pr branch
|
|
name: install curl and jq
|
|
command: |
|
|
apk add curl curl-dev
|
|
apk add jq
|
|
|
|
|
|
build_systemd_image:
|
|
steps:
|
|
- run:
|
|
name: build systemd image
|
|
command: |
|
|
.circleci/integration-test.py build-image
|
|
|
|
basic_tests:
|
|
parameters:
|
|
# Whether or not we should run update tests
|
|
upgrade:
|
|
type: string
|
|
default: ""
|
|
steps:
|
|
- run:
|
|
name: Run basic tests
|
|
command: |
|
|
PR_INFO_URL=https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER
|
|
PR_BRANCH=`(curl -s $PR_INFO_URL | jq -r ".head.ref")`
|
|
if [ "$PR_BRANCH" == "null" ];then
|
|
PR_BRANCH=$CIRCLE_BRANCH
|
|
fi
|
|
BOOTSTRAP_PIP_SPEC=git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$PR_BRANCH
|
|
|
|
.circleci/integration-test.py run-test basic-tests \
|
|
"$BOOTSTRAP_PIP_SPEC" test_hub.py test_install.py test_extensions.py \
|
|
<< parameters.upgrade >>
|
|
admin_tests:
|
|
parameters:
|
|
upgrade:
|
|
type: string
|
|
default: ""
|
|
steps:
|
|
- run:
|
|
name: Run admin tests
|
|
command: |
|
|
PR_INFO_URL=https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER
|
|
PR_BRANCH=`(curl -s $PR_INFO_URL | jq -r ".head.ref")`
|
|
if [ "$PR_BRANCH" == "null" ];then
|
|
PR_BRANCH=$CIRCLE_BRANCH
|
|
fi
|
|
BOOTSTRAP_PIP_SPEC=git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$PR_BRANCH
|
|
|
|
.circleci/integration-test.py run-test \
|
|
--installer-args "--admin admin:admin" \
|
|
basic-tests $BOOTSTRAP_PIP_SPEC test_admin_installer.py \
|
|
<< parameters.upgrade >>
|
|
|
|
plugin_tests:
|
|
parameters:
|
|
upgrade:
|
|
type: string
|
|
default: ""
|
|
steps:
|
|
- run:
|
|
name: Run plugin tests
|
|
command: |
|
|
PR_INFO_URL=https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER
|
|
PR_BRANCH=`(curl -s $PR_INFO_URL | jq -r ".head.ref")`
|
|
if [ "$PR_BRANCH" == "null" ];then
|
|
PR_BRANCH=$CIRCLE_BRANCH
|
|
fi
|
|
BOOTSTRAP_PIP_SPEC=git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$PR_BRANCH
|
|
|
|
.circleci/integration-test.py run-test \
|
|
--installer-args "--plugin /srv/src/integration-tests/plugins/simplest" \
|
|
plugins $BOOTSTRAP_PIP_SPEC test_simplest_plugin.py \
|
|
<< parameters.upgrade >>
|
|
|
|
bootstrap_checks:
|
|
parameters:
|
|
steps:
|
|
- run:
|
|
name: Run bootstrap checks
|
|
command: |
|
|
py.test integration-tests/test_bootstrap.py
|
|
|
|
|
|
jobs:
|
|
unit-test:
|
|
executor: ubuntu_docker
|
|
steps:
|
|
- checkout
|
|
|
|
# Setup Python
|
|
- install_python
|
|
|
|
# Download and cache dependencies
|
|
- restore_cache:
|
|
keys:
|
|
- v1-dependencies-py3.6-{{ checksum "setup.py" }}-{{ checksum "dev-requirements.txt" }}
|
|
- v1-dependencies-py3.6-
|
|
|
|
- setup_venv
|
|
- run:
|
|
name: install dependencies
|
|
command: |
|
|
pip install -r dev-requirements.txt
|
|
pip install -e .
|
|
|
|
- save_cache:
|
|
paths:
|
|
- /srv/venv/
|
|
key: v1-dependencies-py3.6-{{ checksum "setup.py" }}-{{ checksum "dev-requirements.txt" }}
|
|
|
|
- run:
|
|
name: run unit tests
|
|
command: |
|
|
py.test --cov=tljh tests/
|
|
|
|
- run:
|
|
name: upload code coverage stats
|
|
command: |
|
|
codecov
|
|
|
|
integration-test:
|
|
docker:
|
|
- image: docker:18.05.0-ce-git
|
|
|
|
steps:
|
|
- setup_pkgs
|
|
|
|
- checkout
|
|
|
|
- setup_remote_docker
|
|
|
|
- build_systemd_image
|
|
|
|
- basic_tests
|
|
|
|
- admin_tests
|
|
|
|
- plugin_tests
|
|
|
|
- bootstrap_checks
|
|
|
|
|
|
upgrade-test:
|
|
docker:
|
|
- image: docker:18.05.0-ce-git
|
|
|
|
steps:
|
|
- run:
|
|
name: Check upgrade testing
|
|
command: |
|
|
if [ "$CIRCLE_BRANCH" == "master" ]; then
|
|
echo "On master, no upgrade to test..."
|
|
circleci-agent step halt
|
|
else
|
|
echo "PR detected, testing upgrade..."
|
|
fi
|
|
|
|
- setup_pkgs
|
|
|
|
- checkout
|
|
|
|
- setup_remote_docker
|
|
|
|
- build_systemd_image
|
|
|
|
- basic_tests:
|
|
upgrade: "--upgrade"
|
|
|
|
- admin_tests:
|
|
upgrade: "--upgrade"
|
|
|
|
- plugin_tests:
|
|
upgrade: "--upgrade"
|
|
|
|
|
|
documentation:
|
|
executor: ubuntu_docker
|
|
steps:
|
|
- checkout
|
|
|
|
# Setup Python
|
|
- install_python
|
|
|
|
# Download and cache dependencies
|
|
- restore_cache:
|
|
key: v1-dependencies-py3.6-sphinx
|
|
|
|
- setup_venv
|
|
- run:
|
|
name: install dependencies
|
|
command: |
|
|
pip install sphinx
|
|
pip install -r docs/requirements.txt
|
|
|
|
- save_cache:
|
|
paths:
|
|
- /srv/venv/
|
|
key: v1-dependencies-py3.6-sphinx
|
|
|
|
- run:
|
|
name: build documentation
|
|
command: |
|
|
cd docs
|
|
make html
|
|
|
|
- store_artifacts:
|
|
path: docs/_build/html/
|
|
destination: html
|
|
|
|
workflows:
|
|
version: 2
|
|
all-tests:
|
|
jobs:
|
|
- unit-test
|
|
- integration-test
|
|
- upgrade-test
|
|
- documentation
|