Cleanup disk space on Linux #71
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: sdk-install-demo ci | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| pull_request: | |
| jobs: | |
| install-sdk: | |
| strategy: | |
| matrix: | |
| include: | |
| #- name: 'macOS 26' | |
| # os: 'macos-26' | |
| # ANDROID_API: 28 | |
| # EMULATOR_ARCH: 'arm64-v8a' | |
| # EMULATOR_GPU: 'swiftshader_indirect' | |
| #- name: 'macOS 15' | |
| # os: 'macos-15' | |
| # ANDROID_API: 28 | |
| # EMULATOR_ARCH: 'arm64-v8a' | |
| # EMULATOR_GPU: 'swiftshader_indirect' | |
| #- name: 'macOS 14' | |
| # os: 'macos-14' | |
| # ANDROID_API: 28 | |
| # EMULATOR_ARCH: 'arm64-v8a' | |
| # EMULATOR_GPU: 'swiftshader_indirect' | |
| - name: 'macOS 15 Intel API 28' | |
| os: 'macos-15-intel' | |
| ANDROID_API: 28 | |
| EMULATOR_ARCH: 'x86_64' | |
| EMULATOR_GPU: 'swiftshader_indirect' | |
| - name: 'macOS 13 API 28' | |
| os: 'macos-13' | |
| ANDROID_API: 28 | |
| EMULATOR_ARCH: 'x86_64' | |
| EMULATOR_GPU: 'swiftshader_indirect' | |
| - name: 'Ubuntu Latest API 28' | |
| os: 'ubuntu-latest' | |
| ANDROID_API: 28 | |
| EMULATOR_ARCH: 'x86_64' | |
| EMULATOR_GPU: 'swiftshader_indirect' | |
| - name: 'Ubuntu Latest API 29' | |
| os: 'ubuntu-latest' | |
| ANDROID_API: 29 | |
| EMULATOR_ARCH: 'x86_64' | |
| EMULATOR_GPU: 'swiftshader_indirect' | |
| - name: 'Ubuntu Latest API 30' | |
| os: 'ubuntu-latest' | |
| ANDROID_API: 30 | |
| EMULATOR_ARCH: 'x86_64' | |
| EMULATOR_GPU: 'swiftshader_indirect' | |
| - name: 'Ubuntu Latest API 31' | |
| os: 'ubuntu-latest' | |
| ANDROID_API: 31 | |
| EMULATOR_ARCH: 'x86_64' | |
| EMULATOR_GPU: 'swiftshader_indirect' | |
| - name: 'Ubuntu Latest API 32' | |
| os: 'ubuntu-latest' | |
| ANDROID_API: 32 | |
| EMULATOR_ARCH: 'x86_64' | |
| EMULATOR_GPU: 'swiftshader_indirect' | |
| - name: 'Ubuntu Latest API 33' | |
| os: 'ubuntu-latest' | |
| ANDROID_API: 33 | |
| EMULATOR_ARCH: 'x86_64' | |
| EMULATOR_GPU: 'swiftshader_indirect' | |
| - name: 'Ubuntu Latest API 34' | |
| os: 'ubuntu-latest' | |
| ANDROID_API: 34 | |
| EMULATOR_ARCH: 'x86_64' | |
| EMULATOR_GPU: 'swiftshader_indirect' | |
| - name: 'Ubuntu Latest API 35' | |
| os: 'ubuntu-latest' | |
| ANDROID_API: 35 | |
| EMULATOR_ARCH: 'x86_64' | |
| EMULATOR_GPU: 'swiftshader_indirect' | |
| fail-fast: false | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| ANDROID_API: ${{ matrix.ANDROID_API }} | |
| EMULATOR_ARCH: ${{ matrix.EMULATOR_ARCH }} | |
| EMULATOR_GPU: ${{ matrix.EMULATOR_GPU }} | |
| EMULATOR_ENGINE: ${{ matrix.EMULATOR_ENGINE }} | |
| ANDROID_TARGET: 'default' | |
| #ANDROID_BUILD_TOOLS_VERSION: 36.0.0 | |
| ANDROID_BUILD_TOOLS_VERSION: 'latest' | |
| ANDROID_EMULATOR_NAME: 'demo' | |
| ANDROID_PROFILE: "Nexus 10" | |
| ANDROID_CHANNEL: "3" | |
| BUILD_TOOLS_VERSION: "35.0.0" | |
| steps: | |
| - name: Free Disk Space | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf "/usr/local/share/boost" | |
| sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
| - name: Enable KVM | |
| if: runner.os == 'Linux' | |
| 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 | |
| - uses: skiptools/actions/setup-skip@v1 | |
| - uses: nttld/setup-ndk@v1 | |
| id: setup-ndk | |
| with: | |
| ndk-version: r27d | |
| - name: "Setup Environment" | |
| run: | | |
| echo "$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools/${{ env.ANDROID_BUILD_TOOLS_VERSION }}" >> $GITHUB_PATH | |
| echo "ANDROID_NDK_HOME=${{ steps.setup-ndk.outputs.ndk-path }}" >> $GITHUB_ENV | |
| # needed for Linux or else the emulator will be created in | |
| # ~/.android/avd but it will be sought in ~/.config/.android/avd | |
| if [[ "${RUNNER_OS}" == "Linux" ]]; then | |
| echo "ANDROID_AVD_HOME=${XDG_CONFIG_HOME}/.android/avd" >> $GITHUB_ENV | |
| fi | |
| - uses: skiptools/swift-android-action@v2 | |
| with: | |
| build-package: false | |
| - name: SDKs - accept licenses | |
| run: yes y | sdkmanager --licenses | |
| - name: SKDs - setup build tools | |
| run: sdkmanager --install "build-tools;${BUILD_TOOLS_VERSION}" platform-tools "platforms;android-${ANDROID_API}" --channel="${ANDROID_CHANNEL}" | |
| - name: SKDs - setup emulator | |
| run: sdkmanager --install emulator --channel="${ANDROID_CHANNEL}" | |
| - name: SKDs - download required images | |
| run: sdkmanager --install "system-images;android-${ANDROID_API};${ANDROID_TARGET};${EMULATOR_ARCH}" --channel="${ANDROID_CHANNEL}" | |
| - name: Emulator - Create | |
| run: avdmanager --verbose create avd --force -n "${ANDROID_EMULATOR_NAME}" --device "${ANDROID_PROFILE}" --abi "${ANDROID_TARGET}/${EMULATOR_ARCH}" --package "system-images;android-${ANDROID_API};${ANDROID_TARGET};${EMULATOR_ARCH}" --sdcard 512M | |
| - name: Emulator - Find AVDs | |
| run: find ~/ -type d -name '*.avd' | |
| - name: Emulator - List AVDs | |
| run: emulator -list-avds | |
| - name: Emulator - Boot | |
| run: nohup emulator -memory 4096 -avd "${ANDROID_EMULATOR_NAME}" -wipe-data -no-window -accel off -no-accel -gpu "${EMULATOR_GPU}" -no-snapshot -noaudio -no-boot-anim & | |
| - name: ADB Wait For Device | |
| run: adb wait-for-any-device | |
| timeout-minutes: 3 | |
| - name: "Check Emulator" | |
| run: | | |
| adb shell 'echo Hello Android!' | |
| - name: "Test Swift Package" | |
| run: | | |
| mkdir PackageDemo | |
| cd PackageDemo | |
| swift package init | |
| swift test | |
| skip android test --verbose --arch ${EMULATOR_ARCH} | |