Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch CI to GitHub actions #407

Merged
merged 6 commits into from Feb 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions .flake8
@@ -0,0 +1,17 @@
[flake8]
# Ignore style and complexity
# E: style errors
# W: style warnings
# C: complexity
# F401: module imported but unused
# F403: import *
# F811: redefinition of unused `name` from line `N`
# F841: local variable assigned but never used
# E402: module level import not at top of file
# I100: Import statements are in the wrong order
# I101: Imported names are in the wrong order. Should be
ignore = E, C, W, F401, F403, F811, F841, E402, I100, I101, D400
builtins = c, get_config
exclude =
.cache,
docs,
35 changes: 35 additions & 0 deletions .github/workflows/publish.yml
@@ -0,0 +1,35 @@
# Build releases and (on tags) publish to PyPI
name: Release

# always build releases (to make sure wheel-building works)
# but only publish to PyPI on tags
on:
push:
pull_request:

jobs:
build-release:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8

- name: install build package
run: |
pip install --upgrade pip
pip install build
pip freeze

- name: build release
run: |
python -m build --sdist --wheel .
ls -l dist

- name: publish to pypi
uses: pypa/gh-action-pypi-publish@v1.4.1
if: startsWith(github.ref, 'refs/tags/')
with:
user: __token__
password: ${{ secrets.pypi_password }}
106 changes: 106 additions & 0 deletions .github/workflows/test.yml
@@ -0,0 +1,106 @@
# This is a GitHub workflow defining a set of jobs with a set of steps.
# ref: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions
#
name: Tests

on:
pull_request:
push:
minrk marked this conversation as resolved.
Show resolved Hide resolved
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-20.04
timeout-minutes: 2

steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: pre-commit/action@v2.0.0

# Run tests
test:
runs-on: ubuntu-20.04
timeout-minutes: 10

strategy:
fail-fast: false
matrix:
include:
- python: 3.8
test: internal-ssl
- python: 3.6
jupyterhub: "1.0"
- python: 3.7
jupyterhub: 1.1
- python: 3.8
jupyterhub: 1.2
- python: 3.9
jupyterhub: 1.3

steps:
- uses: actions/checkout@v2

- name: setup docker swarm
run: docker swarm init

- name: Install Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}

# preserve pip cache to speed up installation
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('*requirements.txt') }}

- name: Install Python dependencies
run: |
pip install --upgrade pip
pip install --upgrade --pre -r dev-requirements.txt
if [[ ! -z "${{ matrix.jupyterhub }}" ]]; then
pip install jupyterhub==${{ matrix.jupyterhub }}.*
fi
pip install -e .

pip freeze

- name: Install Node
uses: actions/setup-node@v1
with:
node-version: "14"

- name: Install Node dependencies
run: |
npm install -g configurable-http-proxy

- name: Pull images
run: |
for v in 1.0 1.1 1.2 1.3; do
docker pull jupyterhub/singleuser:$v
# preserve the layers with a different tag
docker tag jupyterhub/singleuser:$v jupyterhub/singleuser:${v}-cache
# untag so that pull actions are still required
docker rmi jupyterhub/singleuser:$v
done

- name: Run tests
if: matrix.test != 'internal-ssl'
run: |
py.test --cov dockerspawner tests -v

- name: Run internal-ssl tests
if: matrix.test == 'internal-ssl'
run: |
cd examples/internal-ssl
pytest -vsx

- name: Submit codecov report
run: |
codecov
32 changes: 32 additions & 0 deletions .pre-commit-config.yaml
@@ -0,0 +1,32 @@
repos:
- repo: https://github.com/asottile/reorder_python_imports
rev: v1.9.0
hooks:
- id: reorder-python-imports
# autoformat: Python
- repo: https://github.com/psf/black
rev: 20.8b1
hooks:
- id: black
# Autoformat: shell scripts
- repo: https://github.com/lovesegfault/beautysh
rev: 6.0.1
hooks:
- id: beautysh
# Autoformat: markdown, yaml
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.2.1
hooks:
- id: prettier
# code-correctess
- repo: https://gitlab.com/pycqa/flake8
rev: "3.8.4"
hooks:
- id: flake8
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: end-of-file-fixer
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: requirements-txt-fixer
77 changes: 0 additions & 77 deletions .travis.yml

This file was deleted.

