Skip to content

kn: re-enable cross-compilation on Linux hosts #453

kn: re-enable cross-compilation on Linux hosts

kn: re-enable cross-compilation on Linux hosts #453

Workflow file for this run

name: CI
on:
pull_request:
workflow_dispatch:
env:
PACKAGE_NAME: aws-crt-kotlin
RUN: ${{ github.run_id }}-${{ github.run_number }}
# generated dockcross scripts default to `podman` when installed which
# has issues when building with docker then executing via dockcross script which
# picks up `podman` instead.
OCI_EXE: docker
jobs:
jvm:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# we build with a specific JDK version but source/target compatibility should ensure the jar is usable by
# the target versions we want to support
java-version:
- 8
- 11
- 17
- 21
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup build environment
uses: ./.github/actions/setup-build
- name: Test with ${{ matrix.java-version }}
shell: bash
run: |
./gradlew jvmApiCheck
./gradlew -Ptest.java.version=${{ matrix.java-version }} -Paws.sdk.kotlin.crt.disableCrossCompile=true jvmTest --stacktrace
- name: Save Test Reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-reports-jvm-${{ matrix.java-version }}
path: '**/build/reports'
# macos-14 build and test for targets: jvm, macoArm64, iosSimulatorArm64, watchosSimulatorArm65, tvosSimulatorArm64
# macos-13 build and test for targets: jvm, macoX64, iosX64, tvosX64, watchosX64
macos:
strategy:
fail-fast: false
matrix:
os: [macos-14, macos-13]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup build environment
uses: ./.github/actions/setup-build
- name: Build and Test ${{ env.PACKAGE_NAME }}
run: |
./gradlew -Paws.sdk.kotlin.crt.disableCrossCompile=true build
- name: Save Test Reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-reports-macos-${{ matrix.os }}
path: '**/build/reports'
# build and test for targets: jvm, linuxX64
# cross compile for: linuxX64, linuxArm64
# TODO - add mingw as cross compile target
linux:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup build environment
uses: ./.github/actions/setup-build
- name: Configure Docker Images
run: |
./docker-images/build-all.sh
- name: Debug OpenSSL headers and libs
run: |
echo "πŸ” OpenSSL dev packages installed:"
dpkg -l | grep libssl
echo ""
echo "πŸ“ OpenSSL headers:"
ls -l /usr/include/openssl
grep -A5 EVP_MD_fetch /usr/include/openssl/evp.h || echo "❌ EVP_MD_fetch not found in headers"
echo ""
echo "πŸ”§ pkg-config output:"
pkg-config --modversion openssl || echo "❌ pkg-config not available"
pkg-config --cflags openssl || echo "❌ pkg-config not available"
pkg-config --libs openssl || echo "❌ pkg-config not available"
echo ""
echo "πŸ”— What libssl is linked by default:"
ldconfig -p | grep libssl
echo ""
echo "πŸ§ͺ Try compiling a probe:"
echo '#include <openssl/evp.h>
int main() { EVP_MD_fetch(0, 0, 0); return 0; }' > test.c
gcc -Werror -o test test.c -lssl -lcrypto && echo "βœ… Compiles EVP_MD_fetch" || echo "❌ Compilation failed"
- name: Build and Test ${{ env.PACKAGE_NAME }}
run: |
./gradlew build
- name: Generate cross platform test binaries
run: |
./gradlew linuxTestBinaries
- uses: actions/upload-artifact@v4
with:
name: native-test-binaries
path: |
aws-crt-kotlin/build/bin
.github/scripts
retention-days: 15
- name: Save Test Reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-reports-linux
path: '**/build/reports'
retention-days: 15
# test multiple os/architecture combinations for targets: linuxX64, linuxArm64
# re-use test binaries cross compiled on previous build step
linux-native:
runs-on: ubuntu-22.04
needs: linux
strategy:
fail-fast: false
matrix:
arch: [x64, arm64]
distro:
- ubuntu-22.04
- al2023
- al2
steps:
- name: Download test binaries
uses: actions/download-artifact@v4
with:
name: native-test-binaries
path: native-test-binaries
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Test ${{ matrix.os }} on ${{ matrix.arch }}
run: |
chmod -R 755 native-test-binaries
pwd
ls -lsaR
RUN_CONTAINER_TEST=./native-test-binaries/.github/scripts/run-container-test.py
$RUN_CONTAINER_TEST --distro ${{ matrix.distro }} --arch ${{ matrix.arch }} --test-bin-dir ./native-test-binaries/aws-crt-kotlin/build/bin
# windows JVM
windows:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup build environment
uses: ./.github/actions/setup-build
- name: Build and Test ${{ env.PACKAGE_NAME }}
run: |
./gradlew -P"aws.sdk.kotlin.crt.disableCrossCompile"=true build
- name: Save Test Reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-reports-windows
path: '**/build/reports'
# TODO - native test reports?
# TODO - windows native