patch CSRF and CI
Some checks failed
ERP CI/CD Pipeline / test (push) Has been cancelled
ERP CI/CD Pipeline / Deploy (server git pull + compose) (push) Has been cancelled

This commit is contained in:
mariomitte
2026-07-10 23:00:06 +02:00
parent 88de1a503a
commit 4c9b6bba96
4 changed files with 69 additions and 16 deletions

View File

@@ -1,6 +1,24 @@
name: ERP CI Pipeline
name: ERP CI/CD Pipeline
on: [push, pull_request]
on:
push:
branches: [main, master]
paths:
- "backend/**"
- "frontend/**"
- "docker-compose*.yml"
- ".gitea/workflows/ci.yml"
pull_request:
branches: [main, master]
paths:
- "backend/**"
- "frontend/**"
- "docker-compose*.yml"
- ".gitea/workflows/ci.yml"
concurrency:
group: erp-${{ github.ref_name }}
cancel-in-progress: true
jobs:
test:
@@ -12,28 +30,42 @@ jobs:
POSTGRES_DB: erp_db
POSTGRES_PASSWORD: password
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: "3.11"
- name: Install dependencies
- name: Install deps
run: |
pip install -r backend/requirements.txt
pip install pytest pytest-django
- name: Run Unit Tests
- name: Run tests
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/erp_db
run: |
# Pokrećemo testove iz našeg backend direktorija
pytest backend/modules/invoicing/tests/test_services.py
pytest backend/modules/task_management/tests/test_services.py
- name: Run Task Management Tests
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/erp_db
run: |
pytest backend/modules/task_management/tests/test_services.py
deploy:
name: Deploy (server git pull + compose)
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master')
steps:
- name: SSH deploy
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
port: ${{ secrets.DEPLOY_PORT }}
script_stop: true
script: |
set -e
export DEPLOY_PATH="${{ secrets.DEPLOY_PATH }}"
export DEPLOY_BRANCH="${{ github.ref_name }}"
/usr/local/bin/erp-deploy.sh