Skip to content

This repo contains my first step Android-CI-CD with GitHub Action, Firebase distribution, and Sonarcloud

Notifications You must be signed in to change notification settings

karimelbahi/Hello-World-CI-CD-Github-Actions

Repository files navigation

Hello-World-CI-CD-Github-Actions

This repo contains my first step Android CI-CD with GitHub Action, Firebase distribution, and Sonarcloud.

Getting Started

This repo setup a CI pipelines using Github Actions :octocat: and CD using Firebase Distribution

GitHub Actions - CI/CD Terms

  • Github Actions

    GitHub Actions gives developers the ability to automate their workflows across issues, pull requests, and more—plus native CI/CD functionality.

  • Continuous Integration

    Is the practice of merging all developers' working copies to a shared mainline several times a day.

  • Continuous Delivery

    Is a software engineering approach in which teams produce software in short cycles, ensuring that the software can be reliably released at any time and, when releasing the software, without doing so manually.

CI/CD

Workflows

  • main.yaml : This workflow have to check for lint, unit testing, istrumentation testing, build apk,and static code analyzer, and deploy to firebase distribution

Let's Start With CI

Info to creat create your own workflow

  • Name

    Name of your workflow

  • on

    Control when the workflow will be triggerd

  • jobs

    Jobs are a set of steps that execute on the same runner. Each runs in its own VM and parallel to other jobs, unless otherwise specified.

    • Job Name

      Pick Up your job name.

    • Needs

      To make the current job wait another one (sequential principle).

    • Runners

      A runner is a GitHub Actions server. It listens for available jobs, runs each in parallel, and reports back progress, logs and results. Each runner can be hosted by GitHub or self-hosted on a localized server. GitHub Hosted runners are based on Ubuntu Linux, Windows, and macOS.

    • Steps

      ESteps are individual tasks that run commands in a job. These can be an action or a shell command. All steps in a job execute on the same runner. Determine a sequence of tasks will be executed for each job.

    • Uses

      A step parameters, and use it to install environment or a repo from any marketplace.

    • Run

      One of step parameters, you can use it when your are trying to hit a command.

    • Checkout : This action checks-out your repository under $GITHUB_WORKSPACE, so your workflow can access it.

    • Setup Java JDK : Set up Java JDK.

    • Upload Build Lint Report : This uploads artifacts from your workflow allowing you to share data between jobs and store data once a workflow is complete.

    • Upload Build APK : To generate and build an APK.

Reun and create Unit test report

  • ./gradlew test

    To run the unit tests.

Reun and create instrumentation test report

  • ./gradlew connectedCheck

    To running the instrumentation tests.

  • reactivecircus/android-emulator-runner@v2

    To start the android emulator using.

Reports-APk

Let's Start With CD

  • To build CD pipelines, have to integrate the application with Firebase Distribution or any other marketplace.

    Firebase Distribution is used to distributing the app to QA team Automatically after all jobs succeeded.

  • Build Gradle : Build an APK.

  • Firebase Distribution: integrate your app with firebase distribution.

  • Firebase CLI reference: The Firebase CLI (GitHub) provides a variety of tools for managing, viewing, and deploying to Firebase projects..

  • appId : Get it from your project settings on firebase console.

  • token : Get it buyg Runing this command firebase login:ci.

  • Secrets : To encrypt the sensitive information, have to access it from Settings/Secrets Tab, for more info checkout out Encrypted Secrets

Screenshot from firebase distribution dashboard after sending an APK to the QA team!

CD

Integrate the project wih Sonarcloud code analysis.

Get a report from SonarCloud platform included num of Bugs, Vulnerabilities, Security Hotspotsand Code Smells, Coverage information,and Duplication.

Sonarcloud

Final Result. 🚀

Final -Result

About

This repo contains my first step Android-CI-CD with GitHub Action, Firebase distribution, and Sonarcloud

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages