From 149934b730e5aa3dabc2a3b0200c175996c6da3f Mon Sep 17 00:00:00 2001 From: Ida Date: Wed, 20 May 2026 13:12:23 +0200 Subject: [PATCH] fix: test script --- .forgejo/workflows/deploy.yml | 44 ++++++++++++++++++++++------------- tests/conftest.py | 2 -- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/.forgejo/workflows/deploy.yml b/.forgejo/workflows/deploy.yml index a0169d2e..bffd9eff 100644 --- a/.forgejo/workflows/deploy.yml +++ b/.forgejo/workflows/deploy.yml @@ -4,18 +4,29 @@ on: branches: - main jobs: - test: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Dependencies installieren - run: pip3 install -r requirements.txt --no-cache-dir - - - name: Tests ausführen - run: pytest tests/ -v + - name: Tests auf Infomaniak VM + env: + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + run: | + mkdir -p ~/.ssh + echo "$SSH_PRIVATE_KEY" > ~/.ssh/deploy_key + chmod 600 ~/.ssh/deploy_key + echo "StrictHostKeyChecking=no" >> ~/.ssh/config + echo "UserKnownHostsFile=/dev/null" >> ~/.ssh/config + ssh -i ~/.ssh/deploy_key ubuntu@api.poweron.swiss " + set -e + cd /srv/gateway/current + git remote set-url origin ssh://git@git.poweron.swiss:2222/PowerOn/plattform-core.git + git pull + cp env-gateway-prod-forgejo.env .env + rm -f env-*.env + source .venv/bin/activate + pip install -r requirements.txt --no-cache-dir + python -m pytest tests/ -v + " deploy: runs-on: ubuntu-latest @@ -31,12 +42,13 @@ jobs: echo "StrictHostKeyChecking=no" >> ~/.ssh/config echo "UserKnownHostsFile=/dev/null" >> ~/.ssh/config ssh -i ~/.ssh/deploy_key ubuntu@api.poweron.swiss " - cd /srv/gateway/current && - git remote set-url origin ssh://git@git.poweron.swiss:2222/PowerOn/plattform-core.git && - git pull && - cp env-gateway-prod-forgejo.env .env && - rm -f env-*.env && - source .venv/bin/activate && - pip install -r requirements.txt --no-cache-dir && + set -e + cd /srv/gateway/current + git remote set-url origin ssh://git@git.poweron.swiss:2222/PowerOn/plattform-core.git + git pull + cp env-gateway-prod-forgejo.env .env + rm -f env-*.env + source .venv/bin/activate + pip install -r requirements.txt --no-cache-dir sudo systemctl restart gateway " \ No newline at end of file diff --git a/tests/conftest.py b/tests/conftest.py index cb1cfb1f..9a70b5e0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,11 +6,9 @@ Ensures proper Python path setup for importing modules. """ import sys -import os from pathlib import Path # Add gateway directory to Python path gateway_dir = Path(__file__).parent.parent if str(gateway_dir) not in sys.path: sys.path.insert(0, str(gateway_dir)) -