6 changes: 2 additions & 4 deletions CHANGELOG.md
Expand Up @@ -22,6 +22,7 @@ command line for details.
```python
c.JupyterHub.spawner_class = 'docker' # or 'docker-swarm' or 'docker-system-user'
```

- Support total internal SSL encryption with JupyterHub 1.0
- Add new `DockerSpawner.pull_policy` to configure pulling of images.
Values are inspired by Kubernetes, and case-insensitive. Can be any of
Expand All @@ -36,7 +37,6 @@ command line for details.

- Slow startup in SwarmSpawner could be treated as failures.


## 0.10

### [0.10.0] - 2018-09-03
Expand Down Expand Up @@ -117,7 +117,6 @@ Some configuration has been cleaned up to be clearer and more concise:
- workaround bug where Docker can report ports as strings
- bump docker dependency to new `docker` package from `docker-py`


## [0.7] - 2017-03-14

- Only need to set `DockerSpawner.network_name` to run on a docker network,
Expand Down Expand Up @@ -161,8 +160,7 @@ Some configuration has been cleaned up to be clearer and more concise:

First release


[Unreleased]: https://github.com/jupyterhub/dockerspawner/compare/0.11.1...HEAD
[unreleased]: https://github.com/jupyterhub/dockerspawner/compare/0.11.1...HEAD
[0.11.1]: https://github.com/jupyterhub/dockerspawner/compare/0.11.0...0.11.1
[0.11.0]: https://github.com/jupyterhub/dockerspawner/compare/0.10.0...0.11.0
[0.10.0]: https://github.com/jupyterhub/dockerspawner/compare/0.9.1...0.10.0
Expand Down
5 changes: 1 addition & 4 deletions README.md
Expand Up @@ -7,7 +7,6 @@
[![Discourse](https://img.shields.io/badge/help_forum-discourse-blue?logo=discourse)](https://discourse.jupyter.org/c/jupyterhub)
[![Gitter](https://img.shields.io/badge/social_chat-gitter-blue?logo=gitter)](https://gitter.im/jupyterhub/jupyterhub)


The **dockerspawner** (also known as JupyterHub Docker Spawner), enables
[JupyterHub](https://github.com/jupyterhub/jupyterhub) to spawn single user
notebook servers in [Docker containers](https://www.docker.com/resources/what-container).
Expand Down Expand Up @@ -38,7 +37,7 @@ pip install dockerspawner

## Contributing

If you would like to contribute to the project (:heart:), please read our
If you would like to contribute to the project (:heart:), please read our
[contributor documentation](http://jupyterhub-dockerspawner/en/latest/contributing.html)
and the [`CONTRIBUTING.md`](CONTRIBUTING.md).

Expand All @@ -49,13 +48,11 @@ copyright on their contributions.

All code is licensed under the terms of the revised BSD license.


## Getting help

We encourage you to ask questions on the [Discourse community forum](https://discourse.jupyter.org/),
or [Gitter](https://gitter.im/jupyterhub/jupyterhub).


## Resources

### Dockerspawner and JupyterHub
Expand Down
6 changes: 3 additions & 3 deletions RELEASE.md
Expand Up @@ -24,7 +24,7 @@ repository](https://github.com/jupyterhub/dockerspawner).

1. Update [CHANGELOG.md](CHANGELOG.md) and add it to
the working tree.

```bash
git add CHANGELOG.md
```
Expand All @@ -45,10 +45,10 @@ repository](https://github.com/jupyterhub/dockerspawner).
Tip: You can get the current project version by checking the [latest
tag on GitHub](https://github.com/jupyterhub/dockerspawner/tags).


1. Reset the `version_info` variable in
[\_version.py](dockerspawner/_version.py) appropriately with an incremented
patch version and a `dev` element, then make a commit.

```bash
git add dockerspawner/_version.py
git commit -m "back to dev"
Expand All @@ -73,4 +73,4 @@ repository](https://github.com/jupyterhub/dockerspawner).
git log
# then push it
git push $ORIGIN --follow-tags
```
```
6 changes: 3 additions & 3 deletions dev-requirements.txt
@@ -1,6 +1,6 @@
codecov
notebook
pyflakes
pytest>=3.6
pytest-cov
pytest-asyncio
pyflakes
notebook
pytest-cov
1 change: 0 additions & 1 deletion dockerspawner/_version.py
@@ -1,5 +1,4 @@
"""dockerspawner version info"""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

Expand Down