Skip to content

Commit

Permalink
Use github actions for testing PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
tresf committed Nov 9, 2023
1 parent b60e5ee commit 1b619ca
Show file tree
Hide file tree
Showing 7 changed files with 145 additions and 88 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: build

on: [push, pull_request]

env:
MAVEN_OPTS: -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn

jobs:
ubuntu:
runs-on: [ubuntu-latest]
strategy:
fail-fast: false
matrix:
include:
- profile: x86
packages: g++-multilib

- profile: x86_64
packages: g++-

- profile: armhf
packages: g++-arm-linux-gnueabihf

- profile: aarch64
packages: g++-aarch64-linux-gnu

- profile: riscv64
packages: g++-riscv64-linux-gnu

- profile: ppc64
packages: g++-powerpc64le-linux-gnu

- profile: mingw32
packages: g++-mingw-w64-i686

- profile: mingw64
packages: g++-mingw-w64-x86-64

- profile: mingwaarch64
packages: clang
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: 11
distribution: temurin

- run: sudo apt-get install socat ${{ matrix.packages }}
- run: mvn -P "${{ matrix.profile }}" --batch-mode

macos:
runs-on: [macos-latest]
strategy:
fail-fast: false
matrix:
include:
- profile: aarch64
- profile: x86_64

steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 11
distribution: temurin

- run: brew install socat
- run: mvn -P "${{ matrix.profile }}" --batch-mode

windows:
runs-on: [windows-latest]
strategy:
fail-fast: false
matrix:
include:
- profile: aarch64

- profile: x86_64

steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 11
distribution: temurin

- run: mvn -P "${{ matrix.profile }}" --batch-mode
88 changes: 0 additions & 88 deletions .travis.yml

This file was deleted.

26 changes: 26 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,32 @@
</properties>
</profile>

<!-- Cross compile for riscv32 -->
<profile>
<id>riscv64</id>
<properties>
<os.target.toolchain>Riscv64</os.target.toolchain>

<os.target.name>linux</os.target.name>
<os.target.arch>riscv64</os.target.arch>
<os.target.bitness>64</os.target.bitness>
</properties>
</profile>

<!-- Cross compile for riscv32 -->
<profile>
<id>riscv32</id>
<properties>
<os.target.toolchain>Riscv32</os.target.toolchain>

<os.target.name>linux</os.target.name>
<os.target.arch>riscv32</os.target.arch>
<os.target.bitness>32</os.target.bitness>
</properties>
</profile>



<!-- Cross compile for x86_64 -->
<profile>
<id>x86_64</id>
Expand Down
Binary file modified src/main/resources-precompiled/natives/osx_arm64/libjssc.dylib
Binary file not shown.
9 changes: 9 additions & 0 deletions src/test/java/jssc/SerialNativeInterfaceTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package jssc;

import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;

import static org.hamcrest.CoreMatchers.is;
Expand Down Expand Up @@ -39,6 +41,13 @@ public void testPrintVersion() {

}

@Before
public void runNext() {
// Skip in CI
Assume.assumeTrue(System.getenv("CI") == null);
// Skip on Windows
Assume.assumeFalse(SerialNativeInterface.getOsType() == SerialNativeInterface.OS_WINDOWS);
}
@Test(expected = java.io.IOException.class)
public void reportsWriteErrorsAsIOException() throws Exception {
long fd = -1; /*bad file by intent*/
Expand Down
10 changes: 10 additions & 0 deletions toolchain/Riscv32.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
set(CMAKE_SYSTEM_NAME Linux)
set(TOOLCHAIN_PREFIX riscv32-linux-gnu)
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
set(CMAKE_STRIP ${TOOLCHAIN_PREFIX}-strip CACHE FILEPATH "" FORCE)
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX}/)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)

10 changes: 10 additions & 0 deletions toolchain/Riscv64.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
set(CMAKE_SYSTEM_NAME Linux)
set(TOOLCHAIN_PREFIX riscv64-linux-gnu)
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
set(CMAKE_STRIP ${TOOLCHAIN_PREFIX}-strip CACHE FILEPATH "" FORCE)
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX}/)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)

0 comments on commit 1b619ca

Please sign in to comment.