1
0
Fork 0
mirror of https://codeberg.org/beerbrawl/beerbrawl.git synced 2024-09-23 01:30:52 +02:00

Merge branch 'refs/heads/development' into feat(#33)-image-upload-participants-ui

This commit is contained in:
Moritz Kepplinger 2024-06-25 22:34:00 +02:00
commit cdefaaf70f
14 changed files with 5166 additions and 149 deletions

View file

@ -3,6 +3,7 @@ image: maven:3-eclipse-temurin-21
variables:
GIT_STRATEGY: 'clone'
MAVEN_OPTS: '-Dmaven.repo.local=.m2'
MAVEN_ARGS: '--batch-mode --errors --fail-at-end --show-version'
cache:
paths:
@ -11,26 +12,53 @@ cache:
stages:
- test
- build
- visualize
- deploy
test-backend:
stage: test
script:
- cd backend
- mvn -B clean install
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent test org.jacoco:jacoco-maven-plugin:report
- cd target/site/jacoco/
- awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, " instructions covered"; print 100*covered/instructions, "% covered" }' jacoco.csv
coverage: /\d+.\d+ % covered/
artifacts:
paths:
- backend/target/site/jacoco/jacoco.xml
reports:
junit:
- backend/target/surefire-reports/TEST-*.xml
coverage-backend:
stage: visualize
image: haynes/jacoco2cobertura:1.0.10
script:
- cd backend
- 'python /opt/cover2cover.py target/site/jacoco/jacoco.xml src/main/java/ > target/site/coverage.xml'
needs:
- test-backend
dependencies:
- test-backend
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: backend/target/site/coverage.xml
test-and-build-frontend:
stage: test
image: registry.reset.inso-w.at/pub/docker/cypress:latest
script:
- cd frontend
- npm ci --legacy-peer-deps
- npm ci
- npm run lint
- npm run eslint:check
- npm run prettier:check
- npm run test:ci
- npm run build
- npm run openapi-clients:replace-base-path-for-prod
coverage: /^Statements\s*:\s*([^%]+)/
artifacts:
paths:
- frontend/dist
@ -41,16 +69,17 @@ e2e-test:
image: registry.reset.inso-w.at/pub/docker/cypress:latest
script:
- cd frontend
- npm ci --legacy-peer-deps
- npm ci
- npm run start &
- cd ../backend
- mvn -B clean install -DskipTests
- mvn clean install -DskipTests
- java -jar target/*.jar --spring.profiles.active=generateData &
- sleep 30
- cd ../e2e
- npm ci --legacy-peer-deps
- npm run prettier:check
- npx cypress run
- npm ci
- npm run cypress:ci
- npm run coverage:ci
coverage: /^Statements\s*:\s*([^%]+)/
artifacts:
when: always
expire_in: 1 hour
@ -78,8 +107,8 @@ build-image:
- mkdir -p backend/src/main/resources/static/
- cp -rv frontend/dist/sepr-group-phase/browser/* gitinspector.html backend/src/main/resources/static/
- cd backend
- mvn -B clean install -DskipTests
- mvn -B jib:build -Djib.to.image=registry.reset.inso-w.at/$CI_PROJECT_PATH -Djib.to.tags=$CI_PIPELINE_ID -Djib.to.auth.username=$CI_REGISTRY_USER -Djib.to.auth.password=$CI_REGISTRY_PASSWORD
- mvn clean install -DskipTests
- mvn jib:build -Djib.to.image=registry.reset.inso-w.at/$CI_PROJECT_PATH -Djib.to.tags=$CI_PIPELINE_ID -Djib.to.auth.username=$CI_REGISTRY_USER -Djib.to.auth.password=$CI_REGISTRY_PASSWORD
only:
- master

View file

@ -17,17 +17,19 @@
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven.compiler.plugin>3.13.0</maven.compiler.plugin>
<maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
<spring.boot.version>3.2.6</spring.boot.version>
<spring.boot.version>3.3.0</spring.boot.version>
<spring.security.version>6.3.0</spring.security.version>
<h2.version>2.2.224</h2.version>
<mapstruct.version>1.5.5.Final</mapstruct.version>
<jjwt.version>0.12.5</jjwt.version>
<springdoc-openapi-ui.version>2.5.0</springdoc-openapi-ui.version>
<jib-maven-plugin.version>3.4.2</jib-maven-plugin.version>
<jib-maven-plugin.version>3.4.3</jib-maven-plugin.version>
<maven-checkstyle-plugin.version>3.3.1</maven-checkstyle-plugin.version>
<checkstyle.version>10.15.0</checkstyle.version>
<checkstyle.version>10.17.0</checkstyle.version>
<git-commit-id-plugin.version>4.9.10</git-commit-id-plugin.version>
<lombok.version>1.18.32</lombok.version>
<jpamodelgen.version>6.5.2.Final</jpamodelgen.version>
<jacoco.version>0.8.12</jacoco.version>
<zstd-jni.version>1.5.6-3</zstd-jni.version>
</properties>
@ -47,22 +49,27 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
@ -82,6 +89,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-properties-migrator</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<!-- security -->
<dependency>
@ -105,11 +113,13 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>${spring.boot.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<version>${spring.security.version}</version>
<scope>test</scope>
</dependency>
<!-- Metamodel-->
@ -126,7 +136,6 @@
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
@ -255,6 +264,38 @@
<verbose>true</verbose>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<configuration>
<append>false</append>
</configuration>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<reportSets>
<reportSet>
<reports>
<report>report</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
</project>

View file

@ -1,9 +1,9 @@
package at.ac.tuwien.sepr.groupphase.backend.datagenerator;
import at.ac.tuwien.sepr.groupphase.backend.BackendApplication;
import at.ac.tuwien.sepr.groupphase.backend.endpoint.dto.TournamentUpdateQualificationMatchDto;
import at.ac.tuwien.sepr.groupphase.backend.endpoint.dto.TournamentUpdateQualificationMatchDto.DrinksPickupDto;
import at.ac.tuwien.sepr.groupphase.backend.endpoint.dto.TournamentUpdateQualificationMatchDto.ScoreUpdateDto;
import at.ac.tuwien.sepr.groupphase.backend.endpoint.dto.SharedMediaCreateDto;
import at.ac.tuwien.sepr.groupphase.backend.entity.ApplicationUser;
import at.ac.tuwien.sepr.groupphase.backend.entity.BeerPongTable;
import at.ac.tuwien.sepr.groupphase.backend.entity.SharedMedia;
@ -26,13 +26,11 @@ import lombok.AllArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Profile;
import org.springframework.core.io.ClassPathResource;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.nio.file.Files;
import java.util.List;
import java.util.stream.IntStream;
@ -135,12 +133,12 @@ public class TestDataGenerator {
}
private void uploadImageToTournament(Tournament tournament, String author, String title, String imagePath) throws IOException {
SharedMediaCreateDto data = new SharedMediaCreateDto();
data.setAuthor(author);
data.setTitle(title);
data.setTournamentId(tournament.getId());
byte[] imageBytes = Files.readAllBytes(new ClassPathResource(imagePath).getFile().toPath());
var inputStream = BackendApplication.class.getClassLoader().getResourceAsStream(imagePath);
byte[] imageBytes = null;
if (inputStream != null) {
imageBytes = inputStream.readAllBytes();
inputStream.close();
}
SharedMedia sharedMedia = new SharedMedia();
sharedMedia.setAuthor(author);

View file

@ -10,5 +10,4 @@ spring:
show-sql: true
properties:
hibernate:
format-sql: TRUE
format-sql: TRUE

21
e2e/cypress.config.ci.js Normal file
View file

@ -0,0 +1,21 @@
const { defineConfig } = require('cypress');
module.exports = defineConfig({
reporter: 'cypress-multi-reporters',
reporterOptions: {
configFile: 'cypress/reporter-config.json',
},
watchForFileChanges: false,
viewportWidth: 1920,
viewportHeight: 1080,
e2e: {
specPattern: 'instrumented/e2e/**/*.cy.{js,jsx,ts,tsx}',
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
require('@cypress/code-coverage/task')(on, config);
return config;
},
baseUrl: 'http://localhost:4200/',
},
});

