-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #208 from consideRatio/pr/general-maintenance
General maintenance: autoformat, flake8, readme badges, misc in github workflows
- Loading branch information
Showing
15 changed files
with
1,088 additions
and
747 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[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, W, C, F401, F403, F811, F841, E402, I100, I101, D400 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,77 @@ | ||
# 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: Test | ||
|
||
name: Python package | ||
|
||
on: [push, pull_request] | ||
on: | ||
pull_request: | ||
push: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
pre-commit: | ||
name: Run pre-commit | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
- uses: pre-commit/[email protected] | ||
|
||
pytest: | ||
name: "Run pytest" | ||
runs-on: ubuntu-20.04 | ||
continue-on-error: ${{ matrix.allow_failure }} | ||
strategy: | ||
# Keep running even if one variation of the job fail | ||
fail-fast: false | ||
matrix: | ||
python-version: | ||
- '3.5' | ||
- '3.9' | ||
- "3.5" | ||
- "3.9" | ||
JHUB_VER: | ||
- '0.9.6' | ||
- '1.0.0' | ||
- '1.1.0' | ||
- '1.2.0' | ||
- "0.9.6" | ||
- "1.0.0" | ||
- "1.1.0" | ||
- "1.2.0" | ||
- "1.3.0" | ||
allow_failure: [false] | ||
|
||
exclude: | ||
# JupyterHub 1.3.0 requires python 3.6+ | ||
- JHUB_VER: "1.3.0" | ||
python-version: "3.5" | ||
include: | ||
- JHUB_VER: 'master' | ||
python-version: '3.9' | ||
- JHUB_VER: "master" | ||
python-version: "3.9" | ||
allow_failure: true | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install pytest | ||
pip install -r requirements.txt | ||
- name: Install nodejs dependencies | ||
run: | | ||
sudo npm install -g configurable-http-proxy | ||
# We need to check compatibility with different versions of the JH | ||
# API, including latest development. For that, we also need to | ||
# pull in the dependencies of that old JH version (but we don't | ||
# need conda/npm for our tests). | ||
- name: install JupyterHub | ||
run: | | ||
git clone --quiet --branch ${{ matrix.JHUB_VER }} https://github.com/jupyterhub/jupyterhub.git jupyterhub | ||
pip install --pre -r jupyterhub/dev-requirements.txt | ||
pip install --upgrade pytest | ||
pip install --pre -e jupyterhub | ||
- name: pytest | ||
run: | | ||
pytest --lf --cov batchspawner batchspawner/tests -v | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install pytest | ||
pip install -r requirements.txt | ||
- name: Install nodejs dependencies | ||
run: | | ||
sudo npm install -g configurable-http-proxy | ||
# We need to check compatibility with different versions of the JH | ||
# API, including latest development. For that, we also need to | ||
# pull in the dependencies of that old JH version (but we don't | ||
# need conda/npm for our tests). | ||
- name: install JupyterHub | ||
run: | | ||
git clone --quiet --branch ${{ matrix.JHUB_VER }} https://github.com/jupyterhub/jupyterhub.git jupyterhub | ||
pip install --pre -r jupyterhub/dev-requirements.txt | ||
pip install --upgrade pytest | ||
pip install --pre -e jupyterhub | ||
- name: pytest | ||
run: | | ||
pytest --verbose --color=yes --last-failed --cov batchspawner batchspawner/tests |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# pre-commit is a tool to perform a predefined set of tasks manually and/or | ||
# automatically before git commits are made. | ||
# | ||
# Config reference: https://pre-commit.com/#pre-commit-configyaml---top-level | ||
# | ||
# Common tasks | ||
# | ||
# - Run on all files: pre-commit run --all-files | ||
# - Register git hooks: pre-commit install --install-hooks | ||
# | ||
repos: | ||
# Autoformat: Python code | ||
- repo: https://github.com/ambv/black | ||
rev: 20.8b1 | ||
hooks: | ||
- id: black | ||
args: [--target-version=py36] | ||
|
||
# Autoformat: markdown, yaml | ||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: v2.2.1 | ||
hooks: | ||
- id: prettier | ||
|
||
# Lint: Python code | ||
- repo: https://gitlab.com/pycqa/flake8 | ||
rev: "3.8.4" | ||
hooks: | ||
- id: flake8 | ||
|
||
# Misc... | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v3.4.0 | ||
# ref: https://github.com/pre-commit/pre-commit-hooks#hooks-available | ||
hooks: | ||
# Autoformat: Makes sure files end in a newline and only a newline. | ||
- id: end-of-file-fixer | ||
|
||
# Autoformat: Sorts entries in requirements.txt. | ||
- id: requirements-txt-fixer | ||
|
||
# Prevent giant (500kB) files from being committed. | ||
- id: check-added-large-files | ||
|
||
# Lint: Check for files with names that would conflict on a | ||
# case-insensitive filesystem like MacOS HFS+ or Windows FAT. | ||
- id: check-case-conflict | ||
|
||
# Lint: Checks that non-binary executables have a proper shebang. | ||
- id: check-executables-have-shebangs |
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
Oops, something went wrong.