Skip to content

Commit

Permalink
vespawatch django project init
Browse files Browse the repository at this point in the history
  • Loading branch information
stevegerrits committed Feb 27, 2024
1 parent 59d4bd9 commit dabc0b3
Show file tree
Hide file tree
Showing 48 changed files with 3,075 additions and 139 deletions.
Binary file added .DS_Store
Binary file not shown.
69 changes: 69 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"name": "vespadb",
"dockerComposeFile": "../docker-compose.yml",
"service": "devcontainer",
"runServices": [
"devcontainer"
],
"shutdownAction": "stopCompose",
"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/vespadb/,type=bind,consistency=delegated",
"workspaceFolder": "/workspaces/vespadb/",
"remoteUser": "root",
"overrideCommand": true,
"initializeCommand": "touch ${localWorkspaceFolder}/.env",
"mounts": [
"type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock,consistency=consistent"
],
"customizations": {
"vscode": {
"extensions": [
"eamodio.gitlens",
"github.copilot",
"ms-azuretools.vscode-docker",
"ms-python.mypy-type-checker",
"ms-python.python",
"henriiik.vscode-ruff",
"charliermarsh.ruff",
"ryanluker.vscode-coverage-gutters",
"tamasfe.even-better-toml",
"visualstudioexptteam.vscodeintellicode",
"GitHub.copilot-chat",
"GitHub.copilot"
],
"settings": {
"coverage-gutters.coverageFileNames": [
"reports/coverage.xml"
],
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": true
},
"editor.formatOnSave": true,
"editor.rulers": [
100
],
"editor.tabSize": 4,
"files.autoSave": "onFocusChange",
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff"
},
"[toml]": {
"editor.formatOnSave": false
},
"mypy-type-checker.importStrategy": "fromEnvironment",
"python.defaultInterpreterPath": "/opt/vespadb-env/bin/python",
"python.terminal.activateEnvironment": false,
"python.testing.pytestEnabled": true,
"remote.containers.copyGitConfig": true,
"ruff.importStrategy": "fromEnvironment",
"ruff.logLevel": "warn",
"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/usr/bin/zsh"
}
}
}
}
}
}
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Exclude files and directories from the build context.
# https://docs.docker.com/engine/reference/builder/#dockerignore-file
.mypy_cache/
.pytest_cache/
.ruff_cache/
.git/
tests/
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2

updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: monthly
- package-ecosystem: pip
directory: "/"
schedule:
interval: monthly
versioning-strategy: lockfile-only
allow:
- dependency-type: "all"
40 changes: 40 additions & 0 deletions .github/workflows/push_to_ghcr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Push to ghcr.io

on:
push:
branches:
- main
- master
pull_request:

jobs:
build_and_push:
name: Build and push
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set Build Timestamp
run: echo "BUILD_TIMESTAMP=$(date +'%Y-%m-%dT%H:%M:%S:%z')" >> $GITHUB_ENV
- name: Log in to registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
env:
BUILD_BRANCH: ${{ github.head_ref || github.ref_name }}
with:
context: .
target: app
push: true
build-args: |
BUILD_BRANCH=${{ env.BUILD_BRANCH }}
BUILD_COMMIT=${{ github.sha }}
BUILD_TIMESTAMP=${{ env.BUILD_TIMESTAMP }}
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ env.BUILD_BRANCH }}
74 changes: 74 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# By default, GitHub Actions don't have permission to write to the ghcr.io registry.
# - Go to: Settings (of this repository) -> Actions -> General -> Workflow permissions
# - Enable: Read and write permissions
name: Lint and Test

on:
push:
branches:
- main
- master
pull_request:

jobs:
test:
runs-on: ubuntu-latest
permissions: write-all
strategy:
matrix:
python-version: [ "3.11.6" ]
name: Python ${{ matrix.python-version }}
env:
TAG: devcontainer-${{ matrix.python-version }}-${{ github.head_ref || github.ref_name }}
steps:
# https://github.com/actions/checkout
- name: Checkout
uses: actions/checkout@v4

# Add an empty .env file.
# The devcontainers/ci build action fails when the docker-compose.yml file references an .env file that does not exist.
- name: Touch .env
run: touch .env

# https://github.com/docker/login-action
- name: Log in to registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# https://github.com/devcontainers/ci
- name: Build DevContainer
uses: devcontainers/[email protected]
env:
PYTHON_VERSION: ${{ matrix.python-version }}
with:
imageName: ghcr.io/${{ github.repository }}
cacheFrom: ghcr.io/${{ github.repository }}:${{ env.TAG }}
imageTag: ${{ env.TAG }}
push: always

- name: Run lint
uses: devcontainers/[email protected]
with:
cacheFrom: ghcr.io/${{ github.repository }}:${{ env.TAG }}
push: never
runCmd: poe lint

- name: Run test
uses: devcontainers/[email protected]
with:
cacheFrom: ghcr.io/${{ github.repository }}:${{ env.TAG }}
push: never
runCmd: poe test

# https://github.com/codecov/codecov-action
- name: Upload coverage
uses: codecov/codecov-action@v3
with:
files: reports/coverage.xml
env:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
verbose: true
144 changes: 5 additions & 139 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,158 +3,24 @@ __pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
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/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
reports/

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/
# Ruff
.ruff_cache/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .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

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__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
.venv/

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.idea/
Loading

0 comments on commit dabc0b3

Please sign in to comment.