Repository navigation
chore: merge v5.0-dev into v5.1-dev (5.0.0-rc.5 to rc.7) #4468
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and test Kotlin SDK | |
| on: | |
| workflow_call: | |
| workflow_dispatch: | |
| pull_request: | |
| paths: | |
| - 'packages/kotlin-sdk/**' | |
| - 'packages/swift-sdk/**' | |
| - 'Cargo.toml' | |
| - 'Cargo.lock' | |
| - 'packages/rs-*/**' | |
| - 'packages/rs-unified-sdk-jni/**' | |
| - 'packages/rs-sdk-ffi/**' | |
| - 'packages/rs-platform-wallet-ffi/**' | |
| - 'packages/dapi-grpc/**' | |
| - 'packages/data-contracts/**' | |
| - 'packages/*-contract/**' | |
| - 'packages/simple-signer/**' | |
| - 'docs/sdk/sdk-parity-manifest.json' | |
| - 'packages/kotlin-sdk/PARITY_SUMMARY.md' | |
| - 'scripts/check_sdk_parity_manifest.py' | |
| - 'scripts/tests/**' | |
| - '.github/workflows/kotlin-sdk-build.yml' | |
| - '.github/scripts/kotlin-instrumented-tests.sh' | |
| - '.github/actions/rust/**' | |
| - '.github/runner-requirements.json' | |
| - '.github/scripts/runner-image.py' | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: kotlin-sdk-${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| select-runner: | |
| name: Select compatible runner image | |
| if: >- | |
| github.event_name != 'pull_request' | |
| || github.event.pull_request.head.repo.full_name == github.repository | |
| || github.event.pull_request.head.repo.owner.login == 'thepastaclaw' | |
| runs-on: ubuntu-24.04 | |
| # Allow the separate 90-minute build and publication/queue window to finish. | |
| timeout-minutes: 135 | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| statuses: read | |
| actions: read | |
| outputs: | |
| labels: ${{ steps.select.outputs.labels }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Select provisioned pool or wait for the exact PR candidate | |
| id: select | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: python3 .github/scripts/runner-image.py select --kind kotlin | |
| kotlin-sdk-build: | |
| name: Kotlin SDK build + tests (x86_64 emulator) | |
| needs: select-runner | |
| runs-on: ${{ fromJSON(needs.select-runner.outputs.labels) }} | |
| # Fork PRs must not execute on a persistent runner. Keep this guard in sync | |
| # with tests-rs-workspace.yml. | |
| if: >- | |
| github.event_name != 'pull_request' | |
| || github.event.pull_request.head.repo.full_name == github.repository | |
| || github.event.pull_request.head.repo.owner.login == 'thepastaclaw' | |
| timeout-minutes: 120 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| # Preserve target/ and other untracked build outputs between runs. | |
| clean: false | |
| # The persistent runner image is the versioned CI environment. Keep | |
| # dependency installation out of the job: it required sudo and made a | |
| # CI job capable of mutating its container. Rebuild the runner image when | |
| # one of these requirements changes instead. | |
| - name: Verify exact runner requirements and load versions | |
| run: python3 .github/scripts/runner-image.py verify | |
| - name: Verify runner image dependencies | |
| run: | | |
| set -euo pipefail | |
| missing=() | |
| for tool in cmake curl jq python3 rustup unzip zip; do | |
| command -v "$tool" >/dev/null 2>&1 || missing+=("$tool") | |
| done | |
| for pkg in build-essential libgmp-dev libpulse0 libssl-dev libx11-xcb1 pkg-config; do | |
| dpkg -s "$pkg" >/dev/null 2>&1 || missing+=("$pkg") | |
| done | |
| if [ ${#missing[@]} -gt 0 ]; then | |
| echo "::error::Self-hosted runner image is missing: ${missing[*]}" | |
| echo "::error::Provision these in the pinned runner image; CI jobs must not install host packages." | |
| exit 1 | |
| fi | |
| - name: Validate executable SDK parity manifest | |
| run: | | |
| python3 scripts/check_sdk_parity_manifest.py | |
| python3 -m unittest discover -s scripts/tests -p 'test_*.py' | |
| - name: Verify repository-pinned JDK | |
| run: | | |
| JAVA_HOME_RESOLVED=$(dirname "$(dirname "$(readlink -f "$(command -v java)")")") | |
| JAVA_VERSION_OUTPUT=$("$JAVA_HOME_RESOLVED/bin/java" -version 2>&1) | |
| printf '%s\n' "$JAVA_VERSION_OUTPUT" | |
| printf '%s\n' "$JAVA_VERSION_OUTPUT" | grep -E "version \"${CI_JAVA_MAJOR}([.]|\")" | |
| echo "JAVA_HOME=$JAVA_HOME_RESOLVED" >> "$GITHUB_ENV" | |
| echo "$JAVA_HOME_RESOLVED/bin" >> "$GITHUB_PATH" | |
| - name: Verify prebaked Android SDK | |
| run: | | |
| set -euo pipefail | |
| test "${ANDROID_HOME:-}" = /opt/android-sdk | |
| test -x "$ANDROID_HOME/ndk/$CI_ANDROID_NDK/ndk-build" | |
| test -x "$ANDROID_HOME/build-tools/$CI_ANDROID_BUILD_TOOLS/aapt2" | |
| test -f "$ANDROID_HOME/platforms/android-$CI_ANDROID_API/android.jar" | |
| test -f "$ANDROID_HOME/system-images/android-$CI_ANDROID_API/default/x86_64/system.img" | |
| command -v ci-android-emulator | |
| command -v adb | |
| # Do not run setup-android/sdkmanager: the SDK is pinned and root-owned. | |
| - name: Set up repository-pinned Rust toolchain | |
| uses: ./.github/actions/rust | |
| with: | |
| target: x86_64-linux-android | |
| cache: false | |
| # Pinned: this runner is persistent, so cargo-ndk is provisioned in the | |
| # image and checked here before the NDK build can start. | |
| - name: Verify repository-pinned cargo-ndk | |
| run: | | |
| set -euo pipefail | |
| cargo ndk --version | |
| cargo ndk --version | grep -Fx "cargo-ndk $CI_CARGO_NDK_VERSION" | |
| - name: Verify repository-pinned protoc | |
| run: | | |
| set -euo pipefail | |
| protoc --version | |
| # protoc is part of the runner image. Installing it into /usr/local | |
| # from a job required sudo and made the CI container mutable. | |
| protoc --version | grep -Fx "libprotoc $CI_PROTOC_VERSION" | |
| # KVM is the only host device this job needs. The container receives it | |
| # through the kvm group; no Docker socket or host package-management | |
| # access is required. | |
| - name: Verify KVM access | |
| run: | | |
| test -c /dev/kvm | |
| test -r /dev/kvm | |
| test -w /dev/kvm | |
| ls -l /dev/kvm | |
| - name: Build native library (x86_64, dev profile) | |
| working-directory: packages/kotlin-sdk | |
| run: ./build_android.sh --abi x86_64 --profile dev --verify | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Build SDK and run unit tests | |
| working-directory: packages/kotlin-sdk | |
| run: ./gradlew :sdk:assembleDebug :sdk:testDebugUnitTest --stacktrace | |
| - name: Build KotlinExampleApp and run app unit tests | |
| working-directory: packages/kotlin-sdk | |
| run: ./gradlew :app:assembleDebug :app:testDebugUnitTest --stacktrace | |
| - name: Compile instrumented test sources (incl. testnet-tagged) | |
| working-directory: packages/kotlin-sdk | |
| run: ./gradlew :sdk:compileDebugAndroidTestKotlin --stacktrace | |
| - name: Run instrumented FFI smoke test (prebaked emulator) | |
| working-directory: packages/kotlin-sdk | |
| run: ci-android-emulator bash ../../.github/scripts/kotlin-instrumented-tests.sh | |
| - name: Upload test reports on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: kotlin-sdk-test-reports | |
| path: | | |
| packages/kotlin-sdk/sdk/build/reports | |
| packages/kotlin-sdk/sdk/build/outputs/androidTest-results | |
| packages/kotlin-sdk/KotlinExampleApp/app/build/reports |