From fffa4ef250fb2aa4fb0dd20977384090fc4b29cc Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Wed, 8 May 2024 19:57:20 -0400 Subject: [PATCH] CI: Move the nightly Android CI to GitHub actions --- .github/actions/setup/action.yml | 2 +- .github/workflows/nightly-android.yml | 100 ++++++++++++++++++++++++++ Meta/Azure/nightly-pipeline.yml | 20 ------ 3 files changed, 101 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/nightly-android.yml delete mode 100644 Meta/Azure/nightly-pipeline.yml diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 5537ef490db..3693aed9256 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -74,7 +74,7 @@ runs: sudo udevadm trigger --name-match=kvm - name: 'Install Dependencies' - if: ${{ inputs.os == 'macOS' }} + if: ${{ inputs.os == 'macOS' || inputs.os == 'Android' }} shell: bash run: | set -e diff --git a/.github/workflows/nightly-android.yml b/.github/workflows/nightly-android.yml new file mode 100644 index 00000000000..b3865c54700 --- /dev/null +++ b/.github/workflows/nightly-android.yml @@ -0,0 +1,100 @@ +name: Nightly Android + +on: + # Automatically run at the end of every day. + schedule: + - cron: '0 0 * * *' + +env: + # runner.workspace = /home/runner/work/serenity + # github.workspace = /home/runner/work/serenity/serenity + SERENITY_SOURCE_DIR: ${{ github.workspace }} + CCACHE_DIR: ${{ github.workspace }}/.ccache + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || format('{0}-{1}', github.ref, github.run_number) }} + cancel-in-progress: true + +jobs: + CI: + runs-on: ${{ matrix.os }} + if: always() && github.repository == 'SerenityOS/serenity' && github.ref == 'refs/heads/master' + strategy: + fail-fast: false + matrix: + os_name: ['Android'] + os: [macos-14] + + steps: + - uses: actions/checkout@v4 + + - name: Set Up Environment + uses: ./.github/actions/setup + with: + os: ${{ matrix.os_name }} + arch: 'Lagom' + + - name: Set Up Java + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 17 + + - name: Set Up Gradle + uses: gradle/actions/setup-gradle@v3 + + # === PREPARE FOR BUILDING === + + - name: Restore Caches + uses: ./.github/actions/cache-restore + id: 'cache-restore' + with: + os: ${{ matrix.os_name }} + arch: 'Lagom' + cache_key_extra: 'Nightly Android' + serenity_ccache_path: ${{ env.CCACHE_DIR }} + download_cache_path: ${{ github.workspace }}/Build/caches + + - name: Assign Build Parameters + id: 'build-parameters' + run: | + echo "host_cc=$(brew --prefix llvm@18)/bin/clang" >> "$GITHUB_OUTPUT" + echo "host_cxx=$(brew --prefix llvm@18)/bin/clang++" >> "$GITHUB_OUTPUT" + + - name: Install NDK + run: | + yes | ${ANDROID_SDK_ROOT}/tools/bin/sdkmanager "ndk;26.1.10909125" + + - name: Start Android Emulator + run: | + # Install AVD files + echo "y" | ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install 'system-images;android-30;google_apis;x86_64' + + # Create emulator + echo "no" | ${ANDROID_HOME}/tools/bin/avdmanager create avd -n xamarin_android_emulator -k 'system-images;android-30;google_apis;x86_64' --force + + ${ANDROID_HOME}/emulator/emulator -list-avds + + echo "Starting emulator" + + # Start emulator in background + nohup ${ANDROID_HOME}/emulator/emulator -avd xamarin_android_emulator -no-snapshot > /dev/null 2>&1 & + ${ANDROID_HOME}/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done; input keyevent 82' + ${ANDROID_HOME}/platform-tools/adb devices + echo "Emulator started" + + # === BUILD === + + - name: Build and Test + working-directory: ${{ github.workspace }}/Ladybird/Android + run: ./gradlew connectedAndroidTest + env: + GRADLE_OPTS: '-Xmx3072m' + SERENITY_CACHE_DIR: ${{ github.workspace }}/Build/caches + + - name: Save Caches + uses: ./.github/actions/cache-save + with: + arch: 'Lagom' + serenity_ccache_path: ${{ env.CCACHE_DIR }} + serenity_ccache_primary_key: ${{ steps.cache-restore.outputs.serenity_ccache_primary_key }} diff --git a/Meta/Azure/nightly-pipeline.yml b/Meta/Azure/nightly-pipeline.yml deleted file mode 100644 index f9e5ed5d2c4..00000000000 --- a/Meta/Azure/nightly-pipeline.yml +++ /dev/null @@ -1,20 +0,0 @@ -# Pipeline definition for nightly or other scheduled jobs we don't want to run on every PR in Azure -schedules: -- cron: "0 0 * * *" - displayName: Daily midnight build - branches: - include: - - master - -# Github YAML pipelines have CI and PR triggers on by default. -# We only want this pipeline to run nightly -pr: none -trigger: none - -stages: - - stage: Lagom_Android - dependsOn: [] - jobs: - - template: Lagom.yml - parameters: - os: 'Android'