This repository has been archived by the owner on Nov 21, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b89d8b6
commit 0eae6bd
Showing
17 changed files
with
848 additions
and
6 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,2 @@ | ||
.mypy_cache/ | ||
.pytest_cache/ |
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,15 @@ | ||
language: minimal | ||
|
||
services: docker | ||
|
||
install: | ||
- travis_retry make build | ||
|
||
script: | ||
- make all-tests | ||
|
||
if: | | ||
branch = master OR \ | ||
branch =~ /^[0-9\.]+$/ OR \ | ||
tag IS present OR \ | ||
type = pull_request |
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,4 +1,3 @@ | ||
Code of conduct | ||
=============== | ||
# Code of conduct | ||
|
||
The Libero community follows a [code of conduct](https://libero.pub/code-of-conduct). |
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,87 @@ | ||
PROJECT_CODEBASE_DIR = "search/" | ||
TESTS_DIR = "tests/" | ||
FILES_TO_CHECK = $(PROJECT_CODEBASE_DIR) $(TESTS_DIR) | ||
DOCKER_COMPOSE = docker-compose -f docker/docker-compose.dev.yml | ||
|
||
help: | ||
@echo "start - builds and/or starts all services" | ||
@echo "stop - stops all running containers belonging to the project" | ||
@echo "checks - runs static checks such as linting without running unit tests" | ||
@echo "tests - runs unit tests in debug mode (able to use pdb breakpoints)" | ||
@echo "all-tests - runs static checks and unit tests" | ||
@echo "fix-imports - silently modifies imports on all project files that do not" | ||
@echo " adhere to project coding standards regarding imports" | ||
@echo "run - only runs the application service (able to use pdb breakpoints)" | ||
@echo "shell - enter the shell of the application service" | ||
@echo "build - builds the application service" | ||
@echo "---------------------------------------------------------------" | ||
@echo "make build should be run after adding and removing dependencies" | ||
@echo "---------------------------------------------------------------" | ||
@echo "dependency-tree - show dependency tree" | ||
@echo "d-tree - alias for \"dependency-tree\"" | ||
@echo "add-dependency - add or update a python dependency by specifying a package" | ||
@echo " e.g. make dependency package=flask" | ||
@echo " e.g. make dependency package=flask==1.0.2" | ||
@echo "add-dev-dependency - same as \"dependency\" except the package will be installed" | ||
@echo " during development only" | ||
@echo "remove-dependency - remove a python dependency by specifying a package" | ||
@echo " e.g. make remove-dependency package=flask" | ||
@echo "remove-dev-dependency - same as \"remove-dependency\" regarding development dependencies" | ||
|
||
start: | ||
$(DOCKER_COMPOSE) up | ||
|
||
stop: | ||
$(DOCKER_COMPOSE) down -v | ||
|
||
checks: | ||
$(DOCKER_COMPOSE) run --rm web /bin/bash -c "\ | ||
echo \"Running checks...\" && \ | ||
echo \"- check for breakpoints\" && \ | ||
source scripts/find-breakpoints.sh && \ | ||
echo \"- mypy\" && \ | ||
mypy $(FILES_TO_CHECK) && \ | ||
echo \"- flake8\" && \ | ||
flake8 $(FILES_TO_CHECK) && \ | ||
echo \"- pylint\" && \ | ||
pylint --rcfile=setup.cfg $(FILES_TO_CHECK) && \ | ||
echo \"All checks completed\" \ | ||
" | ||
|
||
.PHONY: tests | ||
tests: | ||
$(DOCKER_COMPOSE) run --rm --service-ports web /bin/bash -c \ | ||
"pytest -s --pdbcls=IPython.terminal.debugger:Pdb -vv" | ||
|
||
all-tests: checks tests | ||
|
||
fix-imports: | ||
$(DOCKER_COMPOSE) run --rm web /bin/bash -c "isort -y" | ||
|
||
.PHONY: run | ||
run: | ||
$(DOCKER_COMPOSE) run --rm --service-ports web | ||
|
||
shell: | ||
$(DOCKER_COMPOSE) run --rm --service-ports web /bin/bash | ||
|
||
build: | ||
$(DOCKER_COMPOSE) build web | ||
|
||
dependency-tree: | ||
$(DOCKER_COMPOSE) run --rm web /bin/bash -c "poetry show --tree" | ||
|
||
d-tree: dependency-tree # alias for dependency-tree | ||
|
||
add-dependency: | ||
$(DOCKER_COMPOSE) run --rm web /bin/bash -c "poetry add $(package)" | ||
|
||
add-dev-dependency: | ||
$(DOCKER_COMPOSE) run --rm web /bin/bash -c "poetry add $(package) --dev" | ||
|
||
remove-dependency: | ||
$(DOCKER_COMPOSE) run --rm web /bin/bash -c "poetry remove $(package)" | ||
|
||
remove-dev-dependency: | ||
$(DOCKER_COMPOSE) run --rm web /bin/bash -c "poetry remove $(package) --dev" | ||
|
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
FROM python:3.7.2-alpine3.8 | ||
|
||
ENV PYTHONUNBUFFERED=1 | ||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
ENV PATH "/root/.poetry/bin:$PATH" | ||
|
||
WORKDIR /srv/app | ||
|
||
RUN apk add --no-cache \ | ||
bash \ | ||
grep \ | ||
libxslt-dev | ||
|
||
RUN apk add --no-cache --virtual .build-dependencies curl && \ | ||
curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python && \ | ||
poetry config settings.virtualenvs.create false && \ | ||
apk del .build-dependencies | ||
|
||
COPY ./pyproject.toml ./poetry.lock ./ | ||
|
||
RUN apk add --no-cache --virtual .build-dependencies \ | ||
gcc \ | ||
musl-dev \ | ||
&& \ | ||
poetry install && \ | ||
apk del .build-dependencies |
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,2 @@ | ||
FLASK_APP=search | ||
FLASK_ENV=development |
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,15 @@ | ||
version: '3' | ||
|
||
services: | ||
web: | ||
build: | ||
context: .. | ||
dockerfile: docker/Dockerfile.dev | ||
working_dir: /srv/app | ||
volumes: | ||
- ..:/srv/app | ||
command: "flask run --host=0.0.0.0" | ||
ports: | ||
- "5000:5000" | ||
env_file: | ||
- dev.env |
Oops, something went wrong.