fix: test script
This commit is contained in:
parent
3725ca1a02
commit
149934b730
2 changed files with 28 additions and 18 deletions
|
|
@ -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
|
||||
"
|
||||
|
|
@ -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))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue