Skip to content

Commit 6038f33

Browse files
jamshalecjhowland
andauthored
Redis cache (#2364)
* feat: add cache redis plugin Signed-off-by: Char Howland <char@indicio.tech> * fix: gha tests Signed-off-by: Char Howland <char@indicio.tech> * fix: conditional gha workflow for cache redis Signed-off-by: Char Howland <char@indicio.tech> * feat: Redis Cache - WIP Signed-off-by: jamshale <jamiehalebc@gmail.com> * chore: some testing cleanup Signed-off-by: jamshale <jamiehalebc@gmail.com> * chore: formatting Signed-off-by: jamshale <jamiehalebc@gmail.com> * feat: use network cleaup script and random subnet to avoid conflicts Signed-off-by: jamshale <jamiehalebc@gmail.com> * chore: formatting Signed-off-by: jamshale <jamiehalebc@gmail.com> * fix: keep cluster container alive Signed-off-by: jamshale <jamiehalebc@gmail.com> * fix: init in detached mode Signed-off-by: jamshale <jamiehalebc@gmail.com> * test: Try making init container non-essential Signed-off-by: jamshale <jamiehalebc@gmail.com> * test: try new workflow method Signed-off-by: jamshale <jamiehalebc@gmail.com> * test: try new workflow method Signed-off-by: jamshale <jamiehalebc@gmail.com> --------- Signed-off-by: Char Howland <char@indicio.tech> Signed-off-by: jamshale <jamiehalebc@gmail.com> Co-authored-by: Char Howland <char@indicio.tech>
1 parent f7f57f9 commit 6038f33

37 files changed

Lines changed: 6073 additions & 6 deletions

.github/dependabot.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,30 @@ updates:
229229
- dependency-name: "*"
230230
update-types: ["version-update:semver-major"]
231231

232+
# Maintain dependencies for Python Packages
233+
- package-ecosystem: "pip"
234+
directory: "/cache_redis"
235+
schedule:
236+
interval: "weekly"
237+
day: "monday"
238+
time: "04:00"
239+
timezone: "Canada/Pacific"
240+
ignore:
241+
- dependency-name: "*"
242+
update-types: ["version-update:semver-major"]
243+
244+
# Maintain dependencies for Python Packages
245+
- package-ecosystem: "pip"
246+
directory: "/cache_redis/int"
247+
schedule:
248+
interval: "weekly"
249+
day: "monday"
250+
time: "04:00"
251+
timezone: "Canada/Pacific"
252+
ignore:
253+
- dependency-name: "*"
254+
update-types: ["version-update:semver-major"]
255+
232256
# Maintain dependencies for Python Packages
233257
- package-ecosystem: "pip"
234258
directory: "/cheqd"

.github/workflows/pr-integration-tests.yaml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,37 @@ jobs:
9191
#----------------------------------------------
9292
- name: Run Integration Tests
9393
id: integration-tests
94+
shell: bash
9495
run: |
9596
for dir in ${{ steps.changed-plugins.outputs.changed-plugins }}; do
96-
echo "Running integration tests for $dir"
97-
cd $dir/integration
97+
echo "🔧 Running integration tests for $dir"
98+
cd "$dir/integration"
99+
100+
# Source init-network.sh if it exists
101+
if [ -f ./init-network.sh ]; then
102+
echo "📡 Sourcing init-network.sh"
103+
. ./init-network.sh
104+
fi
105+
98106
docker compose build
99-
if ! docker compose up --exit-code-from tests; then
107+
108+
# Start everything in the background
109+
echo "🚀 Starting docker compose stack..."
110+
docker compose up -d
111+
112+
echo "🧪 Running tests container..."
113+
docker compose run --rm tests
114+
TEST_EXIT=$?
115+
116+
if [[ $TEST_EXIT -ne 0 ]]; then
100117
echo "❌ Tests failed for $dir - dumping logs:"
101-
docker compose logs
118+
docker compose logs || true
102119
docker compose down --remove-orphans
103-
exit 1
120+
exit $TEST_EXIT
104121
fi
122+
123+
echo "✅ Tests passed for $dir"
124+
105125
docker compose down --remove-orphans
106126
cd ../..
107-
done
127+
done

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ RUN useradd -m -s /bin/bash acapy
2323
# Install plugins with --no-deps to avoid dependency conflicts
2424
RUN pip install --no-deps \
2525
git+https://github.com/${REPO_OWNER}/acapy-plugins@${ACA_PY_VERSION}#subdirectory=basicmessage_storage \
26+
git+https://github.com/${REPO_OWNER}/acapy-plugins@${ACA_PY_VERSION}#subdirectory=cache_redis \
2627
git+https://github.com/${REPO_OWNER}/acapy-plugins@${ACA_PY_VERSION}#subdirectory=cheqd \
2728
git+https://github.com/${REPO_OWNER}/acapy-plugins@${ACA_PY_VERSION}#subdirectory=connection_update \
2829
git+https://github.com/${REPO_OWNER}/acapy-plugins@${ACA_PY_VERSION}#subdirectory=connections \
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.134.0/containers/python-3/.devcontainer/base.Dockerfile
2+
ARG VARIANT="3.12"
3+
FROM mcr.microsoft.com/devcontainers/python:${VARIANT}
4+
5+
ARG POETRY_VERSION="2.1.2"
6+
ENV POETRY_HOME="/opt/poetry" \
7+
POETRY_VERSION=${POETRY_VERSION}
8+
9+
RUN curl -sSL https://install.python-poetry.org | python3 - \
10+
&& update-alternatives --install /usr/local/bin/poetry poetry /opt/poetry/bin/poetry 900 \
11+
# Enable tab completion for bash
12+
&& poetry completions bash >> /home/vscode/.bash_completion \
13+
# Enable tab completion for Zsh
14+
&& mkdir -p /home/vscode/.zfunc/ \
15+
&& poetry completions zsh > /home/vscode/.zfunc/_poetry \
16+
&& echo "fpath+=~/.zfunc\nautoload -Uz compinit && compinit" >> /home/vscode/.zshrc
17+
18+
COPY pyproject.toml poetry.lock ./
19+
RUN poetry config virtualenvs.create false \
20+
&& poetry install --no-root --no-interaction --with integration --extras "aca-py" \
21+
&& rm -rf /root/.cache/pypoetry
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/python
3+
{
4+
"name": "cache_redis",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
"context": "..",
8+
"args": {
9+
"VARIANT": "3.12-bookworm",
10+
"POETRY_VERSION": "2.1.2"
11+
}
12+
},
13+
"customizations": {
14+
"vscode": {
15+
"extensions": ["ms-python.python", "ms-python.vscode-pylance"],
16+
"settings": {
17+
"python.testing.pytestArgs": ["./cache_redis", "--no-cov"],
18+
"python.testing.unittestEnabled": false,
19+
"python.testing.pytestEnabled": true,
20+
"python.testing.pytestPath": "pytest",
21+
"editor.defaultFormatter": null,
22+
"editor.formatOnSave": false, // enable per language
23+
"[python]": {
24+
"editor.formatOnSave": true,
25+
"editor.codeActionsOnSave": {
26+
"source.fixAll": true,
27+
"source.organizeImports": true
28+
},
29+
"editor.defaultFormatter": "charliermarsh.ruff",
30+
"ruff.organizeImports": true
31+
},
32+
"ruff.codeAction.fixViolation": {
33+
"enable": true
34+
},
35+
"ruff.fixAll": true,
36+
"ruff.format.args": ["--config=./pyproject.toml"],
37+
"ruff.lint.args": ["--config=./pyproject.toml"]
38+
}
39+
}
40+
},
41+
42+
"features": {
43+
"ghcr.io/devcontainers/features/docker-in-docker:2": {
44+
"moby": false
45+
}
46+
},
47+
48+
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
49+
"remoteUser": "vscode",
50+
51+
"remoteEnv": {
52+
"RUST_LOG": "aries-askar::log::target=error"
53+
},
54+
55+
"mounts": [],
56+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
57+
"forwardPorts": [3000, 3001],
58+
"postCreateCommand": "bash ./.devcontainer/post-install.sh"
59+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
set -ex
3+
4+
# Convenience workspace directory for later use
5+
WORKSPACE_DIR=$(pwd)
6+
7+
# install all ACA-Py requirements
8+
python -m pip install --upgrade pip

cache_redis/.gitignore

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
###
31+
### Visual Studio Code
32+
###
33+
34+
.vscode/
35+
36+
# PyInstaller
37+
# Usually these files are written by a python script from a template
38+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
39+
*.manifest
40+
*.spec
41+
42+
# Installer logs
43+
pip-log.txt
44+
pip-delete-this-directory.txt
45+
46+
# Unit test / coverage reports
47+
htmlcov/
48+
.tox/
49+
.nox/
50+
.coverage
51+
.coverage.*
52+
.cache
53+
nosetests.xml
54+
coverage.xml
55+
*.cover
56+
*.py,cover
57+
.hypothesis/
58+
.pytest_cache/
59+
60+
# Translations
61+
*.mo
62+
*.pot
63+
64+
# Django stuff:
65+
*.log
66+
local_settings.py
67+
db.sqlite3
68+
db.sqlite3-journal
69+
70+
# Flask stuff:
71+
instance/
72+
.webassets-cache
73+
74+
# Scrapy stuff:
75+
.scrapy
76+
77+
# Sphinx documentation
78+
docs/_build/
79+
80+
# PyBuilder
81+
target/
82+
83+
# Jupyter Notebook
84+
.ipynb_checkpoints
85+
86+
# IPython
87+
profile_default/
88+
ipython_config.py
89+
90+
# pyenv
91+
.python-version
92+
93+
# pipenv
94+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
95+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
96+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
97+
# install all needed dependencies.
98+
#Pipfile.lock
99+
100+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
101+
__pypackages__/
102+
103+
# Celery stuff
104+
celerybeat-schedule
105+
celerybeat.pid
106+
107+
# SageMath parsed files
108+
*.sage.py
109+
110+
# Environments
111+
.env
112+
.venv
113+
env/
114+
venv/
115+
ENV/
116+
env.bak/
117+
venv.bak/
118+
119+
# Spyder project settings
120+
.spyderproject
121+
.spyproject
122+
123+
# Rope project settings
124+
.ropeproject
125+
126+
# mkdocs documentation
127+
/site
128+
129+
# mypy
130+
.mypy_cache/
131+
.dmypy.json
132+
dmypy.json
133+
134+
# Pyre type checker
135+
.pyre/

0 commit comments

Comments
 (0)