From cd39361f098ea638c0c02a71d72271c73381772b Mon Sep 17 00:00:00 2001 From: da Kai Date: Fri, 31 Oct 2025 12:19:01 +0100 Subject: [PATCH 1/2] add ci build --- .github/workflows/ci.yml | 34 +++++++++++++++++++ .github/workflows/deploy.yml | 4 +-- .../j2mod/modbus/net/SerialConnection.java | 2 +- 3 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8ff36a5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: Maven CI + +on: + workflow_dispatch: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v5 + + - name: Set up Java + uses: actions/setup-java@v5 + with: + distribution: 'temurin' + java-version: '8' + + - name: Install socat + run: sudo apt-get update && sudo apt-get install -y socat + + - name: Create Virtual Serial Ports + run: | + nohup sudo socat -d -d pty,link=/dev/ttys001,raw,echo=0 pty,link=/dev/ttys002,raw,echo=0 > socat.log 2>&1 & + echo $! > socat.pid + sleep 3 + cat socat.log + sudo chmod 666 /dev/ttys001 /dev/ttys002 + + - name: Maven Test + run: mvn test diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 633fa4c..0eb78b3 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -8,10 +8,10 @@ jobs: steps: - name: Checkout Code - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Set up Java - uses: actions/setup-java@v4 + uses: actions/setup-java@v5 with: distribution: 'temurin' java-version: '8' diff --git a/src/main/java/com/ghgande/j2mod/modbus/net/SerialConnection.java b/src/main/java/com/ghgande/j2mod/modbus/net/SerialConnection.java index e8d8937..ad7e38e 100644 --- a/src/main/java/com/ghgande/j2mod/modbus/net/SerialConnection.java +++ b/src/main/java/com/ghgande/j2mod/modbus/net/SerialConnection.java @@ -167,7 +167,7 @@ private void applyConnectionParameters() { // Set connection parameters, if set fails return parameters object to original state if (serialPort != null) { - if (disablePortConfiguration) { + if (this.disablePortConfiguration) { serialPort.disablePortConfiguration(); } serialPort.setComPortParameters(parameters.getBaudRate(), parameters.getDatabits(), parameters.getStopbits(), parameters.getParity()); From 5da828fc8a6058936a5303040fc09283a402e8be Mon Sep 17 00:00:00 2001 From: da Kai Date: Fri, 31 Oct 2025 12:26:06 +0100 Subject: [PATCH 2/2] rename step --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ff36a5..efa5e3a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ on: types: [opened, synchronize, reopened] jobs: - deploy: + build: runs-on: ubuntu-latest steps: