Open In App
Related Articles

Basic CI Workflow For Android using GitHub Actions

Improve Article
Improve
Save Article
Save
Like Article
Like

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.

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 13 Jan, 2022
Like Article
Save Article
Previous
Next
Similar Reads