Skip to content

Commit

Permalink
Some changes done:
Browse files Browse the repository at this point in the history
- Workflows renamed, tuned to execute the tests and get the report
- Fixed Java versions to 16
- Moved log imp to the parent pom
- Renamed Entities
- Simplified packages
- Renamed several classes
  • Loading branch information
augustocristian committed Nov 15, 2024
1 parent dc83cd1 commit 6537a3d
Show file tree
Hide file tree
Showing 26 changed files with 488 additions and 396 deletions.
57 changes: 0 additions & 57 deletions .github/workflows/build.yml

This file was deleted.

119 changes: 119 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: build-retorch
on:
push:
branches-ignore:
- 'dependabot/**' #avoid duplicates: only run the PR, not the commit
- 'gh-pages' #GitHub pages do not trigger all tests
tags-ignore:
- 'v*' #avoid rerun existing commit on release
pull_request:
branches:
- 'main'
jobs:
build-java:
runs-on: ubuntu-latest
# if: ${{ false }} # disable for now
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '16'
cache: 'maven'

- name: Build RETORCH project
run: mvn compile -U --no-transfer-progress

test-retorch-orchestration:
runs-on: ubuntu-latest
# if: ${{ false }} # disable for now
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '16'
cache: 'maven'

- name: Test RETORCH orchestration module
run: mvn test -Dtest=* -pl retorch-orchestration -U --no-transfer-progress

- name: Generate report checks
if: always()
uses: mikepenz/action-junit-report@v5
with:
check_name: "test-result-orchestration"
report_paths: "**/surefire-reports/TEST-*.xml"
fail_on_failure: 'true'

