ci: Add Gitea Actions workflow for CI/CD (Refs #2)
This commit is contained in:
65
.gitea/workflows/ci.yml
Normal file
65
.gitea/workflows/ci.yml
Normal file
@@ -0,0 +1,65 @@
|
||||
name: CI/CD Pipeline
|
||||
|
||||
# Triggers: push to main and pull requests to main
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
# Backend build job
|
||||
backend-build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup .NET 10
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 10.x
|
||||
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore Backend/PruebaGentle.slnx
|
||||
|
||||
- name: Build backend
|
||||
run: dotnet build Backend/PruebaGentle.slnx --configuration Release
|
||||
|
||||
# Frontend build job
|
||||
frontend-build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js 22
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22.x
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
working-directory: Frontend
|
||||
|
||||
- name: Build frontend
|
||||
run: npm run build
|
||||
working-directory: Frontend
|
||||
|
||||
- name: Run tests
|
||||
run: npm run test:run
|
||||
working-directory: Frontend
|
||||
|
||||
# Docker build job (depends on backend and frontend builds)
|
||||
docker-build:
|
||||
needs: [backend-build, frontend-build]
|
||||
runs-on: ubuntu-latest
|
||||
if: github.ref == 'refs/heads/main'
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build Docker images
|
||||
run: docker-compose build
|
||||
Reference in New Issue
Block a user