Skip to content

Commit dda4265

Browse files
authored
added pr-test (#8)
* added pr-test
1 parent 4383a3b commit dda4265

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

.github/workflows/pr-test.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Tests for all platforms
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- master
8+
- develop
9+
10+
jobs:
11+
build-native:
12+
name: Build Native Library (${{ matrix.os }} - ${{ matrix.arch }})
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
# https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
17+
include:
18+
- os: ubuntu-24.04
19+
arch: x64
20+
OUT_OS_NAME: linux
21+
- os: ubuntu-24.04-arm
22+
arch: arm64
23+
OUT_OS_NAME: linux
24+
- os: macos-13
25+
arch: x64
26+
OUT_OS_NAME: darwin
27+
- os: macos-15
28+
arch: arm64
29+
OUT_OS_NAME: darwin
30+
- os: windows-2025
31+
arch: x64
32+
OUT_OS_NAME: windows
33+
# - os: windows-11-arm
34+
# arch: arm64
35+
# OUT_OS_NAME: windows
36+
fail-fast: false
37+
38+
steps:
39+
- name: Checkout code
40+
uses: actions/checkout@v4
41+
42+
# Existing build steps remain unchanged
43+
- name: Setup Julia
44+
uses: julia-actions/setup-julia@v2
45+
with:
46+
version: '1.11'
47+
48+
- name: Setup JDK
49+
uses: actions/setup-java@v4
50+
with:
51+
distribution: 'temurin'
52+
java-version: '21'
53+
54+
# Install cross toolchain for aarch64 on Ubuntu
55+
- name: Install cross toolchain (aarch64)
56+
if: ${{ startsWith(matrix.os, 'ubuntu-') && matrix.arch == 'aarch64' }}
57+
run: |
58+
sudo apt-get update
59+
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
60+
61+
- name: Install dependencies
62+
shell: bash
63+
run: |
64+
if [[ "$RUNNER_OS" == "Linux" ]]; then
65+
sudo apt-get update
66+
sudo apt-get install -y cmake swig gcc g++
67+
elif [[ "$RUNNER_OS" == "macOS" ]]; then
68+
brew update
69+
brew install cmake swig
70+
elif [[ "$RUNNER_OS" == "Windows" ]]; then
71+
choco install cmake swig
72+
fi
73+
74+
- name: Build native library
75+
shell: bash
76+
run: |
77+
cd swig
78+
cmake .
79+
cmake --build . --config Release
80+
cmake --install . --config Release
81+
cd ..
82+
echo "Library built at: $(pwd)/src/main/resources/native/${{ matrix.OUT_OS_NAME }}/${{ matrix.arch }}"
83+
84+
- name: Local test of native library
85+
shell: bash
86+
run: |
87+
if [[ "$RUNNER_OS" == "Windows" ]]; then
88+
./gradlew.bat test
89+
else
90+
./gradlew test
91+
fi
92+
echo "Native library tests passed."

0 commit comments

Comments
 (0)