Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Commit

Permalink
Merge pull request #319 from SELab-2/development
Browse files Browse the repository at this point in the history
Stresstest
  • Loading branch information
lars-vc authored May 10, 2022
2 parents b0ea014 + 9e46758 commit d3a9054
Show file tree
Hide file tree
Showing 28 changed files with 943 additions and 551 deletions.
26 changes: 26 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/frontend"
schedule:
interval: "daily"
labels:
- "dependencies"
open-pull-requests-limit: 5
reviewers:
- "NielsPraet"
- "Mikxox"
- "tvhimme"

- package-ecosystem: "maven"
directory: "/backend"
schedule:
interval: "daily"
labels:
- "dependencies"
open-pull-requests-limit: 5
reviewers:
- "MaartenS11"
- "TomAlard"
- "NinjaJay"
- "lars-vc"
22 changes: 4 additions & 18 deletions .github/workflows/all_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,25 @@ on:
jobs:
container-job:

runs-on: self-hosted
runs-on: ubuntu-latest
container:
image: mikxox/maven-test-action:latest
options: --rm
env:
GITHUB_WORKSPACE: /home/selab2/actions-runner/workspace

steps:
- uses: actions/checkout@v2
with:
path: 'temppath'

- name: Test with Maven
# -B: run in non-interactive (batch) mode
run: |
cd /__w/OSOC-1/OSOC-1/temppath/backend
./mvnw -B -DfailIfNoTests=false test --file pom.xml
run: ./mvnw -B -DfailIfNoTests=false test --file pom.xml
working-directory: ./backend

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: /__w/OSOC-1/OSOC-1/temppath
working-directory: /__w/OSOC-1/OSOC-1/temppath
root_dir: /__w/OSOC-1/OSOC-1/temppath
fail_ci_if_error: true
files: /__w/OSOC-1/OSOC-1/temppath/backend/target/site/jacoco/jacoco.xml
files: /__w/OSOC-1/OSOC-1/backend/target/site/jacoco/jacoco.xml
flags: all_tests
name: codecov-umbrella
verbose: true

- name: remove temppath
if: always()
run: |
cd /__w/OSOC-1/OSOC-1/
sudo rm -rf temppath
12 changes: 2 additions & 10 deletions .github/workflows/backend-linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@ on:
jobs:
ktlint:
name: Check Code Quality
runs-on: self-hosted
runs-on: ubuntu-latest
container:
image: mikxox/maven-test-action:latest
options: --rm
env:
GITHUB_WORKSPACE: /home/selab2/actions-runner/workspace

steps:
- name: Clone repo
uses: actions/checkout@v2
with:
fetch-depth: 1
path: 'temppath'

- name: install reviewdog
run: |
Expand All @@ -29,13 +26,8 @@ jobs:
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd /__w/OSOC-1/OSOC-1/temppath/backend
curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.44.0/ktlint
chmod a+x ktlint
./ktlint --reporter=checkstyle | reviewdog -f=checkstyle -name="ktlint" -reporter="github-pr-check" -level="error" -filter-mode="nofilter" -fail-on-error="false"
working-directory: ./backend

- name: remove temppath
if: always()
run: |
cd /__w/OSOC-1/OSOC-1/
sudo rm -rf temppath
14 changes: 1 addition & 13 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,24 @@ on: [push]

jobs:
commitlint:
runs-on: self-hosted
runs-on: ubuntu-latest
container:
image: mikxox/maven-test-action:latest
options: --rm
env:
GITHUB_WORKSPACE: /home/selab2/actions-runner/workspace

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
path: 'temppath'

- name: Validate all commits from PR
shell: bash
run: |
cd /__w/OSOC-1/OSOC-1/temppath
STATUS="$(git log -1 --pretty=format:"%s" | npx commitlint)"
echo -E ::notice title=commitmessage::$(git log -1 --pretty=format:"%s" | npx commitlint --verbose | sed 's/%/%25/g' | sed 's/\n/%0A/g' | sed 's/\r/%0D/g')
- name: Validate all commits from PR
shell: bash
if: failure()
run: |
cd /__w/OSOC-1/OSOC-1/temppath
echo -E ::error title=commitmessage::$(git log -1 --pretty=format:"%s" | npx commitlint --verbose | sed 's/%/%25/g' | sed 's/\n/%0A/g' | sed 's/\r/%0D/g')
- name: remove temppath
if: always()
run: |
cd /__w/OSOC-1/OSOC-1/
sudo rm -rf temppath
19 changes: 6 additions & 13 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
jobs:
container-job:

runs-on: self-hosted
runs-on: ubuntu-latest
container:
image: mikxox/maven-test-action:latest
options: --rm
Expand All @@ -22,14 +22,13 @@ jobs:
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
path: 'temppath'

- name: install yarn and dependencies
run: |
cd /__w/OSOC-1/OSOC-1/temppath/frontend
npm install --global yarn
npm install --global eslint-formatter-rdjson
yarn install --frozen-lockfile
working-directory: ./frontend

- name: install reviewdog
run: |
Expand All @@ -39,16 +38,15 @@ jobs:
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd /__w/OSOC-1/OSOC-1/temppath/frontend
/__w/OSOC-1/OSOC-1/temppath/frontend/node_modules/.bin/eslint -f=rdjson . | reviewdog -f=rdjson -name="eslint" -reporter="github-pr-check" -level="error" -filter-mode="nofilter" -fail-on-error="true"
node_modules/.bin/eslint -f=rdjson . | reviewdog -f=rdjson -name="eslint" -reporter="github-pr-check" -level="error" -filter-mode="nofilter" -fail-on-error="true"
working-directory: ./frontend

