|
| 1 | +name: Build axTLS static libraries |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + workflow_dispatch: |
| 6 | + push: |
| 7 | + branches: [ master ] |
| 8 | + paths: |
| 9 | + - axtls/** |
| 10 | + - .github/workflows/build-axtls.yml |
| 11 | + pull_request: |
| 12 | + branches: [ master ] |
| 13 | + paths: |
| 14 | + - axtls/** |
| 15 | + - .github/workflows/build-axtls.yml |
| 16 | + |
| 17 | +env: |
| 18 | + AXTLS_VERSION: 2.1.5 |
| 19 | + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true |
| 20 | + |
| 21 | +jobs: |
| 22 | + build-linux: |
| 23 | + name: Build ${{ matrix.platform_arch }} |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + include: |
| 28 | + - project: linux-amd64 |
| 29 | + runner: ubuntu-22.04 |
| 30 | + docker_platform: linux/amd64 |
| 31 | + platform_arch: linux/x86_64 |
| 32 | + use_qemu: false |
| 33 | + - project: linux-arm32v7 |
| 34 | + runner: ubuntu-22.04 |
| 35 | + docker_platform: linux/arm/v7 |
| 36 | + platform_arch: linux/armv7l |
| 37 | + use_qemu: true |
| 38 | + - project: linux-arm64 |
| 39 | + runner: ubuntu-22.04-arm |
| 40 | + docker_platform: linux/arm64 |
| 41 | + platform_arch: linux/aarch64 |
| 42 | + use_qemu: false |
| 43 | + |
| 44 | + runs-on: ${{ matrix.runner }} |
| 45 | + |
| 46 | + steps: |
| 47 | + - name: Checkout source code |
| 48 | + uses: actions/checkout@v6 |
| 49 | + |
| 50 | + - name: Allow multiarch |
| 51 | + if: ${{ matrix.use_qemu }} |
| 52 | + run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes |
| 53 | + |
| 54 | + - name: Build static libraries |
| 55 | + run: | |
| 56 | + docker run \ |
| 57 | + --platform ${{ matrix.docker_platform }} \ |
| 58 | + -v "${PWD}:/sources" \ |
| 59 | + -w /sources \ |
| 60 | + -t totalcross/${{ matrix.project }}:v1.0.7 \ |
| 61 | + bash -lc " |
| 62 | + cmake --version && |
| 63 | + cmake -S /sources/axtls -B /sources/axtls/build/${{ matrix.project }} \ |
| 64 | + -DCMAKE_BUILD_TYPE=Release \ |
| 65 | + -G Ninja && |
| 66 | + cmake --build /sources/axtls/build/${{ matrix.project }} && |
| 67 | + cmake --install /sources/axtls/build/${{ matrix.project }} --prefix /sources/axtls/build/${{ matrix.project }}/install && |
| 68 | + bash /sources/axtls/scripts/package-artifact.sh \ |
| 69 | + /sources/axtls/build/${{ matrix.project }} \ |
| 70 | + /sources/axtls/build/${{ matrix.project }}/install \ |
| 71 | + ${{ matrix.platform_arch }} |
| 72 | + " |
| 73 | +
|
| 74 | + - name: Upload artifact |
| 75 | + uses: actions/upload-artifact@v7 |
| 76 | + with: |
| 77 | + name: axtls-${{ matrix.project }} |
| 78 | + path: axtls/build/${{ matrix.project }}/axtls-*.tar.gz |
| 79 | + |
| 80 | + build-windows: |
| 81 | + name: Build windows/${{ matrix.arch }} |
| 82 | + strategy: |
| 83 | + fail-fast: false |
| 84 | + matrix: |
| 85 | + include: |
| 86 | + - arch: x86 |
| 87 | + runner: windows-2022 |
| 88 | + cmake_platform: Win32 |
| 89 | + - arch: x64 |
| 90 | + runner: windows-2022 |
| 91 | + cmake_platform: x64 |
| 92 | + - arch: arm64 |
| 93 | + runner: windows-11-arm |
| 94 | + cmake_platform: ARM64 |
| 95 | + |
| 96 | + runs-on: ${{ matrix.runner }} |
| 97 | + |
| 98 | + steps: |
| 99 | + - name: Checkout source code |
| 100 | + uses: actions/checkout@v6 |
| 101 | + |
| 102 | + - name: Build static libraries |
| 103 | + shell: bash |
| 104 | + run: | |
| 105 | + cmake -S axtls -B axtls/build/windows-${{ matrix.arch }} \ |
| 106 | + -DCMAKE_BUILD_TYPE=Release \ |
| 107 | + -G "Visual Studio 17 2022" \ |
| 108 | + -A ${{ matrix.cmake_platform }} |
| 109 | + cmake --build axtls/build/windows-${{ matrix.arch }} --config Release |
| 110 | + cmake --install axtls/build/windows-${{ matrix.arch }} --config Release --prefix axtls/build/windows-${{ matrix.arch }}/install |
| 111 | + bash axtls/scripts/package-artifact.sh axtls/build/windows-${{ matrix.arch }} axtls/build/windows-${{ matrix.arch }}/install windows/${{ matrix.arch }} |
| 112 | +
|
| 113 | + - name: Upload artifact |
| 114 | + uses: actions/upload-artifact@v7 |
| 115 | + with: |
| 116 | + name: axtls-windows-${{ matrix.arch }} |
| 117 | + path: axtls/build/windows-${{ matrix.arch }}/axtls-*.tar.gz |
| 118 | + |
| 119 | + build-android: |
| 120 | + name: Build android/arm64-v8a |
| 121 | + runs-on: ubuntu-24.04 |
| 122 | + |
| 123 | + steps: |
| 124 | + - name: Checkout source code |
| 125 | + uses: actions/checkout@v6 |
| 126 | + |
| 127 | + - name: Setup Android SDK |
| 128 | + uses: android-actions/setup-android@v3 |
| 129 | + with: |
| 130 | + packages: '' |
| 131 | + |
| 132 | + - name: Install Android NDK |
| 133 | + run: sdkmanager "ndk;28.2.13676358" "cmake;3.22.1" |
| 134 | + |
| 135 | + - name: Build static libraries |
| 136 | + run: | |
| 137 | + cmake -S axtls -B axtls/build/android-arm64-v8a \ |
| 138 | + -DCMAKE_BUILD_TYPE=Release \ |
| 139 | + -DCMAKE_TOOLCHAIN_FILE="${ANDROID_HOME}/ndk/28.2.13676358/build/cmake/android.toolchain.cmake" \ |
| 140 | + -DANDROID_ABI=arm64-v8a \ |
| 141 | + -DANDROID_PLATFORM=android-23 \ |
| 142 | + -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=OFF \ |
| 143 | + -G Ninja |
| 144 | + cmake --build axtls/build/android-arm64-v8a |
| 145 | + cmake --install axtls/build/android-arm64-v8a --prefix axtls/build/android-arm64-v8a/install |
| 146 | + bash axtls/scripts/package-artifact.sh axtls/build/android-arm64-v8a axtls/build/android-arm64-v8a/install android/arm64-v8a |
| 147 | +
|
| 148 | + - name: Upload artifact |
| 149 | + uses: actions/upload-artifact@v7 |
| 150 | + with: |
| 151 | + name: axtls-android-arm64-v8a |
| 152 | + path: axtls/build/android-arm64-v8a/axtls-*.tar.gz |
| 153 | + |
| 154 | + build-apple: |
| 155 | + name: Build ${{ matrix.platform }}/${{ matrix.arch }} |
| 156 | + strategy: |
| 157 | + fail-fast: false |
| 158 | + matrix: |
| 159 | + include: |
| 160 | + - platform: macos |
| 161 | + arch: arm64 |
| 162 | + build_dir: macos-arm64 |
| 163 | + cmake_generator: Ninja |
| 164 | + cmake_args: -DCMAKE_OSX_ARCHITECTURES=arm64 |
| 165 | + - platform: ios |
| 166 | + arch: arm64 |
| 167 | + build_dir: ios-arm64 |
| 168 | + cmake_generator: Xcode |
| 169 | + cmake_args: -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO |
| 170 | + - platform: ios-simulator |
| 171 | + arch: arm64 |
| 172 | + build_dir: ios-simulator-arm64 |
| 173 | + cmake_generator: Xcode |
| 174 | + cmake_args: -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO |
| 175 | + |
| 176 | + runs-on: macos-15 |
| 177 | + |
| 178 | + steps: |
| 179 | + - name: Checkout source code |
| 180 | + uses: actions/checkout@v6 |
| 181 | + |
| 182 | + - name: Build static libraries |
| 183 | + run: | |
| 184 | + cmake -S axtls -B axtls/build/${{ matrix.build_dir }} \ |
| 185 | + -DCMAKE_BUILD_TYPE=Release \ |
| 186 | + ${{ matrix.cmake_args }} \ |
| 187 | + -G "${{ matrix.cmake_generator }}" |
| 188 | + cmake --build axtls/build/${{ matrix.build_dir }} --config Release |
| 189 | + cmake --install axtls/build/${{ matrix.build_dir }} --config Release --prefix axtls/build/${{ matrix.build_dir }}/install |
| 190 | + bash axtls/scripts/package-artifact.sh axtls/build/${{ matrix.build_dir }} axtls/build/${{ matrix.build_dir }}/install ${{ matrix.platform }}/${{ matrix.arch }} |
| 191 | +
|
| 192 | + - name: Upload artifact |
| 193 | + uses: actions/upload-artifact@v7 |
| 194 | + with: |
| 195 | + name: axtls-${{ matrix.build_dir }} |
| 196 | + path: axtls/build/${{ matrix.build_dir }}/axtls-*.tar.gz |
| 197 | + |
| 198 | + package-ios: |
| 199 | + name: Package iOS XCFramework |
| 200 | + needs: build-apple |
| 201 | + runs-on: macos-15 |
| 202 | + |
| 203 | + steps: |
| 204 | + - name: Download iOS device artifact |
| 205 | + uses: actions/download-artifact@v7 |
| 206 | + with: |
| 207 | + name: axtls-ios-arm64 |
| 208 | + path: package-input/ios |
| 209 | + |
| 210 | + - name: Download iOS simulator artifact |
| 211 | + uses: actions/download-artifact@v7 |
| 212 | + with: |
| 213 | + name: axtls-ios-simulator-arm64 |
| 214 | + path: package-input/ios-simulator |
| 215 | + |
| 216 | + - name: Create XCFramework |
| 217 | + run: | |
| 218 | + mkdir -p package-work package-output |
| 219 | + tar -xzf package-input/ios/axtls-ios-arm64.tar.gz -C package-work |
| 220 | + tar -xzf package-input/ios-simulator/axtls-ios-simulator-arm64.tar.gz -C package-work |
| 221 | +
|
| 222 | + device_root="${PWD}/package-work/axtls/ios/arm64" |
| 223 | + simulator_root="${PWD}/package-work/axtls/ios-simulator/arm64" |
| 224 | + if [ ! -f "${device_root}/lib/libaxtls.a" ] || [ ! -f "${simulator_root}/lib/libaxtls.a" ]; then |
| 225 | + echo "Unable to locate libaxtls.a in axTLS iOS artifacts" >&2 |
| 226 | + exit 1 |
| 227 | + fi |
| 228 | +
|
| 229 | + mkdir -p package-output/ios package-output/ios-simulator |
| 230 | + device_lib="${device_root}/lib/libaxtls.a" |
| 231 | + simulator_lib="${simulator_root}/lib/libaxtls.a" |
| 232 | +
|
| 233 | + if [ -z "${device_lib}" ] || [ -z "${simulator_lib}" ]; then |
| 234 | + echo "Unable to locate axTLS iOS static libraries" >&2 |
| 235 | + exit 1 |
| 236 | + fi |
| 237 | +
|
| 238 | + xcodebuild -create-xcframework \ |
| 239 | + -library "${device_lib}" -headers "${device_root}/include" \ |
| 240 | + -library "${simulator_lib}" -headers "${simulator_root}/include" \ |
| 241 | + -output package-output/axtls-ios.xcframework |
| 242 | +
|
| 243 | + cd package-output |
| 244 | + ditto -c -k --sequesterRsrc --keepParent axtls-ios.xcframework axtls-ios.xcframework.zip |
| 245 | +
|
| 246 | + - name: Upload XCFramework artifact |
| 247 | + uses: actions/upload-artifact@v7 |
| 248 | + with: |
| 249 | + name: axtls-ios-xcframework |
| 250 | + path: package-output/axtls-ios.xcframework.zip |
0 commit comments