Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Image for a Python 3 development environment
FROM python:3.9-slim
FROM python:3.11-slim

# Add any tools that are needed beyond Python
RUN apt-get update && \
Expand All @@ -21,8 +21,10 @@ RUN groupadd --gid $USER_GID $USERNAME \

# Set up the Python development environment
WORKDIR /app
RUN python -m pip install --upgrade pip && \
pip install --upgrade wheel
COPY pyproject.toml poetry.lock ./
RUN sudo python -m pip install --upgrade pip poetry && \
sudo poetry config virtualenvs.create false && \
sudo poetry install

# Enable color terminal for docker exec bash
ENV TERM=xterm-256color
Expand Down
16 changes: 8 additions & 8 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// cSpell: disable
{
"name": "Python 3 & Redis",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/app",
"remoteUser": "devops",

"customizations": {
"vscode": {
"settings": {
Expand All @@ -14,11 +14,11 @@
},
"markdown-preview-github-styles.colorTheme": "light",
"makefile.extensionOutputFolder": "/tmp",
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"files.exclude": {
"**/.git": true,
"**/.DS_Store": true,
Expand All @@ -33,18 +33,18 @@
"ms-python.pylint",
"ms-python.flake8",
"ms-python.black-formatter",
"njpwerner.autodocstring",
"wholroyd.jinja",
"ms-vscode.makefile-tools",
"tamasfe.even-better-toml",
"yzhang.markdown-all-in-one",
"hnw.vscode-auto-open-markdown-preview",
"bierner.markdown-preview-github-styles",
"davidanson.vscode-markdownlint",
"bierner.markdown-preview-github-styles",
"tamasfe.even-better-toml",
"donjayamanne.githistory",
"GitHub.vscode-pull-request-github",
"hbenl.vscode-test-explorer",
"LittleFoxTeam.vscode-python-test-adapter",
"njpwerner.autodocstring",
"wholroyd.jinja",
"redhat.vscode-yaml",
"ms-azuretools.vscode-docker",
"ms-kubernetes-tools.vscode-kubernetes-tools",
Expand All @@ -55,5 +55,5 @@
]
}
},
"postCreateCommand": "sudo pip install -r requirements.txt"
// "postCreateCommand": "bash /app/.devcontainer/scripts/post-install.sh"
}
35 changes: 20 additions & 15 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,51 @@ on:
push:
branches:
- master
paths-ignore:
- 'README.md'
pull_request:
branches:
- master
paths-ignore:
- 'README.md'

jobs:
build:
runs-on: ubuntu-latest
container: python:3.9-slim
container: python:3.11-slim

# Required services
services:
redis:
image: redis:6-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- name: Checkout code
uses: actions/checkout@v2

uses: actions/checkout@v3
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip wheel
pip install -r requirements.txt
python -m pip install --upgrade pip poetry
poetry config virtualenvs.create false
poetry install

- name: Linting
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 service --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 service --count --max-complexity=10 --max-line-length=127 --statistics
pylint service --max-line-length=127

- name: Run unit tests with nose
run: nosetests -v --with-spec --spec-color --with-coverage --cover-package=app
- name: Run unit tests with PyTest
run: pytest --pspec --cov=service --cov-fail-under=95
env:
DATABASE_URI: "redis://redis:6379/0"
DATABASE_URI: "redis://redis:6379"

- name: Upload code coverage
uses: codecov/codecov-action@v2
with:
files: ./coverage.xml
flags: unittests
version: "v0.1.13"
uses: codecov/codecov-action@v3.1.4
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ celerybeat-schedule
.env

# virtualenv
.venv/
venv/
ENV/

Expand Down
3 changes: 0 additions & 3 deletions .pylintrc

This file was deleted.

23 changes: 0 additions & 23 deletions .vscode/launch.json

This file was deleted.

11 changes: 0 additions & 11 deletions .vscode/settings.json

This file was deleted.

9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,21 @@ all: help

venv: ## Create a Python virtual environment
$(info Creating Python 3 virtual environment...)
python3 -m venv .venv
poetry shell

install: ## Install dependencies
$(info Installing dependencies...)
sudo pip install -r requirements.txt
sudo poetry install

lint: ## Run the linter
$(info Running linting...)
flake8 service --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 service --count --max-complexity=10 --max-line-length=127 --statistics
pylint service --max-line-length=127

test: ## Run the unit tests
$(info Running tests...)
nosetests --with-spec --spec-color
$(info Running unit tests...)
pytest

run: ## Run the service
$(info Starting service...)
Expand Down
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
web: gunicorn --bind 0.0.0.0:$PORT --log-level=info service:app
web: gunicorn --bind 0.0.0.0:$PORT --log-level=info wsgi:app
Loading