name: Build on: push: branches: ["master"] paths-ignore: - 'README.md' workflow_dispatch: pull_request: jobs: build: name: Build on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ ubuntu-latest, windows-latest, macos-14 ] steps: - name: Check out uses: actions/checkout@v4 with: submodules: 'recursive' ssh-key: ${{ secrets.SSH_KEY }} fetch-depth: 0 - name: Set up JDK 21 uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '21' cache: 'gradle' - uses: seanmiddleditch/gha-setup-ninja@master with: version: 1.12.1 - name: ccache uses: hendrikmuhs/ccache-action@v1 with: key: ${{ runner.os }}-${{ github.sha }} restore-keys: ${{ runner.os }} - name: Setup Android SDK uses: android-actions/setup-android@v3 - name: Remove Android's cmake shell: bash run: rm -rf $ANDROID_HOME/cmake - name: Build with Gradle run: | ccache -o cache_dir=${{ github.workspace }}/.ccache ccache -o hash_dir=false ccache -o compiler_check='%compiler% -dumpmachine; %compiler% -dumpversion' ccache -p echo 'android.native.buildOutput=verbose' >> gradle.properties ./gradlew :lsplant:publishToMavenLocal :lsplant:prefabDebugPackage ./gradlew --stop env: ORG_GRADLE_PROJECT_signingKey: ${{ secrets.maven_pgp_signingKey }} ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.maven_pgp_signingPassword }} - name: Upload library uses: actions/upload-artifact@v4 with: name: ${{ matrix.os }}-library path: ~/.m2 include-hidden-files: true test: needs: build name: Test on API ${{ matrix.api-level }} ${{ matrix.arch }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: - api-level: 21 target: default arch: x86_64 - api-level: 21 target: default arch: x86 - api-level: 22 target: default arch: x86_64 - api-level: 22 target: default arch: x86 - api-level: 23 target: default arch: x86_64 - api-level: 23 target: default arch: x86 - api-level: 24 target: default arch: x86_64 - api-level: 24 target: default arch: x86 - api-level: 25 target: default arch: x86_64 - api-level: 25 target: default arch: x86 - api-level: 26 target: default arch: x86_64 - api-level: 26 target: default arch: x86 - api-level: 27 target: default arch: x86_64 - api-level: 27 target: default arch: x86 - api-level: 28 target: default arch: x86_64 - api-level: 28 target: default arch: x86 - api-level: 29 target: default arch: x86_64 - api-level: 29 target: default arch: x86 - api-level: 30 target: default arch: x86_64 - api-level: 30 target: google_apis arch: x86 - api-level: 31 target: default arch: x86_64 - api-level: 31 target: android-tv arch: x86 - api-level: 32 target: google_apis arch: x86_64 - api-level: 33 target: default arch: x86_64 - api-level: 33 target: android-tv arch: x86 - api-level: 34 target: default arch: x86_64 - api-level: 34 target: android-tv arch: x86 - api-level: 35 target: default arch: x86_64 - api-level: Baklava target: google_apis arch: x86_64 steps: - name: checkout uses: actions/checkout@v4 with: submodules: 'recursive' ssh-key: ${{ secrets.SSH_KEY }} - name: Set up JDK 21 uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '21' cache: 'gradle' - uses: seanmiddleditch/gha-setup-ninja@master with: version: 1.12.1 - name: ccache uses: hendrikmuhs/ccache-action@v1 with: key: ${{ runner.os }}-${{ github.sha }} restore-keys: ${{ runner.os }} save: false - name: Enable KVM group perms 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: run tests uses: reactivecircus/android-emulator-runner@b683a061eaff4aac4d0b585bfd0cf714a40aee93 with: api-level: ${{ matrix.api-level }} arch: ${{ matrix.arch }} target: ${{ matrix.target }} script: | rm -rf $ANDROID_HOME/cmake ccache -o cache_dir=${{ github.workspace }}/.ccache ccache -o hash_dir=false ccache -o compiler_check='%compiler% -dumpmachine; %compiler% -dumpversion' ./gradlew :test:connectedCheck emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: true avd-name: ${{ matrix.api-level }}_${{ matrix.arch }} - name: Upload outputs if: always() uses: actions/upload-artifact@v4 with: name: test-outputs-${{ matrix.arch }}-${{ matrix.target }}-${{ matrix.api-level }} path: | test/build/outputs !test/build/outputs/apk cf-test: name: Test ${{ matrix.device }} runs-on: ubuntu-24.04 env: CF_HOME: /home/runner/aosp_cf_phone strategy: fail-fast: false matrix: include: - branch: "aosp-main" device: "aosp_cf_x86_64_phone" steps: - name: checkout uses: actions/checkout@v4 with: submodules: 'recursive' ssh-key: ${{ secrets.SSH_KEY }} - name: Set up JDK 21 uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '21' cache: 'gradle' - name: ccache uses: hendrikmuhs/ccache-action@v1 with: key: ${{ runner.os }}-${{ github.sha }} restore-keys: ${{ runner.os }} save: false - name: Setup Cuttlefish environment run: | .github/cuttlefish.sh setup .github/cuttlefish.sh download ${{ matrix.branch }} ${{ matrix.device }} curl -LO https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-linux.zip unzip ninja-linux.zip -d $ANDROID_HOME/platform-tools chmod +x $ANDROID_HOME/platform-tools/ninja rm -rf $ANDROID_HOME/cmake ccache -o cache_dir=${{ github.workspace }}/.ccache ccache -o hash_dir=false ccache -o compiler_check='%compiler% -dumpmachine; %compiler% -dumpversion' - name: Run Cuttlefish test timeout-minutes: 10 run: su $USER -c '.github/cuttlefish.sh test' - name: Upload logs on error if: ${{ failure() }} uses: actions/upload-artifact@v4 with: name: "cvd-logs-${{ matrix.device }}" path: | /home/runner/aosp_cf_phone/cuttlefish/instances/cvd-1/logs /home/runner/aosp_cf_phone/cuttlefish/instances/cvd-1/cuttlefish_config.json