Skip to content

Commit 451a04e

Browse files
committed
fix ci(7)
1 parent eca9807 commit 451a04e

File tree

11 files changed

+536
-31
lines changed

11 files changed

+536
-31
lines changed

.dockerignore

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Git
2+
.git
3+
.gitignore
4+
5+
# Python
6+
__pycache__/
7+
*.py[cod]
8+
*$py.class
9+
*.so
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+
*.egg-info/
24+
.installed.cfg
25+
*.egg
26+
MANIFEST
27+
28+
# Virtual environments
29+
.env
30+
.venv
31+
env/
32+
venv/
33+
ENV/
34+
env.bak/
35+
venv.bak/
36+
.venv312/
37+
38+
# Testing
39+
.tox/
40+
.nox/
41+
.coverage
42+
.pytest_cache/
43+
htmlcov/
44+
.coverage.*
45+
coverage.xml
46+
*.cover
47+
.hypothesis/
48+
49+
# Jupyter Notebook
50+
.ipynb_checkpoints
51+
52+
# IPython
53+
profile_default/
54+
ipython_config.py
55+
56+
# pyenv
57+
.python-version
58+
59+
# Rust
60+
target/
61+
*.pdb
62+
63+
# IDE
64+
.vscode/
65+
.idea/
66+
*.swp
67+
*.swo
68+
*~
69+
70+
# OS
71+
.DS_Store
72+
.DS_Store?
73+
._*
74+
.Spotlight-V100
75+
.Trashes
76+
ehthumbs.db
77+
Thumbs.db
78+
79+
# Documentation
80+
docs/_build/
81+
.readthedocs.yml
82+
mkdocs.yml
83+
.mkdocs.yml
84+
85+
# CI/CD
86+
.github/
87+
.travis.yml
88+
.appveyor.yml
89+
.circleci/
90+
91+
# Logs
92+
*.log
93+
django_logxide.log
94+
python.log
95+
96+
# Cache
97+
.ruff_cache/
98+
.mypy_cache/
99+
.pytype/
100+
101+
# Local development
102+
.pre-commit-config.yaml
103+
.pre-commit-hooks.yaml
104+
105+
# Benchmark results
106+
benchmark/results/
107+
benchmark/*.json
108+
109+
# Instance folder
110+
instance/
111+
112+
# Flask
113+
.flaskenv
114+
115+
# Test files
116+
test_*.py
117+
test_examples.py
118+
test_integration_examples.py
119+
120+
# Development scripts
121+
scripts/
122+
main.py
123+
124+
# Lock files (we'll copy them explicitly)
125+
poetry.lock
126+
Pipfile.lock

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ jobs:
4141

4242
- name: Install Python dependencies
4343
run: |
44-
python -m pip install --upgrade pip
45-
pip install maturin pytest pytest-cov pytest-xdist
44+
python -m pip install --upgrade uv
45+
uv pip install maturin pytest pytest-cov pytest-xdist
4646
4747
- name: Rust format check
4848
run: cargo fmt --all -- --check
@@ -83,8 +83,8 @@ jobs:
8383

8484
- name: Install dependencies
8585
run: |
86-
python -m pip install --upgrade pip
87-
pip install ruff pyright
86+
python -m pip install --upgrade uv
87+
uv pip install ruff pyright
8888
8989
- name: Run ruff
9090
run: ruff check .
@@ -118,8 +118,8 @@ jobs:
118118

119119
- name: Install maturin
120120
run: |
121-
python -m pip install --upgrade pip
122-
pip install maturin
121+
python -m pip install --upgrade uv
122+
uv pip install maturin
123123
124124
- name: Build wheels
125125
run: maturin build --release

Dockerfile

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# Multi-stage Dockerfile for logxide: Rust-Python hybrid project
2+
FROM rust:latest as rust-base
3+
4+
# Install system dependencies
5+
RUN apt-get update && apt-get install -y \
6+
build-essential \
7+
pkg-config \
8+
libssl-dev \
9+
python3 \
10+
python3-pip \
11+
python3-venv \
12+
curl \
13+
git \
14+
&& rm -rf /var/lib/apt/lists/*
15+
16+
# Install uv (fast Python package manager)
17+
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
18+
ENV PATH="/root/.local/bin:$PATH"
19+
20+
# Install Rust components including clippy
21+
RUN rustup component add clippy rustfmt
22+
23+
# Set working directory
24+
WORKDIR /app
25+
26+
# Copy Rust configuration files
27+
COPY Cargo.toml Cargo.lock ./
28+
COPY clippy.toml ./
29+
30+
# Copy Python configuration files
31+
COPY pyproject.toml pyrightconfig.json ./
32+
33+
# Copy source code
34+
COPY src/ ./src/
35+
COPY logxide/ ./logxide/
36+
37+
# Copy additional project files
38+
COPY README.md LICENSE MANIFEST.in ./
39+
40+
# Check that Rust code compiles
41+
RUN cargo check
42+
43+
# Install Python packages system-wide for testing
44+
RUN pip3 install --break-system-packages maturin pytest pytest-cov ruff
45+
46+
# Create virtual environment for maturin development
47+
RUN python3 -m venv .venv && \
48+
.venv/bin/pip install --upgrade pip && \
49+
.venv/bin/pip install maturin
50+
51+
# Build the package
52+
RUN .venv/bin/maturin develop --release
53+
54+
# Copy remaining files
55+
COPY tests/ ./tests/
56+
COPY examples/ ./examples/
57+
COPY benchmark/ ./benchmark/
58+
59+
# Development stage for testing
60+
FROM rust-base as dev
61+
62+
# Install additional development tools
63+
RUN apt-get update && apt-get install -y \
64+
valgrind \
65+
strace \
66+
&& rm -rf /var/lib/apt/lists/*
67+
68+
# Set environment variables for development
69+
ENV PYTHONPATH=/app
70+
ENV RUST_LOG=debug
71+
ENV RUST_BACKTRACE=1
72+
73+
# Default command for development
74+
CMD ["bash"]
75+
76+
# Test stage
77+
FROM dev as test
78+
79+
# Run Rust tests
80+
RUN cargo test --release
81+
82+
# Run Python tests
83+
RUN python3 -m pytest -v --cov=logxide --cov-report=term-missing
84+
85+
# Lint and format checks
86+
RUN python3 -m ruff check .
87+
RUN python3 -m ruff format --check .
88+
89+
# Type checking (skipped due to dependency issues)
90+
# RUN .venv/bin/pyright
91+
92+
# Build stage for production package
93+
FROM rust-base as build
94+
95+
# Build wheel
96+
RUN .venv/bin/maturin build --release --out dist/
97+
98+
# Production stage
99+
FROM python:3.11-slim as production
100+
101+
# Install system dependencies needed at runtime
102+
RUN apt-get update && apt-get install -y \
103+
libssl3 \
104+
&& rm -rf /var/lib/apt/lists/*
105+
106+
# Copy built wheel from build stage
107+
COPY --from=build /app/dist/ /wheels/
108+
109+
# Install the package
110+
RUN pip install /wheels/*.whl
111+
112+
# Set up non-root user
113+
RUN useradd -m -u 1000 logxide
114+
USER logxide
115+
116+
# Set working directory
117+
WORKDIR /home/logxide
118+
119+
# Default command
120+
CMD ["python", "-c", "import logxide; print(f'logxide version: {logxide.__version__}')"]

docker-compose.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
services:
2+
# Development environment
3+
dev:
4+
build:
5+
context: .
6+
dockerfile: Dockerfile
7+
target: dev
8+
volumes:
9+
- .:/app
10+
- cargo-cache:/usr/local/cargo/registry
11+
- target-cache:/app/target
12+
environment:
13+
- RUST_LOG=debug
14+
- RUST_BACKTRACE=1
15+
- PYTHONPATH=/app
16+
working_dir: /app
17+
stdin_open: true
18+
tty: true
19+
command: bash
20+
21+
# Test runner
22+
test:
23+
build:
24+
context: .
25+
dockerfile: Dockerfile
26+
target: test
27+
volumes:
28+
- .:/app
29+
- cargo-cache:/usr/local/cargo/registry
30+
- target-cache:/app/target
31+
environment:
32+
- RUST_LOG=info
33+
- RUST_BACKTRACE=1
34+
- PYTHONPATH=/app
35+
command: >
36+
bash -c "
37+
echo 'Running Rust tests...' &&
38+
cargo test --release &&
39+
echo 'Running Rust clippy...' &&
40+
cargo clippy --all-targets --all-features -- -D warnings &&
41+
echo 'Running Python tests...' &&
42+
python3 -m pytest -v --cov=logxide --cov-report=term-missing &&
43+
echo 'Running code quality checks...' &&
44+
python3 -m ruff check . &&
45+
python3 -m ruff format --check . &&
46+
echo 'All tests passed!'
47+
"
48+
49+
# Package builder
50+
build:
51+
build:
52+
context: .
53+
dockerfile: Dockerfile
54+
target: build
55+
volumes:
56+
- ./dist:/app/dist
57+
- cargo-cache:/usr/local/cargo/registry
58+
- target-cache:/app/target
59+
environment:
60+
- RUST_LOG=info
61+
62+
# Production image
63+
prod:
64+
build:
65+
context: .
66+
dockerfile: Dockerfile
67+
target: production
68+
environment:
69+
- PYTHONPATH=/home/logxide
70+
71+
# Benchmark runner with .venv312
72+
benchmark:
73+
build:
74+
context: .
75+
dockerfile: Dockerfile
76+
target: dev
77+
volumes:
78+
- .:/app
79+
- cargo-cache:/usr/local/cargo/registry
80+
- target-cache:/app/target
81+
environment:
82+
- RUST_LOG=info
83+
- PYTHONPATH=/app
84+
working_dir: /app
85+
command: >
86+
bash -c "
87+
python3.12 -m venv .venv312 &&
88+
source .venv312/bin/activate &&
89+
pip install -e . &&
90+
python benchmark/run_benchmarks.py
91+
"
92+
93+
volumes:
94+
cargo-cache:
95+
target-cache:

0 commit comments

Comments
 (0)