generated from Arquisoft/wiq_0
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
132 changed files
with
4,178 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,28 +3,48 @@ on: | |
push: | ||
branches: | ||
- master | ||
- develop | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
jobs: | ||
unit-tests: | ||
backend-tests: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: syg-backend | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v4 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@v4 | ||
java-version: '17' | ||
distribution: 'temurin' | ||
cache: maven | ||
|
||
- name: Build with Maven | ||
run: mvn clean verify | ||
|
||
# Mover el reporte de cobertura a la raíz del proyecto | ||
# - name: Move coverage report to project root | ||
# run: | | ||
# mkdir -p coverage | ||
# cp -r SYG-bootstrap/target/site/jacoco-aggregate/jacoco.csv coverage/ | ||
# cp -r SYG-bootstrap/target/site/jacoco-aggregate/index.html coverage/ | ||
|
||
# - name: Configurar Git para el commit | ||
# run: | | ||
# git config --global user.name "AlvaroGlezC" | ||
# git config --global user.email "[email protected]" | ||
|
||
# - name: Hacer commit y push de la cobertura | ||
# run: | | ||
# git add -f coverage | ||
# git commit -m "Agregar reporte de cobertura" | ||
# git push | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
node-version: 20 | ||
- run: npm --prefix users/authservice ci | ||
- run: npm --prefix users/userservice ci | ||
- run: npm --prefix gatewayservice ci | ||
- run: npm --prefix webapp ci | ||
- run: npm --prefix users/authservice test -- --coverage | ||
- run: npm --prefix users/userservice test -- --coverage | ||
- run: npm --prefix gatewayservice test -- --coverage | ||
- run: npm --prefix webapp test -- --coverage | ||
- name: Analyze with SonarCloud | ||
uses: sonarsource/sonarcloud-github-action@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
files: SYG-bootstrap/target/site/jacoco-aggregate/jacoco.xml | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
syg-backend/SYG-bootstrap/src/test/java/syg/bootstrap/SYGdbContainer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package syg.bootstrap; | ||
|
||
import org.springframework.test.context.DynamicPropertyRegistry; | ||
import org.springframework.test.context.DynamicPropertySource; | ||
import org.testcontainers.containers.MySQLContainer; | ||
import org.testcontainers.junit.jupiter.Testcontainers; | ||
import org.testcontainers.utility.DockerImageName; | ||
|
||
/** | ||
* Test que arranca un contenedor con una base de datos mySQL. | ||
* | ||
* Dado que los tests se ejecutan en un contexto transaccional no se afectan | ||
* unos a otros. | ||
* | ||
* | ||
* Los datos iniciales se cargan de una imagen. | ||
* | ||
*/ | ||
@Testcontainers | ||
public abstract class SYGdbContainer { | ||
|
||
static final MySQLContainer<?> sygdbContainer; | ||
|
||
static { | ||
sygdbContainer = new MySQLContainer<>( | ||
DockerImageName.parse("mysql:8.0.36").asCompatibleSubstituteFor("mysql")) | ||
.withDatabaseName("syg-db") | ||
.withUsername("sygAdmin") | ||
.withPassword("sygAdmin") | ||
.withInitScript("db/initial-data-bootstrap.sql"); | ||
sygdbContainer.start(); | ||
} | ||
|
||
/** | ||
* Asignamos las propiedades del DataSource de Spring utilizando las del | ||
* contenedor | ||
*/ | ||
@DynamicPropertySource | ||
static void mysqlProperties(DynamicPropertyRegistry registry) { | ||
registry.add("spring.datasource.url", sygdbContainer::getJdbcUrl); | ||
registry.add("spring.datasource.password", sygdbContainer::getPassword); | ||
registry.add("spring.datasource.username", sygdbContainer::getUsername); | ||
registry.add("spring.datasource.driver-class-name", sygdbContainer::getDriverClassName); | ||
} | ||
|
||
} |
Oops, something went wrong.