View file

@ -12,7 +12,8 @@ module.exports = defineConfig({
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config);
require('@cypress/code-coverage/task')(on, config);
return config;
},
baseUrl: 'http://localhost:4200/',
},

View file

@ -1,22 +0,0 @@
/// <reference types="cypress" />
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
/**
* @type {Cypress.PluginConfig}
*/
// eslint-disable-next-line no-unused-vars
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
};

View file

@ -13,8 +13,6 @@
// https://on.cypress.io/configuration
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands';
import '@cypress/code-coverage/support';
// Alternatively you can use CommonJS syntax:
// require('./commands')
import './commands';

4252
e2e/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -5,21 +5,25 @@
"main": "index.js",
"private": true,
"dependencies": {
"cypress": "13.7.3",
"cypress": "13.11.0",
"cypress-mochawesome-reporter": "3.8.2",
"cypress-multi-reporters": "1.6.4",
"@cypress/code-coverage": "^3.12.39",
"mocha-junit-reporter": "2.2.1"
},
"devDependencies": {
"prettier": "^3.2.5",
"nyc": "^17.0.0",
"prettier": "^3.3.2",
"typescript": "^5.4.5"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"cypress": "cypress run",
"cypress:ci": "nyc instrument --compact=false cypress instrumented && cypress run --config-file cypress.config.ci.js",
"cypress:open": "cypress open",
"prettier:check": "prettier --check '**/*.{json,html,scss,ts,js}'",
"prettier:fix": "prettier --write '**/*.{json,html,scss,ts,js}'"
"prettier:fix": "prettier --write '**/*.{json,html,scss,ts,js}'",
"coverage:ci": "nyc report --reporter=text-summary"
},
"author": "Heimo Stranner",
"license": "ISC"