- if: always()
name: Publish test report files
uses: actions/upload-artifact@v4
with:
name: "test-report-files-orchestration"
path: |
target/site
**/target/site/jacoco/jacoco.xml
**/target/surefire-reports
sonarqube:
needs: [ build-java, test-retorch-orchestration ]
#if: ${{ false }} # disable for now
#This job fails when comming from a dependabot PR (can't read the sonarqube token for security reasons).
#Links to discussions and workaround at: https://github.com/giis-uniovi/samples-giis-template/issues/4
if: ${{ github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4.1.8
if: always()
with:
name: "test-report-files-orchestration"
- name: Aggregated junit html report
if: always()
uses: javiertuya/junit-report-action@v1.2.0
with:
surefire-files: "**/target/surefire-reports/TEST-*.xml"
report-dir: target-ALL/site
report-title: "Test Report: ALL - Branch: ${{ github.ref_name }} - Run #${{ github.run_number }}"
- name: Index file to html reports
run: |
echo "<html><head><title>Latest Test Reports</title></head><body>" > target-ALL/site/index.html
echo "<h2>Latest Test Reports - Branch: ${{ github.ref_name }} - Run #${{ github.run_number }}</h2>" >> target-ALL/site/index.html
echo "<p><a href=\"junit-noframes/junit-noframes.html\">Single page reports</a></p>" >> target-ALL/site/index.html
echo "<p><a href=\"junit-frames/index.html\">Multiple page reports with frames</a></p>" >> target-ALL/site/index.html
echo "</body></html>" >> target-ALL/site/index.html
- if: always()
name: Publish test report files
uses: actions/upload-artifact@v4
with:
name: "test-report-ALL"
path: |
target-ALL/site
**/target/surefire-reports
**/target/*.html
**/target/*.log
**/reports/*.html
**/reports/*.log
- uses: javiertuya/sonarqube-action@v1.4.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
sonar-token: ${{ secrets.SONAR_TOKEN }}
restore-artifact-name1: "test-report-files-orchestration"

publish-java-snapshot:
#if: ${{ false }} # disable for now
#avoid publishing PRs and dependabot branches
if: ${{ github.event_name != 'pull_request' && !startsWith(github.ref, 'refs/heads/dependabot/') && !startsWith(github.ref, 'refs/heads/dashgit/combined/') }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: javiertuya/branch-snapshots-action@v1.2.3
with:
token: ${{ secrets.GITHUB_TOKEN }}
java-version: '16'
mvn-deploy-args: '-P publish-github -DskipTests=true -Dmaven.test.failure.ignore=false -U --no-transfer-progress'
delete-old-snapshots: true
min-snapshots-to-keep: 2
always-keep-regex: "\\d*\\.\\d*\\.\\d*-main-SNAPSHOT$"
10 changes: 10 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.target>16</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!--Separate all dependencies by a blank line to avoid problems creating combined dependencies in dependabot.-->

<logback-classic.version>1.5.12</logback-classic.version>

</properties>

<modules>
Expand All @@ -39,6 +43,12 @@
<artifactId>slf4j-api</artifactId>
<version>2.0.16</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback-classic.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
48 changes: 33 additions & 15 deletions retorch-orchestration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,40 @@
<artifactId>retorch-orchestration</artifactId>
<packaging>jar</packaging>
<name>retorch-orchestration</name>
<description>Multimodule maven project template, module without dependencies</description>
<url>http://github.com/giis-uniovi/samples-giis-template</url>
<description>This module covers the orchestration process, processes the Resource annotations and generates the necessary
scripting code to execute the RETORCH execution plan</description>
<url>https://github.com/giis-uniovi/retorch</url>
<organization>
<name>Software Engineering Research Group (GIIS) - Universidad de Oviedo, ES</name>
<url>http://giis.uniovi.es/</url>
<url>https://giis.uniovi.es/</url>
</organization>
<properties>
<!--Separate all dependencies by a blank line to avoid problems creating combined dependencies in dependabot.-->
<retorchannotations.version>1.1.1-SNAPSHOT</retorchannotations.version>

<maven-surefire-plugin.version>3.5.2</maven-surefire-plugin.version>

<jacksonjson.version>2.18.1</jacksonjson.version>

<mockito.version>5.14.2</mockito.version>

<logback-classic.version>1.5.12</logback-classic.version>


</properties>
<dependencies>
<dependency><!--Dependencies on other modules of this project should be the first ones to reduce the risk of transitive dependencies issues-->
<groupId>io.github.giis-uniovi</groupId>
<artifactId>retorch-annotations</artifactId>
<version>${retorchannotations.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand All @@ -43,17 +57,6 @@
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback-classic.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.github.giis-uniovi</groupId>
<artifactId>retorch-annotations</artifactId>
<version>1.1.1-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down Expand Up @@ -85,6 +88,21 @@
<target>16</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<excludes> <!-- This configuration excludes the test cases for analysis-executions purposes -->
<exclude>**/testdata/**</exclude>
</excludes>
<!-- END This configuration excludes the test cases for analysis purposes -->
<testFailureIgnore>true</testFailureIgnore>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<!-- Avoids Jenkins slave fail in linux and openjdk: https://stackoverflow.com/questions/23260057/the-forked-vm-terminated-without-saying-properly-goodbye-vm-crash-or-system-exi/53070605 -->
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin>
</plugins>
</build>
</project>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
package giis.retorch.orchestration.model;

public class AccessModeEntity {
public class AccessMode {

private AccessModeTypesEntity accessMode;
private AccessModeTypes type;
private boolean sharing = false;
private int concurrency = 1;
private ResourceEntity resource;
private Resource resource;

public AccessModeEntity() {}
public AccessMode() {}

public AccessModeEntity(AccessModeEntity accessMode) {
this.accessMode = accessMode.getAccessMode();
this.concurrency = accessMode.getConcurrency();
this.resource = accessMode.getResource();
this.sharing = accessMode.getSharing();
public AccessMode(AccessMode type) {
this.type = type.getType();
this.concurrency = type.getConcurrency();
this.resource = type.getResource();
this.sharing = type.getSharing();
}

/**
* Access mode constructor
* @param accessMode {@link AccessModeTypesEntity} that could be READONLY,WRITEONLY,READWRITE,DYNAMIC or NOACCESS
* @param type {@link AccessModeTypes} that could be READONLY,WRITEONLY,READWRITE,DYNAMIC or NOACCESS
* @param sharing Boolean that represents if the resource can be shared or not
* @param concurrency Integer with the max number of concurrent access
* @param resource Resource on which the access mode is performed
*/
public AccessModeEntity(AccessModeTypesEntity accessMode, boolean sharing, int concurrency, ResourceEntity resource) {
this.accessMode = accessMode;
public AccessMode(AccessModeTypes type, boolean sharing, int concurrency, Resource resource) {
this.type = type;
this.sharing = sharing;
this.concurrency = concurrency;
this.resource = resource;
Expand All @@ -38,24 +38,24 @@ public int hashCode() {
@Override
public boolean equals(Object obj) {
if ((obj == null) || (!obj.getClass().equals(this.getClass()))) return false;
AccessModeEntity objToCompare = ((AccessModeEntity) obj);
AccessMode objToCompare = ((AccessMode) obj);

return objToCompare.getSharing() == this.sharing && objToCompare.getConcurrency() == this.concurrency
&& objToCompare.getAccessMode().equals(this.accessMode) && objToCompare.getResource().equals(this.resource);
&& objToCompare.getType().equals(this.type) && objToCompare.getResource().equals(this.resource);
}

@Override
public String toString() {
return "a.m.{" + accessMode + ", " + sharing + ", " + concurrency + ",'" + resource + '\'' + '}';
return "a.m.{" + type + ", " + sharing + ", " + concurrency + ",'" + resource + '\'' + '}';
}

public AccessModeTypesEntity getAccessMode() {
return accessMode;
public AccessModeTypes getType() {
return type;
}
public int getConcurrency() {
return concurrency;
}
public ResourceEntity getResource() {
public Resource getResource() {
return resource;
}
public boolean getSharing() {
Expand All @@ -65,14 +65,14 @@ public boolean getSharing() {
public void setSharing(boolean sharing) {
this.sharing = sharing;
}
public void setResource(ResourceEntity resource) {
public void setResource(Resource resource) {
this.resource = resource;
}
public void setConcurrency(int concurrency) {
this.concurrency = concurrency;
}
public void setAccessMode(AccessModeTypesEntity accessMode) {
this.accessMode = accessMode;
public void setType(AccessModeTypes type) {
this.type = type;
}

}
Loading

0 comments on commit 6537a3d

Please sign in to comment.