Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Basic CI Workflow For Android using GitHub Actions

  • Last Updated : 13 Jan, 2022

Continuous integration (CI) is a software development process in which the team members can integrate their work. It involves an automated build or test that checks each integration for errors. Once all the test passes, the changes that are made become eligible for being merged into the main codebase.

Prerequisites: Git, GitHub.

Implementation:

Make a repository on Github and push any Android project into it. Since GitHub Actions checks for the CI workflows stored in a specific directory i.e. .github/workflows, we will create this directory in our GitHub repository. Once done with the above steps, click on Code -> Add a file -> Create new file.

CI scripts are written in a file called yaml (Yet Another Markup Language), having file extension .yml. So we’ll create a new directory as shown in the above step and add a .yml file to it. Name this file as test.yml. The path of the file will be now, .github/workflows/test.yml.

Now the main part of writing a script for the CI workflow comes in. Paste the code below into the file created in the previous step i.e. test.yml.

name: Android CI
on:
 push:
   branches: [master]
 pull_request:
   branches: [master]

jobs:
 build:
   runs-on: ubuntu-latest
   steps:
     – name: Checkout
       uses: actions/checkout@v2.4.0
     – name: Setup JDK
       uses: actions/setup-java@v2.5.0
       with:
         distribution: ‘temurin’
         java-version: ’11’
     – name: Set execution flag for gradlew
       run: chmod +x gradlew
     – name: Build with Gradle
       run: ./gradlew build

Scroll to the bottom. In the Commit New File section, give a Title and Description to the commit. Click on commit new file.

Now head to the Actions tab and you will see the workflow that you just created running there.

You can click on the Title of the workflow and see the detailed build. It will take a couple of minutes to run and after that, a green check stating that the run has succeeded will be shown.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!