View file

@ -24,7 +24,6 @@
"tsConfig": "src/tsconfig.app.json",
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/theme/theme.scss", "src/styles.scss"],
"scripts": ["node_modules/jquery/dist/jquery.slim.min.js"],
"extractLicenses": false,
"sourceMap": true,
"optimization": false,

File diff suppressed because it is too large Load diff

View file

@ -6,7 +6,7 @@
"start": "ng serve",
"build": "ng build",
"test": "ng test --karma-config=src/karma.conf.local.js",
"test:ci": "ng test --karma-config=src/karma.conf.ci.js",
"test:ci": "ng test --karma-config=src/karma.conf.ci.js --code-coverage",
"lint": "ng lint",
"generate-openapi-client": "npx openapi-generator-cli generate -g typescript-angular -i http://localhost:8080/v3/api-docs -o openapi-generated",
"openapi-clients:replace-base-path-for-prod": "replace-in-files --string='http://localhost:8080' --replacement='https://24ss-se-pr-qse-11-coy10csydgxixr8zgo3zh.apps.student.inso-w.at' dist/sepr-group-phase/browser/main.js",
@ -33,13 +33,12 @@
"@fontsource/roboto": "^5.0.13",
"@popperjs/core": "2.11.8",
"core-js": "3.36.1",
"jquery": "3.7.1",
"jwt-decode": "4.0.0",
"puppeteer": "^22.11.2",
"replace-in-files-cli": "^2.2.0",
"rxjs": "7.8.1",
"tslib": "2.6.2",
"zone.js": "0.14.4"
"tslib": "2.6.3",
"zone.js": "0.14.7"
},
"devDependencies": {
"@angular-devkit/build-angular": "18.0.5",
@ -55,22 +54,24 @@
"@types/jasmine": "5.1.4",
"@types/jasminewd2": "2.0.13",
"@types/jwt-decode": "3.1.0",
"@types/node": "20.12.7",
"@types/node": "20.14.2",
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "^7.13.1",
"eslint": "^8.53.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jsdoc": "48.2.3",
"eslint-plugin-jsdoc": "48.2.9",
"eslint-plugin-prefer-arrow": "1.2.3",
"eslint-plugin-unused-imports": "^3.2.0",
"jasmine-core": "5.1.2",
"jasmine-spec-reporter": "7.0.0",
"karma": "6.4.3",
"karma-chrome-launcher": "3.2.0",
"karma-coverage": "^2.2.1",
"karma-coverage-istanbul-reporter": "3.0.3",
"karma-jasmine": "5.1.0",
"karma-jasmine-html-reporter": "2.1.0",
"nyc": "^17.0.0",
"prettier": "^3.3.2",
"ts-node": "10.9.2",
"typescript": "5.4.5"

View file

@ -9,17 +9,17 @@ module.exports = function (config) {
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
require('@angular-devkit/build-angular/plugins/karma'),
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../coverage'),
reports: ['html', 'lcovonly'],
fixWebpackSourcePaths: true
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true,
},
reporters: ['progress', 'kjhtml'],
reporters: ['progress', 'kjhtml', 'coverage-istanbul'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
@ -28,10 +28,9 @@ module.exports = function (config) {
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox', '--disable-gpu']
}
flags: ['--no-sandbox', '--disable-gpu'],
},
},
singleRun: true
singleRun: true,
});
};