@@ -2,110 +2,121 @@ name: Build and Publish for all Platforms
22
33on : [push]
44
5+ env :
6+ SWIG_VERSION : 4.0.2
7+
58jobs :
69 validate-gradle-wrapper :
710 runs-on : ubuntu-latest
811 steps :
912 - uses : actions/checkout@v4
1013 - name : Validate Gradle Wrapper
1114 uses : gradle/wrapper-validation-action@v2
12- build-linux-windows-amd64 :
13- runs-on : ubuntu-latest
14- needs : validate-gradle-wrapper
15+ swig :
16+ strategy :
17+ matrix :
18+ os : [ubuntu-20.04, macos-12, macos-14]
19+ runs-on : ${{ matrix.os }}
1520 steps :
16- - name : Install SWIG
17- run : sudo apt-get install swig mingw-w64
18- - uses : actions/checkout@v4
19- with :
20- submodules : true
21- - name : Set up JDK
22- uses : actions/setup-java@v4
23- with :
24- java-version : ' 11'
25- distribution : ' adopt'
26- - name : Setup Gradle
27- uses : gradle/actions/setup-gradle@v3
28- - name : Build
29- run : ./gradlew buildNatives
30- - name : Upload artifacts
31- uses : actions/upload-artifact@v4
21+ - name : SWIG from cache
22+ id : cache-swig
23+ uses : actions/cache@v4
3224 with :
33- name : linux-windows-amd64-artifacts
34- path : |
35- build/natives/*/*.so
36- build/natives/*/*.dll
37- build/natives/*/*.dylib
38- build-macos-amd64 :
39- runs-on : macos-12
40- needs : validate-gradle-wrapper
41- steps :
42- - name : Install SWIG and CMake
25+ path : ${{ github.workspace }}/swig
26+ key : ${{ runner.os }}-${{ runner.arch }}-swig-${{ env.SWIG_VERSION }}
27+ - name : Install SWIG build dependencies
28+ if : steps.cache-swig.outputs.cache-hit != 'true'
29+ run : |
30+ if [ "${{ runner.os }}" == 'Linux' ]; then
31+ sudo apt-get install -y autoconf automake libtool
32+ elif [ "${{ runner.os }}" == 'macOS' ]; then
33+ brew install autoconf automake libtool pcre
34+ else
35+ echo "Unsupported OS: ${{ runner.os }}"
36+ exit 1
37+ fi
38+ - name : Build SWIG v${{ env.SWIG_VERSION }}
39+ if : steps.cache-swig.outputs.cache-hit != 'true'
4340 run : |
44- brew install swig
45- brew install cmake
41+ wget https://github.com/swig/swig/archive/refs/tags/v${{ env.SWIG_VERSION }}.tar.gz
42+ tar xzf v${{ env.SWIG_VERSION }}.tar.gz
43+ cd swig-${{ env.SWIG_VERSION }}
44+ ./autogen.sh
45+ ./configure --prefix=$GITHUB_WORKSPACE/swig
46+ make
47+ make install
48+ - name : Install SWIG runtime dependencies
49+ if : runner.os == 'macOs'
50+ run : |
51+ brew install pcre
52+ - name : Check SWIG version
53+ run : $GITHUB_WORKSPACE/swig/bin/swig -version
54+ build :
55+ strategy :
56+ matrix :
57+ os : [ubuntu-20.04, macos-12, macos-14]
58+ runs-on : ${{ matrix.os }}
59+ needs : [validate-gradle-wrapper, swig]
60+ steps :
4661 - uses : actions/checkout@v4
4762 with :
4863 submodules : true
64+ - name : Restore SWIG from cache
65+ uses : actions/cache@v4
66+ with :
67+ path : ${{ github.workspace }}/swig
68+ key : ${{ runner.os }}-${{ runner.arch }}-swig-${{ env.SWIG_VERSION }}
69+ fail-on-cache-miss : true
70+ - name : Add SWIG to $PATH
71+ run : echo "${{ github.workspace }}/swig/bin" >> $GITHUB_PATH
72+ - name : Install MinGW-w64
73+ if : runner.os == 'Linux'
74+ run : sudo apt-get install -y mingw-w64
75+ - name : Install pcre
76+ if : runner.os == 'macOS'
77+ run : brew install pcre
78+ - name : Check SWIG version
79+ run : swig -version
4980 - name : Set up JDK
5081 uses : actions/setup-java@v4
5182 with :
5283 java-version : ' 11'
53- distribution : ' adopt '
84+ distribution : ' temurin '
5485 - name : Setup Gradle
5586 uses : gradle/actions/setup-gradle@v3
5687 - name : Build
57- run : ./gradlew native_macosx_amd64_clang
88+ run : ./gradlew build buildNatives
5889 - name : Upload artifacts
5990 uses : actions/upload-artifact@v4
6091 with :
61- name : macosx-amd64 -artifacts
92+ name : ${{ runner.os }}-${{ runner.arch }} -artifacts
6293 path : |
6394 build/natives/*/*.so
6495 build/natives/*/*.dll
6596 build/natives/*/*.dylib
66- build-macos-aarch64 :
67- runs-on : macos-14
68- needs : validate-gradle-wrapper
97+ publish :
98+ runs-on : ubuntu-20.04
99+ needs : [validate-gradle-wrapper, swig, build]
100+ if : github.ref == 'refs/heads/master'
69101 steps :
70- - name : Install SWIG and CMake
71- run : |
72- brew install swig
73- brew install cmake
74102 - uses : actions/checkout@v4
75103 with :
76104 submodules : true
77- - name : Set up JDK
78- uses : actions/setup-java @v4
105+ - name : Restore SWIG from cache
106+ uses : actions/cache @v4
79107 with :
80- java-version : ' 11'
81- distribution : ' adopt'
82- - name : Setup Gradle
83- uses : gradle/actions/setup-gradle@v3
84- - name : Build
85- run : ./gradlew native_macosx_aarch64_clang
86- - name : Upload artifacts
87- uses : actions/upload-artifact@v4
88- with :
89- name : macosx-aarch64-artifacts
90- path : |
91- build/natives/*/*.so
92- build/natives/*/*.dll
93- build/natives/*/*.dylib
94- publish :
95- runs-on : ubuntu-latest
96- needs : [validate-gradle-wrapper,build-linux-windows-amd64, build-macos-amd64, build-macos-aarch64]
97- if : github.ref == 'refs/heads/master'
98- steps :
99- - name : Install SWIG
100- run : sudo apt-get install swig mingw-w64
108+ path : ${{ github.workspace }}/swig
109+ key : ${{ runner.os }}-${{ runner.arch }}-swig-${{ env.SWIG_VERSION }}
110+ fail-on-cache-miss : true
111+ - name : Add SWIG to $PATH
112+ run : echo "${{ github.workspace }}/swig/bin" >> $GITHUB_PATH
113+ - name : Check SWIG version
114+ run : swig -version
101115 - name : Set up JDK
102116 uses : actions/setup-java@v4
103117 with :
104118 java-version : ' 11'
105- distribution : ' adopt'
106- - uses : actions/checkout@v4
107- with :
108- submodules : true
119+ distribution : ' temurin'
109120 - name : Setup Gradle
110121 uses : gradle/actions/setup-gradle@v3
111122 - name : Download all artifacts
@@ -114,10 +125,7 @@ jobs:
114125 path : build/natives
115126 merge-multiple : true
116127 - name : Build and Zip Natives
117- run : ./gradlew build zipNatives
118- - run : |
119- ls -R build/natives/
120- ls -R build/libs/
128+ run : ./gradlew build zipNatives
121129 - name : Publish
122130 run : ./gradlew -Dorg.gradle.internal.publish.checksums.insecure=true publish -PmavenUser=${artifactoryUser} -PmavenPass=${artifactoryPass}
123131 env :
0 commit comments