- name: prettier with reviewdog
if: always()
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd /__w/OSOC-1/OSOC-1/temppath/frontend
/__w/OSOC-1/OSOC-1/temppath/frontend/node_modules/.bin/prettier --check --config /__w/OSOC-1/OSOC-1/temppath/frontend/prettier.config.js --ignore-path /__w/OSOC-1/OSOC-1/temppath/frontend/.prettierignore . 2>&1 | sed --regexp-extended 's/(\[warn\].*)$/\1 File is not properly formatted./' \
node_modules/.bin/prettier --check --config /__w/OSOC-1/OSOC-1/frontend/prettier.config.js --ignore-path /__w/OSOC-1/OSOC-1/frontend/.prettierignore . 2>&1 | sed --regexp-extended 's/(\[warn\].*)$/\1 File is not properly formatted./' \
| reviewdog \
-efm="%-G[warn] Code style issues found in the above file(s). Forgot to run Prettier%. File is not properly formatted." \
-efm="[%tarn] %f %m" \
Expand All @@ -61,9 +59,4 @@ jobs:
-filter-mode="nofilter" \
-fail-on-error="true" \
-level="error"
- name: remove temppath
if: always()
run: |
cd /__w/OSOC-1/OSOC-1
sudo rm -rf temppath
working-directory: ./frontend
17 changes: 3 additions & 14 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,15 @@ on:
jobs:
container-job:

runs-on: self-hosted
runs-on: ubuntu-latest
container:
image: mikxox/maven-test-action:latest
options: --rm
env:
GITHUB_WORKSPACE: /home/selab2/actions-runner/workspace

steps:
- uses: actions/checkout@v2
with:
path: 'temppath'

- name: Test with Maven
# -B: run in non-interactive (batch) mode
run: |
cd /__w/OSOC-1/OSOC-1/temppath/backend
./mvnw -B -Dtest="unittests.**" -DfailIfNoTests=false test --file pom.xml
- name: remove temppath
if: always()
run: |
cd /__w/OSOC-1/OSOC-1/
sudo rm -rf temppath
run: ./mvnw -B -Dtest="unittests.**" -DfailIfNoTests=false test --file pom.xml
working-directory: ./backend
18 changes: 9 additions & 9 deletions backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.3</version>
<version>2.6.7</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>be.osoc.team1</groupId>
Expand All @@ -15,8 +15,8 @@
<description>Backend for osoc selection tool</description>
<properties>
<java.version>17</java.version>
<kotlin.version>1.6.10</kotlin.version>
<dokka.version>1.6.10</dokka.version>
<kotlin.version>1.6.21</kotlin.version>
<dokka.version>1.6.21</dokka.version>
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -88,18 +88,18 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<version>2.6.3</version>
<version>2.6.7</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<version>5.6.2</version>
<version>5.6.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.18.3</version>
<version>3.19.2</version>
</dependency>
<!--This dependency is needed to allow spring testing to handle 401 server authentication retry errors-->
<dependency>
Expand Down Expand Up @@ -158,7 +158,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version>
<version>0.8.8</version>
<configuration>
<formats>XML,HTML</formats>
</configuration>
Expand All @@ -180,7 +180,7 @@
<!-- <plugin>
<groupId>com.github.gantsign.maven</groupId>
<artifactId>ktlint-maven-plugin</artifactId>
<version>1.11.2</version>
<version>1.13.1</version>
<executions>
<execution>
<id>format-and-check</id>
Expand Down Expand Up @@ -212,7 +212,7 @@
<plugin>
<groupId>com.github.gantsign.maven</groupId>
<artifactId>ktlint-maven-plugin</artifactId>
<version>1.11.2</version>
<version>1.13.1</version>
</plugin>
</plugins>
</reporting>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import javax.validation.constraints.NotBlank
*/
@Entity
class Position(
@ManyToOne(cascade = [CascadeType.ALL])
@ManyToOne(cascade = [CascadeType.MERGE])
val skill: Skill,
val amount: Int,
@JsonIgnore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class Student(
@NotBlank
val edition: String = "",

@ManyToMany(cascade = [CascadeType.ALL])
@ManyToMany(cascade = [CascadeType.MERGE])
@OrderBy
val skills: Set<Skill> = sortedSetOf(),
val alumn: Boolean = false,
Expand Down Expand Up @@ -189,4 +189,4 @@ fun List<Student>.filterByStudentCoach() = filter { it.possibleStudentCoach }
* This function will filter a list of [Student]s to only return students who have not yet been assigned to a [Project].
*/
fun List<Student>.filterByNotYetAssigned(assignmentRepository: AssignmentRepository) =
filter { assignmentRepository.findByStudent(it).isEmpty() }
this.toSet().subtract(assignmentRepository.findAll().map { it.student }.toSet()).toList()
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package be.osoc.team1.backend.services

import be.osoc.team1.backend.entities.StatusEnum

private fun preprocess(string: String) = string.lowercase().replace(" ", "")

/**
Expand Down Expand Up @@ -49,8 +47,6 @@ class Pager(val pageNumber: Int, val pageSize: Int) {
*/
data class PagedCollection<T>(val collection: List<T>, val totalLength: Int)

data class StudentFilter(val statusFilter: List<StatusEnum>, val nameQuery: String, val includeSuggested: Boolean)

fun <T> List<T>.page(pager: Pager) = pager.paginate(this)

/**
Expand Down
Loading

0 comments on commit d3a9054

Please sign in to comment.