diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 89d2a79..9ae1357 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,24 @@ permissions: packages: write jobs: + ci: + name: Verify CI passes + runs-on: [self-hosted, linux, x64] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + cache: 'pip' + - name: Install dependencies + run: pip install -r requirements.txt -r requirements-dev.txt --quiet + - name: Lint + run: ruff check . && ruff format --check . + - name: Test + run: pytest + release: + needs: ci name: Bump version and release runs-on: [self-hosted, linux, x64] if: "!contains(github.event.head_commit.message, '[skip ci]')" diff --git a/app/main.py b/app/main.py index 66c4b65..2025915 100644 --- a/app/main.py +++ b/app/main.py @@ -796,6 +796,8 @@ async def api_deploy(request: Request, slug: str, body: DeployRequest, worker_id svc = catalog.get_service(slug) if not svc: raise HTTPException(status_code=404, detail=f"Service '{slug}' not found") + if svc.get("status") == "dead": + raise HTTPException(status_code=410, detail=f"Service '{slug}' is no longer available (dead/discontinued)") docker_conf = svc.get("docker", {}) image = docker_conf.get("image") diff --git a/docs/guides/peer2profit.md b/docs/guides/peer2profit.md index 8cad891..9563194 100644 --- a/docs/guides/peer2profit.md +++ b/docs/guides/peer2profit.md @@ -1,5 +1,8 @@ # Peer2Profit +> [!CAUTION] +> **Deprecated:** Peer2Profit is no longer operational and has been marked as dead in CashPilot. Deployment is blocked. This guide is kept for reference only. + > **Category:** Bandwidth Sharing | **Status:** Dead > **Website:** [https://peer2profit.com](https://peer2profit.com) diff --git a/requirements-dev.txt b/requirements-dev.txt index f362c0e..ca01fbc 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,4 +1,5 @@ pytest>=8.0 pytest-asyncio>=0.23 pytest-cov>=5.0 +ruff>=0.11.0 tzdata>=2024.1 diff --git a/tests/test_main_deploy_routes.py b/tests/test_main_deploy_routes.py index d1925e3..ede5a44 100644 --- a/tests/test_main_deploy_routes.py +++ b/tests/test_main_deploy_routes.py @@ -125,6 +125,17 @@ def test_deploy_no_image(self, client): resp = client.post("/api/deploy/grass", json={}) assert resp.status_code == 400 + def test_deploy_dead_service(self, client): + svc = {"slug": "peer2profit", "name": "Peer2Profit", "status": "dead", "docker": {"image": "x"}} + with ( + _auth_owner(), + patch("app.main.database.list_workers", new_callable=AsyncMock, return_value=[_online_worker()]), + patch("app.main.catalog.get_service", return_value=svc), + ): + resp = client.post("/api/deploy/peer2profit", json={}) + assert resp.status_code == 410 + assert "no longer available" in resp.json()["detail"] + def test_deploy_no_auth(self, client): with _no_auth(): resp = client.post("/api/deploy/honeygain", json={})