Skip to content
Open
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
40 changes: 40 additions & 0 deletions .github/workflows/backend-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Backend Lint

on:
push:
branches: ["master"]
paths:
- "tracker/backend/**"
- ".github/workflows/backend-lint.yml"
pull_request:
branches: ["master"]
paths:
- "tracker/backend/**"
- ".github/workflows/backend-lint.yml"

jobs:
ruff:
name: Ruff Lint & Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.14"

- name: Install uv
run: pip install uv

- name: Sync dependencies
run: uv sync --frozen
working-directory: tracker/backend

- name: Ruff check
run: uv run ruff check .
working-directory: tracker/backend

- name: Ruff format check
run: uv run ruff format --check .
working-directory: tracker/backend
136 changes: 136 additions & 0 deletions .github/workflows/backend-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
name: Backend Tests

on:
push:
branches: ["master"]
paths:
- "tracker/backend/**"
- ".github/workflows/backend-test.yml"
pull_request:
branches: ["master"]
paths:
- "tracker/backend/**"
- ".github/workflows/backend-test.yml"

jobs:
unit-tests:
name: Unit Tests (Python ${{ matrix.python }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ["3.14"]
steps:
- uses: actions/checkout@v6

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: Install uv
run: pip install uv

- name: Sync dependencies
run: uv sync --frozen
working-directory: tracker/backend

- name: Run unit tests
run: uv run pytest tests/unit -v --no-cov
working-directory: tracker/backend

integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
services:
redis:
image: redis:7.4.3-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.14"

- name: Install uv
run: pip install uv

- name: Sync dependencies
run: uv sync --frozen
working-directory: tracker/backend

- name: Run integration tests
run: uv run pytest tests/integration -v --no-cov -m integration
working-directory: tracker/backend
env:
REDIS_URI: redis://localhost:6379/0

compatibility-tests:
name: BEP Protocol Compatibility
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.14"

- name: Install uv
run: pip install uv

- name: Sync dependencies
run: uv sync --frozen
working-directory: tracker/backend

- name: Run compatibility tests
run: uv run pytest tests/compatibility -v --no-cov
working-directory: tracker/backend

coverage:
name: Coverage Report
runs-on: ubuntu-latest
services:
redis:
image: redis:7.4.3-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.14"

- name: Install uv
run: pip install uv

- name: Sync dependencies
run: uv sync --frozen
working-directory: tracker/backend

- name: Run full test suite with coverage
run: uv run pytest tests/ -v
working-directory: tracker/backend
env:
REDIS_URI: redis://localhost:6379/0

- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: tracker/backend/coverage.xml
108 changes: 108 additions & 0 deletions .github/workflows/inspirations-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Inspirations Compatibility Check

on:
push:
branches: ["master"]
paths:
- "tracker/inspirations/**"
- ".github/workflows/inspirations-check.yml"
pull_request:
branches: ["master"]
paths:
- "tracker/inspirations/**"
- ".github/workflows/inspirations-check.yml"
schedule:
- cron: "0 6 * * 1" # Weekly Monday 6am UTC

jobs:
check-libtorrent:
name: Check libtorrent Tracker Compatibility
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
depth: 0 # Need full history for inspirations

- name: Verify libtorrent tracker manager exists
run: |
test -f tracker/inspirations/libtorrent/src/tracker_manager.cpp
echo "libtorrent tracker_manager.cpp found"

- name: Check libtorrent HTTP tracker protocol
run: |
grep -l "http_tracker" tracker/inspirations/libtorrent/src/ || true
echo "libtorrent HTTP tracker protocol reference found"

- name: Check libtorrent UDP tracker protocol
run: |
grep -l "udp_tracker" tracker/inspirations/libtorrent/src/ || true
echo "libtorrent UDP tracker protocol reference found"

check-go-torrent:
name: Check Go torrent Tracker Compatibility
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
depth: 0

- name: Verify Go torrent tracker server
run: |
test -f tracker/inspirations/torrent/tracker/server/server.go
echo "Go torrent tracker server found"

- name: Check Go torrent HTTP announce handler
run: |
grep -l "AnnounceHandler" tracker/inspirations/torrent/tracker/ || true
echo "Go torrent AnnounceHandler found"

- name: Check Go torrent UDP tracker
run: |
test -f tracker/inspirations/torrent/tracker/udp/server/server.go
echo "Go torrent UDP tracker server found"

check-webtorrent:
name: Check WebTorrent Compatibility
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
depth: 0

- name: Verify WebTorrent exists
run: |
test -f tracker/inspirations/webtorrent/index.js
echo "WebTorrent entry point found"

- name: Check WebTorrent WebSocket protocol
run: |
grep -l "websocket" tracker/inspirations/webtorrent/ || true
echo "WebTorrent WebSocket protocol reference found"

- name: Check WebTorrent WebRTC support
run: |
grep -l "webrtc" tracker/inspirations/webtorrent/ || true
echo "WebTorrent WebRTC support found"

cross-reference-protocols:
name: Cross-Reference Protocol Implementations
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
depth: 0

- name: Verify BEP15 UDP constants match
run: |
echo "Checking CONNECTION_ID alignment with BEP15"
grep -r "CONNECTION_ID" tracker/backend/coreproject_tracker/constants/

- name: Verify BEP3 HTTP announce params
run: |
echo "Checking HTTP announce parameter names"
grep -r "info_hash" tracker/backend/coreproject_tracker/servers/

- name: Verify bencode response format
run: |
echo "Checking bencode usage"
grep -r "bencodepy" tracker/backend/coreproject_tracker/
Loading
Loading