├── LICENSE ├── README.md └── azure-pipelines.yml /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Zmovirzynski 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Android Azure DevOps 2 | 3 | This repository contains the YAML configuration to create an Azure Pipelines pipeline for setting up and starting an Android emulator. The pipeline automates the process of creating and launching the emulator on a macOS machine. 4 | 5 | ## Prerequisites 6 | 7 | Before using this pipeline, make sure you have the following: 8 | 9 | - An Azure DevOps account set up with a suitable project. 10 | - A macOS agent available in your Azure Pipelines organization. 11 | 12 | ## Configuration 13 | 14 | Follow the steps below to configure the pipeline in Azure Pipelines: 15 | 16 | 1. Clone this repository to your local environment: 17 | 18 | ```bash 19 | git clone https://github.com/zmovirzynski/Android-Azure-Devops.git 20 | ``` 21 | 22 | In Azure DevOps, navigate to the project where you want to set up the pipeline. 23 | 24 | In the project dashboard, go to **Pipelines** and click **New Pipeline**. 25 | 26 | Choose the source code repository to be the cloned repository from earlier. 27 | 28 | Select the `azure-pipelines.yml` configuration file from this repository. 29 | 30 | Review and customize the YAML file as needed to fit your requirements. 31 | 32 | Save and run the pipeline. 33 | 34 | ## Pipeline 35 | 36 | The pipeline consists of a single job: 37 | 38 | **Job: macOS** 39 | **Pool: macOS-latest** 40 | 41 | This job runs on a macOS agent. 42 | 43 | **Steps:** 44 | 45 | 1. Install Node.js 46 | - This step installs Node.js version 16.x. 47 | 48 | 2. List already installed Android packages 49 | - This step lists the Android packages that are already installed. 50 | 51 | 3. Install Android image 52 | - This step installs the Android image with the specified version. 53 | 54 | 4. Create AVD (Android Virtual Device) 55 | - This step creates an AVD named "test_android_emulator" using the installed Android image. 56 | 57 | 5. Start Android emulator 58 | - This step starts the Android emulator by executing commands to list available AVDs, create the AVD, and start the emulator using the specified AVD. 59 | 60 | ## Contributing 61 | 62 | Feel free to contribute to this project by opening issues and submitting pull requests. Your participation is welcome! 63 | 64 | ## Support 65 | 66 | If you have any questions or encounter any issues related to this repository, please reach out by opening an issue. We will do our best to assist you. 67 | 68 | ## License 69 | 70 | This project is licensed under the MIT License. 71 | -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | trigger: 2 | - master 3 | 4 | jobs: 5 | - job: macOS 6 | pool: 7 | vmImage: macOS-latest 8 | 9 | steps: 10 | 11 | - task: NodeTool@0 12 | inputs: 13 | versionSpec: '16.x' 14 | displayName: 'Install Node.js' 15 | 16 | - script: | 17 | $ANDROID_HOME/tools/bin/sdkmanager --list 18 | displayName: 'List already installed Android packages' 19 | 20 | - script: | 21 | echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install 'system-images;android-33;google_apis;x86_64' 22 | displayName: 'Install Android image' 23 | 24 | - script: | 25 | $ANDROID_HOME/emulator/emulator -list-avds 26 | echo '---' 27 | echo "no" | $ANDROID_HOME/tools/bin/avdmanager create avd -n test_android_emulator -k 'system-images;android-33;google_apis;x86_64' --force 28 | echo '---' 29 | $ANDROID_HOME/emulator/emulator -list-avds 30 | displayName: 'Create AVD' 31 | 32 | - script: | 33 | $ANDROID_HOME/platform-tools/adb devices 34 | echo '---' 35 | nohup $ANDROID_HOME/emulator/emulator -avd test_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' 36 | echo '---' 37 | $ANDROID_HOME/platform-tools/adb devices -l | grep emulator-5554 38 | $ANDROID_HOME/platform-tools/adb shell getprop 39 | displayName: 'Start Android emulator' 40 | --------------------------------------------------------------------------------