Update buildAndTest.yml and remove unused dependencies

This commit is contained in:
Valentin Heiserer
2024-04-17 00:15:00 +02:00
committed by GitHub
parent 402a2d71e2
commit 8bf8140247
14 changed files with 145 additions and 176 deletions

View File

@@ -11,13 +11,23 @@ jobs:
runs-on: self-hosted runs-on: self-hosted
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Set up JDK 21 - name: Set up JDK 21
uses: actions/setup-java@v3 uses: actions/setup-java@v4
with: with:
java-version: '21' java-version: '21'
distribution: 'temurin' distribution: 'temurin'
architecture: x64
- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
maven-version: 3.8.2
- name: Run the Maven verify phase
run: mvn --batch-mode --update-snapshots verify
working-directory: Backend
- name: Build with Maven - name: Build with Maven
run: mvn -B package --file pom.xml run: mvn -B package --file pom.xml

66
.github/workflows/relaseNewVersion.yml vendored Normal file
View File

@@ -0,0 +1,66 @@
name: Release new Version
on:
pull_request:
branches:
- 'release/*'
types:
- closed
create:
branches:
- 'release/*'
workflow_dispatch:
jobs:
build:
name: Build and Release
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
architecture: x64
- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
maven-version: 3.8.2
- name: Run the Maven verify phase
run: mvn --batch-mode --update-snapshots verify
working-directory: Backend
- name: Build with Maven
run: mvn -B package --file pom.xml
working-directory: Backend
- name: Archive dist folder
run: cp Backend/target/schafkopf-backend-build-jar-with-dependencies.jar release && zip -r dist.zip release/*
- name: Get current Version Number
run: echo "version=$(node -p "require('./fcf-frontend/package.json').version")" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
with:
tag_name: ${{ env.version }}
release_name: Release ${{ env.version }}
body: "Test"
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist.zip
asset_name: release_files.zip
asset_content_type: application/zip

View File

@@ -1 +0,0 @@
171ab3333078fd908c878b85563a5ccc

View File

@@ -1 +0,0 @@
2bf9f8b279977cb5511cb075f4f2cd316e2bfa62

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>pn532-sdk</artifactId>
<description>POM was created from install:install-file</description>
<groupId>pn532</groupId>
<modelVersion>4.0.0</modelVersion>
<version>1.0.2</version>
</project>

View File

@@ -1 +0,0 @@
c0332fdac981cf53dc426b4fb6a173df

View File

@@ -1 +0,0 @@
d6d7adcafc0119db3ec26d1bf8522fff1e78160c

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<artifactId>pn532-sdk</artifactId>
<groupId>pn532</groupId>
<versioning>
<lastUpdated>20231116111447</lastUpdated>
<release>1.0.2</release>
<versions>
<version>1.0.2</version>
</versions>
</versioning>
</metadata>

View File

@@ -1 +0,0 @@
324d2ea359305a5cdef2fd48169e4c6d

View File

@@ -1 +0,0 @@
68b60db960171920acbf8b33283396ded102e64e

View File

@@ -2,7 +2,21 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>schafkopf-backend-java</artifactId> <artifactId>schafkopf-backend-java</artifactId>
<groupId>org.example</groupId>
<modelVersion>4.0.0</modelVersion>
<version>1.0-SNAPSHOT</version>
<properties>
<maven-compiler.version>3.5.1</maven-compiler.version>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<pi4j.version>2.4.0</pi4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<slf4j.version>1.7.32</slf4j.version>
</properties>
<build> <build>
<finalName>schafkopf-backend-build</finalName> <finalName>schafkopf-backend-build</finalName>
@@ -12,6 +26,20 @@
</resource> </resource>
</resources> </resources>
<plugins> <plugins>
<!-- Maven Clean Plugin -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>clean-initial</id>
<phase>pre-clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<artifactId>maven-checkstyle-plugin</artifactId> <artifactId>maven-checkstyle-plugin</artifactId>
<executions> <executions>
@@ -43,7 +71,6 @@
</configuration> </configuration>
<version>3.3.0</version> <version>3.3.0</version>
</plugin> </plugin>
<plugin> <plugin>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<configuration> <configuration>
@@ -54,24 +81,49 @@
<version>3.11.0</version> <version>3.11.0</version>
</plugin> </plugin>
<!-- <plugin>-->
<!-- <artifactId>maven-shade-plugin</artifactId>-->
<!-- <configuration>-->
<!-- <transformers>-->
<!-- <transformer-->
<!-- implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>-->
<!-- </transformers>-->
<!-- </configuration>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <goals>-->
<!-- <goal>shade</goal>-->
<!-- </goals>-->
<!-- <phase>package</phase>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <version>3.5.1</version>-->
<!-- </plugin>-->
<!-- Maven Assembly Plugin -->
<plugin> <plugin>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<configuration> <configuration>
<transformers> <descriptorRefs>
<transformer <descriptorRef>jar-with-dependencies</descriptorRef>
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/> </descriptorRefs>
</transformers> <archive>
<manifest>
<mainClass>org.schafkopf.BackendServer</mainClass>
</manifest>
</archive>
</configuration> </configuration>
<executions> <executions>
<execution> <execution>
<goals> <id>make-assembly</id>
<goal>shade</goal>
</goals>
<phase>package</phase> <phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution> </execution>
</executions> </executions>
<groupId>org.apache.maven.plugins</groupId>
<version>3.5.1</version>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
@@ -102,12 +154,12 @@
<dependency> <dependency>
<artifactId>websocket-jetty-server</artifactId> <artifactId>websocket-jetty-server</artifactId>
<groupId>org.eclipse.jetty.websocket</groupId> <groupId>org.eclipse.jetty.websocket</groupId>
<version>11.0.15</version> <version>11.0.20</version>
</dependency> </dependency>
<dependency> <dependency>
<artifactId>jetty-servlets</artifactId> <artifactId>jetty-servlets</artifactId>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<version>11.0.15</version> <version>11.0.19</version>
</dependency> </dependency>
<!-- To run websockets client --> <!-- To run websockets client -->
<dependency> <dependency>
@@ -125,32 +177,6 @@
<groupId>io.github.cdimascio</groupId> <groupId>io.github.cdimascio</groupId>
<version>3.0.0</version> <version>3.0.0</version>
</dependency> </dependency>
<!-- include Pi4J Core -->
<dependency>
<artifactId>pi4j-core</artifactId>
<groupId>com.pi4j</groupId>
<version>${pi4j.version}</version> <!-- Use the latest version available -->
</dependency>
<!-- include Pi4J Plugins (Platforms and I/O Providers) -->
<dependency>
<artifactId>pi4j-plugin-raspberrypi</artifactId>
<groupId>com.pi4j</groupId>
<version>${pi4j.version}</version>
</dependency>
<dependency>
<artifactId>pi4j-plugin-pigpio</artifactId>
<groupId>com.pi4j</groupId>
<version>${pi4j.version}</version>
</dependency>
<dependency>
<artifactId>pn532-sdk</artifactId>
<groupId>pn532</groupId>
<version>1.0.2</version>
</dependency>
<dependency> <dependency>
<groupId>org.openjfx</groupId> <groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId> <artifactId>javafx-controls</artifactId>
@@ -162,26 +188,4 @@
<version>17</version> <version>17</version>
</dependency> </dependency>
</dependencies> </dependencies>
<groupId>org.example</groupId>
<modelVersion>4.0.0</modelVersion>
<properties>
<maven-compiler.version>3.5.1</maven-compiler.version>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<!-- DEPENDENCIES VERSIONS -->
<pi4j.version>2.4.0</pi4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<slf4j.version>1.7.32</slf4j.version>
</properties>
<repositories>
<repository>
<id>in-project</id>
<name>In Project Repo</name>
<url>file://${project.basedir}/lib</url>
</repository>
</repositories>
<version>1.0-SNAPSHOT</version>
</project> </project>

View File

@@ -24,7 +24,6 @@ import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlets.CrossOriginFilter; import org.eclipse.jetty.servlets.CrossOriginFilter;
import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer; import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
import org.schafkopf.cardreader.CardReader; import org.schafkopf.cardreader.CardReader;
import org.schafkopf.cardreader.GpioReader;
import org.schafkopf.cardreader.UsbCardReader; import org.schafkopf.cardreader.UsbCardReader;
/** Main Class that represents the Backend Server. */ /** Main Class that represents the Backend Server. */
@@ -53,19 +52,8 @@ public class BackendServer {
schafkopfGame = new Schafkopf(this); schafkopfGame = new Schafkopf(this);
String osName = System.getProperty("os.name").toLowerCase();
if (osName.contains("win")) { nfcLeser = new UsbCardReader(this);
// Windows
nfcLeser = new UsbCardReader(this);
} else if (osName.contains("nix") || osName.contains("nux") || osName.contains("mac")) {
// Unix/Linux/Mac
// You can add additional checks for specific Linux distributions or macOS versions if needed
// For now, assuming Raspberry Pi is running Linux
nfcLeser = new GpioReader(this);
} else {
// Other OS
throw new RuntimeException("Unsupported OS: " + osName);
}
// Setup the basic application "context" for this application at "/" // Setup the basic application "context" for this application at "/"
// This is also known as the handler tree (in jetty speak) // This is also known as the handler tree (in jetty speak)

View File

@@ -1,70 +0,0 @@
package org.schafkopf.cardreader;
import com.pi4j.io.i2c.I2C;
import java.io.IOException;
import mk.hsilomedus.pn532.Pn532ContextHelper;
import mk.hsilomedus.pn532.Pn532I2c;
import mk.hsilomedus.pn532.Pn532SamThread;
import mk.hsilomedus.pn532.Pn532SamThread.Pn532SamThreadListener;
import org.schafkopf.BackendServer;
/** Class that represents the NFC Reader. */
public final class GpioReader extends CardReader {
/**
* Creates an Instance of the KartenLeser.
*
* @param server Backend Server to call methods on.
*/
public GpioReader(BackendServer server) {
super(server);
new Thread(
() -> {
new KartenListener().run();
})
.start();
}
public static final void main(String[] args) throws IOException {}
private static class KartenListener implements Pn532SamThreadListener {
@SuppressWarnings("rawtypes")
Pn532SamThread<I2C> i2cThread = new Pn532SamThread<>(this, new Pn532I2c());
public void run() {
Pn532ContextHelper.initialize();
i2cThread.start();
}
public void close() {
closeThread(i2cThread);
Pn532ContextHelper.shutdown();
}
@Override
public void receiveMessage(String message) {
System.out.println(message);
}
@Override
public void uidReceived(String displayName, byte[] uid) {
server.nfcGelesen(Pn532SamThreadListener.getUidString(uid));
}
@SuppressWarnings("rawtypes")
private void closeThread(Pn532SamThread thread) {
if (thread != null && thread.isAlive()) {
thread.close();
try {
thread.join();
} catch (InterruptedException e) {
System.out.println("Error closing thread: " + e.getMessage());
Thread.currentThread().interrupt();
}
}
}
}
}