diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7272cda05..edf26770b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -47,3 +47,37 @@ jobs: run: | ant test ant test-platform + + test-m1: + runs-on: ${{ matrix.os }} + strategy: + matrix: + java: [21] + # macos-14 is documented to run on m1 + # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories + os: [macos-14] + # Run all tests even if one fails + fail-fast: true + name: Test JDK ${{ matrix.java }}, ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v3 + with: + java-version: ${{ matrix.java }} + distribution: 'zulu' + - name: Linux requirements + if: contains(matrix.os, 'ubuntu') + run: sudo apt-get -y install texinfo + - name: macOS requirements + if: contains(matrix.os, 'macos') + run: | + brew update + brew install automake --force + brew install libtool --force + brew install texinfo --force + - name: Run test + run: | + ant test + ant test-platform diff --git a/.github/workflows/native-libraries-macOS.yaml b/.github/workflows/native-libraries-macOS.yaml new file mode 100644 index 000000000..a03cebd84 --- /dev/null +++ b/.github/workflows/native-libraries-macOS.yaml @@ -0,0 +1,42 @@ +# Build native library for mac OS +name: mac OS native libraries + +on: + workflow_dispatch: + +permissions: + contents: read + +jobs: + build-native-darwin: + runs-on: ${{ matrix.os }} + strategy: + matrix: + java: [21] + os: [macos-latest] + name: Build native libraries for mac OS / darwin + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v3 + with: + java-version: ${{ matrix.java }} + distribution: 'zulu' + - name: macOS requirements + if: contains(matrix.os, 'macos') + run: | + brew update + brew install automake --force + brew install libtool --force + - name: Build native code + run: | + ant -Dos.prefix=darwin-aarch64 + ant -Dos.prefix=darwin-x86-64 + - name: Upload mac OS binaries + uses: actions/upload-artifact@v4 + with: + name: darwin-native + path: | + lib/native/darwin-aarch64.jar + lib/native/darwin-x86-64.jar \ No newline at end of file diff --git a/contrib/platform/test/com/sun/jna/platform/mac/IOKitTest.java b/contrib/platform/test/com/sun/jna/platform/mac/IOKitTest.java index 8810d452e..e2c2ead78 100644 --- a/contrib/platform/test/com/sun/jna/platform/mac/IOKitTest.java +++ b/contrib/platform/test/com/sun/jna/platform/mac/IOKitTest.java @@ -103,7 +103,8 @@ public void testMatching() { String serialNumberViaUtil = platformExpert.getStringProperty("IOPlatformSerialNumber"); assertEquals(serialNumber, serialNumberViaUtil); - assertEquals(12, serialNumber.length()); + assertTrue("Known serial number lengths are 10 and 12, was: " + serialNumber.length(), + serialNumber.length() == 12 || serialNumber.length() == 10); // Get all the keys dict = platformExpert.createCFProperties(); assertNotEquals(0, dict.getValueIfPresent(serialKey, null)); @@ -214,7 +215,7 @@ public void testIOConnect() { int masterPort = IOKitUtil.getMasterPort(); IOService smcService = IOKitUtil.getMatchingService("AppleSMC"); - assertNotNull(smcService); + assumeTrue(smcService != null); // Service is not available on github M1 runners PointerByReference connPtr = new PointerByReference(); int taskSelf = SYS.mach_task_self();