From 01b979298eb48a470261045840a7d35605332fa7 Mon Sep 17 00:00:00 2001 From: Arthur L <18040415+alouradou@users.noreply.github.com> Date: Mon, 25 Mar 2024 20:39:46 +0100 Subject: [PATCH] Changed CI --- .github/workflows/auto-deploy.yml | 34 +++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/.github/workflows/auto-deploy.yml b/.github/workflows/auto-deploy.yml index 5e6d669..b1e184c 100644 --- a/.github/workflows/auto-deploy.yml +++ b/.github/workflows/auto-deploy.yml @@ -25,17 +25,6 @@ jobs: source serenadoit/bin/activate pip install -r requirements.txt - - name: Run database initialization - run: | - cd /home/oignon/node/static/uploads/ - python db_manager.py - - - name: Run tests - run: | - cd tests - python -m unittest discover -s . -p 'test_*.py' - - deploy: name: Deploy to Server runs-on: ubuntu-latest @@ -57,6 +46,29 @@ jobs: rm -rf ~/node/static/styles/ ~/node/static/scripts/ ~/node/static/images/ cp -r ./static ~/node/ + - name: Initialize database + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.SERVER_HOST }} + username: ${{ secrets.SERVER_USERNAME }} + key: ${{ secrets.SERVER_SSH_KEY }} + port: ${{ secrets.SERVER_PORT }} + script: | + cd ~/node/static/uploads/ + python db_manager.py + + - name: Test python code + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.SERVER_HOST }} + username: ${{ secrets.SERVER_USERNAME }} + key: ${{ secrets.SERVER_SSH_KEY }} + port: ${{ secrets.SERVER_PORT }} + script: | + cd serenadoit + source serenadoit/bin/activate + python -m unittest discover -s tests -p 'test_*.py' + - name: Install dependencies and restart server uses: appleboy/ssh-action@master with: