meta-ast 0.4.0

Polyglot static-analysis engine: extract symbols and cross-language dependency graphs from 8 supported source languages, with optional MetaCall deployment manifest generation.
Documentation
name: Android Test

on:
  workflow_dispatch:
  pull_request:
  push:
    tags:
      - "v*.*.*"
    branches:
      - master
      - develop

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

jobs:
  android-build:
    name: Android NDK Build
    runs-on: ubuntu-latest

    # TODO: Add more architectures
    strategy:
      fail-fast: false
      matrix:
        abi: [x86_64]
        api-level: [30]
        build: [release]
        # TODO: This may be removed
        target: [google_apis]

    env:
      ANDROID_NDK_VERSION: "26.1.10909125"

    steps:
      - name: Check out the repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Set up JDK 17
        uses: actions/setup-java@v4
        with:
          java-version: '17'
          distribution: 'temurin'

      - name: Setup Android SDK
        uses: android-actions/setup-android@v3

      - name: Install Android NDK
        run: |
          sdkmanager --install "ndk;${{ env.ANDROID_NDK_VERSION }}"
          echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/${{ env.ANDROID_NDK_VERSION }}" >> $GITHUB_ENV
          echo "ANDROID_NDK=$ANDROID_HOME/ndk/${{ env.ANDROID_NDK_VERSION }}" >> $GITHUB_ENV

      - name: Install dependencies
        run: ./tools/metacall-environment.sh ${{ matrix.build }} base android

      - name: Create build directory
        run: mkdir -p build

      - name: Configure CMake for Android
        working-directory: ./build
        env:
          ANDROID_API_LEVEL: ${{ matrix.api-level }}
          ANDROID_ABI: ${{ matrix.abi }}
        run: ../tools/metacall-configure.sh ${{ matrix.build }} base android scripts tests

      - name: Build
        working-directory: ./build
        run: ../tools/metacall-build.sh ${{ matrix.build }} tests

  #     - name: Upload build artifacts
  #       uses: actions/upload-artifact@v4
  #       with:
  #         name: android-build-${{ matrix.abi }}-api${{ matrix.api-level }}-${{ matrix.build }}
  #         path: ./build

  # android-emulator-test:
  #   name: Android Emulator Test
  #   needs: android-build
  #   runs-on: ubuntu-latest

  #   # TODO: Add more architectures
  #   strategy:
  #     fail-fast: false
  #     matrix:
  #       api-level: [30]
  #       target: [google_apis]
  #       arch: [x86_64]
  #       build: [release]

  #   steps:
  #     - name: Check out the repository
  #       uses: actions/checkout@v4
  #       with:
  #         fetch-depth: 0

      - name: Enable KVM
        run: |
          echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
          sudo udevadm control --reload-rules
          sudo udevadm trigger --name-match=kvm

      # - name: Download build artifacts
      #   uses: actions/download-artifact@v4
      #   with:
      #     name: android-build-${{ matrix.abi }}-api${{ matrix.api-level }}-${{ matrix.build }}
      #     path: build

      # - name: Set up JDK 17
      #   uses: actions/setup-java@v4
      #   with:
      #     java-version: '17'
      #     distribution: 'temurin'

      # - name: Setup Android SDK
      #   uses: android-actions/setup-android@v3

      # - name: Install Android NDK for libc++_shared.so
      #   run: |
      #     sdkmanager --install "ndk;26.1.10909125"
      #     echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/26.1.10909125" >> $GITHUB_ENV

      - name: Run tests on Android Emulator
        uses: reactivecircus/android-emulator-runner@v2
        with:
          api-level: ${{ matrix.api-level }}
          target: ${{ matrix.target }}
          arch: ${{ matrix.arch }}
          force-avd-creation: false
          emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
          disable-animations: true
          script: |
            echo "=== Pushing test files to emulator ==="
            adb push build/ /data/local/tmp/metacall/

            echo ""
            echo "=== Files on emulator ==="
            adb shell "ls -la /data/local/tmp/metacall/"

            echo "TODO: Run CTest with emulator"