Repository navigation
137 lines (121 loc) · 5.29 KB
/
Copy pathnative-cpu-multiarch.yml
File metadata and controls
137 lines (121 loc) · 5.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Native CPU multi-arch build
# Cross-arch CI for the FFM native kernel provider
# (skainet-backends/skainet-backend-native-cpu). The local Gradle build
# only produces a host-arch .so/.dylib/.dll; this workflow proves the
# CMake + Kotlin pipeline works on every supported host so consumers
# on Apple Silicon, ARM Linux, and Windows aren't silently broken when
# they pull a published JAR built on x86_64 Linux.
#
# Each matrix job runs the native module's jvmTest end-to-end (CMake
# configure + build + bundle into JAR resources + parity tests via
# FFM downcall). The built shared library is uploaded as an artifact
# so a later "fat-JAR" aggregation step (deferred to a follow-up PR)
# can stage all four arches into one publishable artifact.
on:
push:
branches: [main, develop]
paths:
- 'skainet-backends/skainet-backend-native-cpu/**'
- 'skainet-backends/skainet-backend-api/src/jvmMain/kotlin/sk/ainet/backend/api/kernel/**'
- '.github/workflows/native-cpu-multiarch.yml'
pull_request:
paths:
- 'skainet-backends/skainet-backend-native-cpu/**'
- 'skainet-backends/skainet-backend-api/src/jvmMain/kotlin/sk/ainet/backend/api/kernel/**'
- '.github/workflows/native-cpu-multiarch.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Set default permission for all jobs to none
permissions: {}
jobs:
native-build-test:
name: ${{ matrix.arch_label }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
arch_label: linux-x86_64
lib_name: libskainet_kernels.so
# ubuntu-24.04-arm runner is removed for now — see #574 follow-up.
# Re-add once the runner-side issue is resolved (or replace with
# a self-hosted ARM64 runner). Linux ARM64 consumers fall back
# to the priority-50 Panama Vector provider until then.
- os: macos-14
arch_label: macos-arm64
lib_name: libskainet_kernels.dylib
- os: windows-latest
arch_label: windows-x86_64
lib_name: skainet_kernels.dll
runs-on: ${{ matrix.os }}
timeout-minutes: 30
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Copy CI gradle.properties (Unix)
if: runner.os != 'Windows'
run: |
mkdir -p ~/.gradle
cp .github/ci-gradle.properties ~/.gradle/gradle.properties
- name: Copy CI gradle.properties (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path "$HOME\.gradle" | Out-Null
Copy-Item .github\ci-gradle.properties "$HOME\.gradle\gradle.properties"
- name: Set up JDK 25
uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0
with:
distribution: 'zulu'
java-version: 25
- name: Verify cmake
run: cmake --version
- name: Build + test native module (Unix)
if: runner.os != 'Windows'
env:
GRADLE_OPTS: -Dorg.gradle.jvmargs=-Xmx4g -Dfile.encoding=UTF-8
run: |
./gradlew --no-daemon --stacktrace \
:skainet-backends:skainet-backend-native-cpu:jvmTest \
:skainet-backends:skainet-backend-native-cpu:jvmJar
# Apple K/N lane (#959, iOS kernel track of #920): builds the simulator +
# macOS static archives via the macOS-host heuristic and runs the shared
# nativeTest parity suites natively (macosArm64Test, dispatch fast arm on
# the M-series runner) and in the iOS simulator (iosSimulatorArm64Test).
- name: K/N Apple simulator + host tests (macOS only)
if: matrix.arch_label == 'macos-arm64'
env:
GRADLE_OPTS: -Dorg.gradle.jvmargs=-Xmx4g -Dfile.encoding=UTF-8
run: |
./gradlew --no-daemon --stacktrace \
:skainet-backends:skainet-backend-native-cpu:macosArm64Test \
:skainet-backends:skainet-backend-native-cpu:iosSimulatorArm64Test
- name: Build + test native module (Windows)
if: runner.os == 'Windows'
shell: pwsh
env:
GRADLE_OPTS: -Dorg.gradle.jvmargs=-Xmx4g -Dfile.encoding=UTF-8
run: |
.\gradlew.bat --no-daemon --stacktrace `
:skainet-backends:skainet-backend-native-cpu:jvmTest `
:skainet-backends:skainet-backend-native-cpu:jvmJar
- name: Upload native library
if: success()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: libskainet_kernels-${{ matrix.arch_label }}
path: skainet-backends/skainet-backend-native-cpu/build/native/resources/native/${{ matrix.arch_label }}/${{ matrix.lib_name }}
if-no-files-found: error
retention-days: 14
- name: Upload test reports
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: native-cpu-test-reports-${{ matrix.arch_label }}
path: |
skainet-backends/skainet-backend-native-cpu/build/reports/tests/**
skainet-backends/skainet-backend-native-cpu/build/test-results/**
retention-days: 14