Skip to content

Commit

Permalink
Github actions pipeline for integration testing
Browse files Browse the repository at this point in the history
  • Loading branch information
pietrygamat committed Aug 15, 2021
1 parent c444e64 commit 0f29652
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Integration test
on: workflow_dispatch
jobs:
setup-serial-port-pair:
runs-on: ubuntu-20.04
steps:
- name: install dependencies
run: |
sudo dpkg --add-architecture i386 && \
sudo apt update && sudp apt install -y wine socat
49 changes: 49 additions & 0 deletions integration-test/library-compatibility/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.IntegrationTest</groupId>
<artifactId>jssc-test</artifactId>
<version>2.9.4-SNAPSHOT</version>

<properties>
<maven.compiler.source>6</maven.compiler.source>
<maven.compiler.target>6</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>io.github.java-native</groupId>
<artifactId>jssc</artifactId>
<version>2.9.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.30</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.example.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>runme</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.example;

import jssc.*;

import java.util.Arrays;

public class Main {

static SerialPortEventListener listener = new SerialPortEventListener() {
@Override
public void serialEvent(SerialPortEvent serialPortEvent) {
System.err.println("Event type " + serialPortEvent.getEventType());
try {
System.out.println(serialPortEvent.getPort().readString());
} catch (SerialPortException e) {
e.printStackTrace();
}
}
};

public static void main(String... args) throws SerialPortException, InterruptedException {
String[] serialPorts = SerialPortList.getPortNames();
String portAName = serialPorts[0];
String portBName = serialPorts[1];
System.out.println("Serial ports: " + Arrays.asList(SerialPortList.getPortNames()));
final SerialPort portA = new SerialPort(portAName);
final SerialPort portB = new SerialPort(portBName);
portA.openPort();
portB.openPort();

portA.addEventListener(listener);
portB.addEventListener(listener);

portA.writeBytes("Hello, it's A".getBytes());
portB.writeBytes("Hello, it's B".getBytes());

Thread.sleep(1000);
portA.closePort();
portB.closePort();
}
}

0 comments on commit 0f29652

Please sign in to comment.