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
20 changes: 15 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

env:
PYTHON_VERSION: '3.14'

jobs:
release-setup:
name: Release Setup
Expand Down Expand Up @@ -48,14 +51,20 @@ jobs:
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Set up Python
id: setup-python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.14"
python-version: ${{ env.PYTHON_VERSION }}

- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true

- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install -e ".[dev]"
env:
UV_PYTHON: ${{ steps.setup-python.outputs.python-path }}
run: uv sync --locked --extra dev

- name: Test with pytest
id: test
Expand All @@ -75,7 +84,7 @@ jobs:
REDDIT_USERNAME: ${{ vars.REDDIT_USERNAME }}
REDDIT_PASSWORD: ${{ secrets.REDDIT_PASSWORD }}
shell: bash
run: python -m pytest tests
run: uv run --locked --extra dev pytest tests

- name: Upload test coverage
# any except canceled or skipped
Expand All @@ -85,6 +94,7 @@ jobs:
startsWith(github.repository, 'LizardByte/')
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
with:
files: coverage.xml
fail_ci_if_error: true
report_type: coverage
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .replit
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# The command that is executed when the run button is clicked.
run = ["python", "src/main.py"]
run = ["uv", "run", "--locked", "python", "-m", "src"]

# The default file opened in the editor.
entrypoint = "README.md"
Expand Down
11 changes: 7 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# syntax=docker/dockerfile:1
# artifacts: false
# platforms: linux/amd64
FROM python:3.14-slim-bookworm
FROM ghcr.io/astral-sh/uv:0.11-python3.14-trixie-slim

# CI args
ARG BRANCH
Expand All @@ -12,14 +12,17 @@ ARG COMMIT
ENV BRANCH=${BRANCH}
ENV BUILD_VERSION=${BUILD_VERSION}
ENV COMMIT=${COMMIT}
ENV UV_PROJECT_ENVIRONMENT=/opt/venv
ENV VIRTUAL_ENV=/opt/venv
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

VOLUME /data
WORKDIR /app/

# Copy only necessary files for installation and runtime
COPY pyproject.toml .
COPY pyproject.toml uv.lock README.md ./
COPY src/ src/
COPY assets/ assets/

Expand All @@ -44,11 +47,11 @@ __version__ = "${BUILD_VERSION}"
EOF

# install python dependencies
python -m pip install --no-cache-dir .
uv sync --frozen --no-dev --no-install-project --python python --no-python-downloads

# set ownership of app and data directories
mkdir -p /data
chown -R supportbot:supportbot /app /data
chown -R supportbot:supportbot /app /data "${VIRTUAL_ENV}"
_SETUP

# switch to non-root user
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,25 @@ platforms such as GitHub discussions/issues might be added in the future.
Install the project and its dependencies:

```bash
python -m pip install -e .
uv sync --locked
```

For development (includes test dependencies):

```bash
python -m pip install -e ".[dev]"
uv sync --locked --extra dev
```

Run tests:

```bash
uv run --locked --extra dev pytest
```

### Start

```bash
python -m src
uv run --locked python -m src
```

* Invite bot to server:
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ addopts = [
"--color=yes",
"--cov=src",
"--cov-report=term-missing",
"--cov-report=xml:coverage.xml",
"--junitxml=junit.xml",
"-o", "junit_family=legacy",
]
Expand Down
Loading
Loading