diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..03fb13b --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,81 @@ +name: CI/CD Pipeline + +on: + push: + branches: [ main, develop ] + pull_request: + branches: [ main ] + +jobs: + test: + runs-on: host + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + cache: 'npm' + + # Backend tests + - name: Install backend dependencies + run: | + cd backend + npm ci + + - name: Run backend linting + run: | + cd backend + npm run lint + + - name: Run backend tests + env: + DATABASE_URL: postgresql://postgres:postgres@localhost:5432/nfoguard_test + JWT_SECRET: test-secret-key-for-ci + NODE_ENV: test + run: | + cd backend + npm run test + + # Frontend tests + - name: Install frontend dependencies + run: | + cd frontend + npm ci + + - name: Run frontend linting + run: | + cd frontend + npm run lint + + - name: Run frontend tests + run: | + cd frontend + npm run test + + - name: Build frontend + run: | + cd frontend + npm run build + + deploy: + needs: test + runs-on: host + if: github.ref == 'refs/heads/main' + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Deploy application + run: | + echo "Deploying to production..." + # Add your deployment commands here + # Examples: + # docker-compose down + # docker-compose pull + # docker-compose up -d + # or systemctl restart nfoguard \ No newline at end of file