Skip to content

Commit

Permalink
Merge pull request #14 from alekszivko/cicd/13-add-to-github-actions-…
Browse files Browse the repository at this point in the history
…coverage-tests-on-pull-request

Cicd/13 add to GitHub actions coverage tests on pull request
  • Loading branch information
alekszivko authored Dec 23, 2024
2 parents 5cee728 + b5cd143 commit 6f30113
Show file tree
Hide file tree
Showing 41 changed files with 276 additions and 644 deletions.
33 changes: 33 additions & 0 deletions .github/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Measure coverage

on:
pull_request: [main]

jobs:
build:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 22
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '22'
cache: maven
- name: Run Coverage
run: |
chmod +x mvnw
./mvnw clean verify
- uses: actions/github-script@v7
- name: Add coverage to PR
if: github.event_name == 'pull_request'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.createComment({
issue_number: ${{ github.event.number }},
owner: context.repo.owner,
repo: context.repo.repo,
body: 'test test'
47 changes: 41 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,45 @@
<artifactId>sj2324-seed</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.12</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>jacoco-check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>PACKAGE</element>
<limits>
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>0.0</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>springdoc-openapi-maven-plugin</artifactId>
<executions>
Expand Down Expand Up @@ -77,10 +116,6 @@
<artifactId>spring-boot-starter-thymeleaf</artifactId>
<groupId>org.springframework.boot</groupId>
</dependency>
<dependency>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
<groupId>org.springframework.boot</groupId>
</dependency>
<dependency>
<artifactId>spring-boot-starter-web</artifactId>
<groupId>org.springframework.boot</groupId>
Expand Down Expand Up @@ -131,7 +166,7 @@
<dependency>
<artifactId>postgresql</artifactId>
<groupId>org.testcontainers</groupId>
<scope>test</scope>
<scope>runtime</scope>
</dependency>
<dependency>
<artifactId>spring-boot-devtools</artifactId>
Expand All @@ -152,7 +187,7 @@
<artifactId>spring-boot-starter-parent</artifactId>
<groupId>org.springframework.boot</groupId>
<relativePath/>
<version>3.2.3</version> <!-- lookup parent from repository -->
<version>3.2.4</version> <!-- lookup parent from repository -->
</parent>
<properties>
<java.version>22</java.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

// implemented by MM
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Builder


@Embeddable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package at.spengergasse.sj2324seedproject.domain;

import jakarta.persistence.Embeddable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.NoArgsConstructor;

@Builder


@Embeddable
public record Customer(String connectionNo) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,33 @@
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.data.jpa.domain.AbstractPersistable;

import java.util.List;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Table(name = "producers")
@EqualsAndHashCode(callSuper = true)


@Entity
@Table(name = "producers")
public class Producer extends AbstractPersistable<Long>{

/*
Relations
*/

@OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE})
private List<StorageObjectMeta> storageObjectMeta;


/*
Attributes
*/

@Column(name = "shortname", length = ConstantsDomain.DEFAULT_LENGTH)
@NotBlank
private String shortname = ConstantsDomain.DEFAULT_VALUE;
private String shortname;

@NotBlank
@Column(name = "producer_name", length = ConstantsDomain.DEFAULT_LENGTH)
private String name = ConstantsDomain.DEFAULT_VALUE;
private String name;



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@

@Data
@Builder
@Embeddable
@NoArgsConstructor
@AllArgsConstructor


@Embeddable
public class Profile {

private static final int USERNAME_LENGTH = 10;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,18 @@
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.data.jpa.domain.AbstractPersistable;

@Data
@Entity
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)


@Entity
@Table(name = "reservations")
public class Reservation extends AbstractPersistable<Long> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.data.jpa.domain.AbstractPersistable;

// Implementend by MM
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Builder
@EqualsAndHashCode(callSuper = true)

@Entity
@Table(name="storages")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,26 @@
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.data.jpa.domain.AbstractPersistable;

import java.util.ArrayList;
import java.util.List;

@Data
@Entity
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "storage_objects")
public class StorageObject extends AbstractPersistable<Long>{
@EqualsAndHashCode(callSuper = true)

/*
Relations
*/

@Entity
@Table(name = "storage_objects")
public class StorageObject extends AbstractPersistable<Long>{

// @JoinColumn(name = "fk_stored_at_user", foreignKey = @ForeignKey(name = "fk_storageObject_2_user"))
// @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.MERGE, CascadeType.PERSIST})
@OneToMany
private List<User> storedAtUser = new ArrayList<>();
private List<User> storedAtUsers;

@ManyToOne(fetch = FetchType.LAZY,
cascade = {CascadeType.MERGE, CascadeType.PERSIST})
Expand Down Expand Up @@ -56,9 +53,6 @@ public class StorageObject extends AbstractPersistable<Long>{
cascade = {CascadeType.MERGE, CascadeType.PERSIST})
private Reservation reservation;

/*
Attributes
*/
@Column(name = "serial_number")
private String serialNumber;

Expand All @@ -68,7 +62,7 @@ public class StorageObject extends AbstractPersistable<Long>{

@Column(name = "remark")
@NotBlank
private String remark = ConstantsDomain.DEFAULT_VALUE;
private String remark;

@Column(name = "project_device")
private Boolean projectDevice;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.data.jpa.domain.AbstractPersistable;

import java.time.LocalDateTime;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Builder
@EqualsAndHashCode(callSuper = true)


@Entity
@Table(name ="storageObjectHistory")

public class StorageObjectHistory extends AbstractPersistable<Long> {

@ManyToOne(fetch = FetchType.LAZY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.data.jpa.domain.AbstractPersistable;

Expand All @@ -16,18 +17,15 @@


@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Builder
@EqualsAndHashCode(callSuper = true)

@Entity
@Table(name = "storage_object_metas")

public class StorageObjectMeta extends AbstractPersistable<Long>{

/*
Relations
*/

@OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.MERGE, CascadeType.PERSIST})
public List<StorageObject> storageobject;

Expand All @@ -40,17 +38,13 @@ public class StorageObjectMeta extends AbstractPersistable<Long>{
@Enumerated(EnumType.STRING)
private Type type;

/*
Attributes
*/

@NotBlank
@Column(name = "storage_object_name")
private String name = ConstantsDomain.DEFAULT_VALUE;
private String name;

@NotBlank
@Column(name = "os_version")
private String osVersion = ConstantsDomain.DEFAULT_VALUE;
private String osVersion;

@Min(0)
@Column(name = "consumables_per_box")
Expand All @@ -62,11 +56,11 @@ public class StorageObjectMeta extends AbstractPersistable<Long>{

@NotBlank
@Column(name = "wave_length")
private String wavelength = ConstantsDomain.DEFAULT_VALUE;
private String wavelength;

@NotBlank
@Column(name = "interface_speed")
private String interfacespeed = ConstantsDomain.DEFAULT_VALUE;
private String interfacespeed;


}
Loading

0 comments on commit 6f30113

Please sign in to comment.