Skip to content
This repository was archived by the owner on Feb 14, 2026. It is now read-only.
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
24 changes: 12 additions & 12 deletions .github/workflows/python-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ jobs:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install poetry
poetry install --with test --no-root
python-version-file: ".python-version"
- name: Install test dependencies
run: uv sync --group test
- name: Test with pytest - ${{ matrix.python-version }}
run: |
poetry run pytest -s --cov=. --cov-branch --cov-report=xml -v
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
run: uv run pytest -s --cov=. --cov-branch --cov-report=xml -v
# Please uncomment this if your organization uses Codecov test coverage!
# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v5
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
35 changes: 35 additions & 0 deletions .github/workflows/update-uv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: update-uv

on:
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
lock:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: astral-sh/setup-uv@v3

- run: |
echo "\`\`\`" > uv_output.md
uv lock --upgrade 2>&1 | tee -a uv_output.md
echo "\`\`\`" >> uv_output.md

- name: Create pull request
uses: peter-evans/create-pull-request@v7
with:
committer: hacktobeer <ramsesdebeer@gmail.com>
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update uv lockfile
title: Update uv lockfile
body-path: uv_output.md
branch: update-uv
base: main
labels: install
delete-branch: true
add-paths: uv.lock
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
25 changes: 15 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,30 @@ RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selectio

# Install poetry and binutils (strings)
RUN apt-get update && apt-get install -y --no-install-recommends \
python3-poetry \
curl \
binutils \
&& rm -rf /var/lib/apt/lists/*

# Configure poetry
ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache

# Set working directory
WORKDIR /openrelik

# Install the latest uv binaries
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

# Copy poetry toml and uv.lock
COPY uv.lock pyproject.toml ./

# Install the project's dependencies using the lockfile and settings
RUN uv sync --locked --no-install-project --no-dev

# Copy files needed to build
COPY . ./

# Install the worker and set environment to use the correct python interpreter.
RUN poetry install && rm -rf $POETRY_CACHE_DIR
ENV VIRTUAL_ENV=/app/.venv PATH="/openrelik/.venv/bin:$PATH"
# Installing separately from its dependencies allows optimal layer caching
RUN uv sync --locked --no-dev

# Set PATH to use the virtual environment
ENV PATH="/openrelik/.venv/bin:$PATH"

# Default command if not run from docker-compose (and command being overidden)
CMD ["celery", "--app=src.tasks", "worker", "--task-events", "--concurrency=1", "--loglevel=INFO"]
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ openrelik-worker-strings:
- /path/to/your/artifacts:/path/to/your/artifacts
command: "celery --app=src.app worker --task-events --concurrency=4 --loglevel=INFO -Q openrelik-worker-strings"
```
## Test
```
uv sync --group test
uv run pytest -s --cov=.
```
1,756 changes: 0 additions & 1,756 deletions poetry.lock

This file was deleted.

30 changes: 16 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
[tool.poetry]
[project]
name = "openrelik-worker-strings"
version = "0.2.1"
description = "Extract strings from files"
authors = ["Johan Berggren <jberggren@gmail.com>"]
license = "Apache 2.0"
authors = [{ name = "Johan Berggren", email = "jberggren@gmail.com" }]
requires-python = ">=3.11,<4"
readme = "README.md"
package-mode = false
license = "Apache 2.0"
dependencies = [
"celery[redis]>=5.4.0,<6",
"openrelik-worker-common>=0.17.1",
"openrelik-common>=0.7.3",
]

[tool.poetry.dependencies]
python = "^3.11"
celery = { extras = ["redis"], version = "^5.4.0" }
openrelik-worker-common = "^0.17.1"
openrelik-common = "^0.7.3"
[dependency-groups]
test = ["pytest", "pytest-cov>=5.0.0,<6"]

[tool.poetry.group.test.dependencies]
pytest = "*"
pytest-cov = "^5.0.0"
[tool.uv]
package = false
default-groups = ["test"]

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
requires = ["uv_build>=0.9.0,<0.10.0"]
build-backend = "uv_build"
Loading