-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
13 changed files
with
536 additions
and
0 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,8 @@ | ||
.git* | ||
*.ows | ||
build | ||
.hadolint | ||
.travis.yml | ||
dist | ||
examples | ||
node_modules |
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,39 @@ | ||
|
||
[flake8] | ||
# Explicitly ignore rules to maintain better compatibility with black. | ||
# | ||
# F403: import * | ||
# F811: redefinition of unused `name` from line `N` | ||
# F821: undefined name | ||
# F841: local variable assigned but never used | ||
# E402: module level import not at top of file | ||
# I100: your import statements are in the wrong order. | ||
# I101: the names in your from import are in the wrong order. | ||
# D400: first line should end with a period. | ||
# E203: colons should not have any space before them. | ||
# E231: missing whitespace after ',' | ||
# E501: line lengths are recommended to be no greater than 79 characters. | ||
# E503: there is no need for backslashes between brackets. | ||
# E731: do not assign a lambda expression, use a def | ||
# W293: line break before binary operator | ||
# W293: blank line contains whitespace | ||
select = E,F,W,C | ||
ignore = F403, F811, F821, F841, E231, E402, I100, I101, D400, E501, E501, E503, E731, W293, W503 | ||
extend-ignore = E203 | ||
max-complexity = 15 | ||
# https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/ | ||
max-line-length = 119 | ||
builtins = c, get_config | ||
exclude = | ||
.ansible, | ||
.cache, | ||
__pycache__, | ||
.github, | ||
.ipynb_checkpoints, | ||
.pytest_cache, | ||
.travis, | ||
.vscode, | ||
ansible, | ||
docs, | ||
node_modules, | ||
venv |
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,46 @@ | ||
name: Test and Push | ||
|
||
on: | ||
pull_request: | ||
paths-ignore: | ||
- "*.md" | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- "*.md" | ||
|
||
jobs: | ||
build-images: | ||
name: Build Docker Images | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Clone Main Repo | ||
uses: actions/checkout@v2 | ||
with: | ||
path: main | ||
- name: Set Up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.x | ||
- name: Install Dev Dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
make -C main dev-env | ||
- name: Build Docker Images | ||
run: make -C main build-all | ||
env: | ||
# Full logs for CI build | ||
BUILDKIT_PROGRESS: plain | ||
- name: Login to Docker Hub | ||
if: github.ref == 'refs/heads/main' | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Push Images to DockerHub | ||
if: github.ref == 'refs/heads/main' | ||
run: make -C main push-all | ||
|
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,141 @@ | ||
# ide's | ||
.vscode | ||
|
||
# mac | ||
.DS_Store | ||
|
||
# npm | ||
node_modules/ | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# random test ouputs | ||
*.ows | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
pip-wheel-metadata/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ |
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,11 @@ | ||
--- | ||
ignored: | ||
- DL3000 | ||
- DL3004 | ||
- DL3006 | ||
- DL3007 | ||
- DL3008 | ||
- DL3015 | ||
- DL3016 | ||
- DL4006 | ||
- SC2035 |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 IllumiDesk | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,106 @@ | ||
# Most of the code below is sourced from: | ||
# https://raw.githubusercontent.com/jupyter/docker-stacks/master/Makefile | ||
.PHONY: build | ||
|
||
# Use bash for inline if-statements in target | ||
SHELL:=bash | ||
TAG:=julia-1.6.1 | ||
OWNER:=illumidesk | ||
VENV_NAME?=venv | ||
VENV_BIN=$(shell pwd)/${VENV_NAME}/bin | ||
VENV_ACTIVATE=. ${VENV_BIN}/activate | ||
|
||
PYTHON=${VENV_BIN}/python3 | ||
|
||
# Need to list the images in build dependency order | ||
ALL_STACKS:=umich-notebook | ||
|
||
ALL_IMAGES:=$(ALL_STACKS) | ||
|
||
# Linter | ||
HADOLINT="${HOME}/hadolint" | ||
|
||
help: | ||
# http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html | ||
# http://github.com/jupyter/docker-stacks | ||
@echo "illumidesk/illumidesk-stacks" | ||
@echo "=====================" | ||
@echo "Replace % with a stack directory name (e.g., make build/python-notebook)" | ||
@echo | ||
@grep -E '^[a-zA-Z0-9_%/-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
build/%: DARGS?= | ||
build/%: OWNER?= | ||
build/%: TAG?= | ||
build/%: ## build the latest image for a stack | ||
@docker build $(DARGS) --rm --force-rm -t $(OWNER)/$(notdir $@):$(TAG) ./$(notdir $@) | ||
@echo -n "Built image size: " | ||
@docker images $(OWNER)/$(notdir $@):$(TAG) --format "{{.Size}}" | ||
|
||
build-all: $(foreach I,$(ALL_IMAGES), build/$(I)) ## build all stacks | ||
|
||
push/%: DARGS?= | ||
push/%: TAG?= | ||
push/%: ## push stack images | ||
@docker push $(DARGS) $(OWNER)/$(notdir $@):$(TAG) | ||
|
||
push-all: $(foreach I,$(ALL_IMAGES), push/$(I)) ## push all stacks | ||
|
||
cont-clean-all: cont-stop-all cont-rm-all ## clean all containers (stop + rm) | ||
cont-stop-all: ## stop all containers | ||
@echo "Stopping all containers ..." | ||
-docker stop -t0 $(shell docker ps -a -q) 2> /dev/null | ||
cont-rm-all: ## remove all containers | ||
@echo "Removing all containers ..." | ||
-docker rm --force $(shell docker ps -a -q) 2> /dev/null | ||
|
||
dev/%: ARGS?= | ||
dev/%: DARGS?= | ||
dev/%: PORT?=8888 | ||
dev/%: ## run one of the containers (stacks) on port 8888 | ||
@docker run -it --rm -p $(PORT):8888 $(DARGS) $(OWNER)/$(notdir $@) $(ARGS) | ||
|
||
dev-env: ## install libraries required to build docs and run tests during CI. | ||
@pip install -r dev-requirements.txt | ||
|
||
img-clean: img-rm-dang img-rm ## clean dangling and jupyter images | ||
img-list: ## list jupyter images | ||
@echo "Listing $(OWNER) images ..." | ||
docker images "$(OWNER)/*" | ||
img-rm: ## remove jupyter images | ||
@echo "Removing $(OWNER) images ..." | ||
-docker rmi --force $(shell docker images --quiet "$(OWNER)/*") 2> /dev/null | ||
img-rm-dang: ## remove dangling images (tagged None) | ||
@echo "Removing dangling images ..." | ||
-docker rmi --force $(shell docker images -f "dangling=true" -q) 2> /dev/null | ||
|
||
lint/%: ARGS?=--config .hadolint.yml | ||
lint/%: ## lint the dockerfile(s) for a stack | ||
@echo "Linting Dockerfiles with Hadolint in $(notdir $@)..." | ||
@git ls-files --exclude='Dockerfile*' --ignored $(notdir $@) | grep -v ppc64 | xargs -L 1 $(HADOLINT) $(ARGS) | ||
@echo "Linting with Hadolint done!" | ||
@echo "Linting tests with flake8 in in $(notdir $@)..." | ||
${VENV_BIN}/flake8 $(notdir $@) | ||
@echo "Linting with flake8 done!" | ||
@echo "Applying black updates to test files in $(notdir $@)..." | ||
${VENV_BIN}/black $(notdir $@) | ||
@echo "Source formatting with black done!" | ||
|
||
lint-all: $(foreach I,$(ALL_IMAGES),lint/$(I) ) ## lint all stacks | ||
|
||
lint-build-all: $(foreach I,$(ALL_IMAGES),lint/$(I) build/$(I) ) ## lint, build and test all stacks | ||
|
||
lint-install: ## install hadolint | ||
@echo "Installing hadolint at $(HADOLINT) ..." | ||
@curl -sL -o $(HADOLINT) "https://github.com/hadolint/hadolint/releases/download/v1.18.0/hadolint-$(shell uname -s)-$(shell uname -m)" | ||
@chmod 700 $(HADOLINT) | ||
@echo "Hadolint nstallation done!" | ||
@$(HADOLINT) --version | ||
|
||
test: lint-build-all ## test images as running containers | ||
@echo "Testing images as running containers ..." | ||
@echo "Testing done!" | ||
|
||
venv: lint-install ## install linter and create virtual environment | ||
test -d $(VENV_NAME) || virtualenv -p python3 $(VENV_NAME) | ||
${PYTHON} -m pip install -r dev-requirements.txt |
Oops, something went wrong.