Skip to content

Commit 135cffe

Browse files
committed
E2E step
1 parent fbf305f commit 135cffe

4 files changed

Lines changed: 79 additions & 10 deletions

File tree

.github/workflows/ci-pipeline.yml

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ on:
1010
workflow_dispatch:
1111

1212
jobs:
13-
14-
build-test:
13+
build-tests:
1514
name: Build & Unit Tests
1615
runs-on: ubuntu-latest
1716
steps:
@@ -46,9 +45,10 @@ jobs:
4645
-Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml \
4746
-Dsonar.exclusions=**/*Application.java
4847
49-
integration-test:
50-
name: Integration Tests
48+
mutation-tests:
49+
name: Mutation Tests
5150
runs-on: ubuntu-latest
51+
needs: build-tests
5252
steps:
5353
- name: Checkout Code
5454
uses: actions/checkout@v3
@@ -67,13 +67,13 @@ jobs:
6767
restore-keys: |
6868
${{ runner.os }}-m2-
6969
70-
- name: Build and run integration tests
70+
- name: Build and run mutation tests
7171
run: |
7272
export MAVEN_OPTS="-Djansi.force=true"
73-
mvn -B clean verify -DskipUTs=true
73+
mvn -B clean test-compile org.pitest:pitest-maven:mutationCoverage -DwithHistory
7474
75-
mutation-test:
76-
name: Mutation Tests
75+
integration-tests:
76+
name: Integration Tests
7777
runs-on: ubuntu-latest
7878
steps:
7979
- name: Checkout Code
@@ -93,7 +93,30 @@ jobs:
9393
restore-keys: |
9494
${{ runner.os }}-m2-
9595
96-
- name: Build and run mutation tests
96+
- name: Build and run integration tests
9797
run: |
9898
export MAVEN_OPTS="-Djansi.force=true"
99-
mvn -B clean test-compile org.pitest:pitest-maven:mutationCoverage -DwithHistory
99+
mvn -B clean verify -DskipUTs=true
100+
101+
e2e-tests:
102+
name: End-to-End Tests
103+
runs-on: ubuntu-latest
104+
needs: integration-tests
105+
steps:
106+
- name: Checkout Code
107+
uses: actions/checkout@v3
108+
109+
- name: Set Up Docker Compose
110+
run: docker-compose up -d
111+
112+
- name: Wait for Services to be Ready
113+
run: sleep 30
114+
115+
- name: Install Newman
116+
run: npm install -g newman
117+
118+
- name: Run E2E Tests with Newman
119+
run: newman run ./e2e/collection.json
120+
121+
- name: Tear Down Docker Compose
122+
run: docker-compose down

Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Usa una imagen base con JDK
2+
FROM maven:3.8-openjdk-11 AS build
3+
4+
# Establece el directorio de trabajo
5+
WORKDIR /app
6+
7+
# Copia el código fuente al contenedor
8+
COPY . /app
9+
10+
# Ejecuta Maven para compilar y empaquetar la aplicación
11+
RUN mvn clean install -DskipTests
12+
13+
# Usa una imagen más ligera para la ejecución
14+
FROM openjdk:11-jre-slim
15+
16+
# Establece el directorio de trabajo
17+
WORKDIR /app
18+
19+
# Copia el artefacto generado desde la fase de construcción
20+
COPY --from=build /app/target/code-quality-testing.jar /app/code-quality-testing.jar
21+
22+
# Expone el puerto en el que la aplicación corre
23+
EXPOSE 8080
24+
25+
# Comando para ejecutar la aplicación
26+
ENTRYPOINT ["java", "-jar", "/app/code-quality-testing.jar"]

docker-compose.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: '3.8'
2+
3+
services:
4+
app:
5+
build: .
6+
container_name: code-quality-testing
7+
ports:
8+
- "8080:8080"
9+
networks:
10+
- app-network
11+
depends_on:
12+
- db # Dependencia de la base de datos
13+
restart: always
14+
15+
networks:
16+
app-network:
17+
driver: bridge
18+
19+
volumes:
20+
db-data:

e2e/CodeQualityTesting.postman_collection.json renamed to e2e/collection.json

File renamed without changes.

0 commit comments

Comments
 (0)