Git Product home page Git Product logo

mgamale / android-cicd Goto Github PK

View Code? Open in Web Editor NEW
57.0 2.0 14.0 2.41 MB

This repo demonstrates how to work on CI/CD for Mobile Apps :iphone: using Github Actions :pill: + Firebase Distribution :tada:

Kotlin 100.00%
android kotlin-android continuous-integration continuous-delivery cicd android-ci firebase-distribution firebase github-actions ci-cd continuous-deployment actions ci sonarqube sonarcloud static-code-analysis linting linter actionshackathon21

android-cicd's Introduction

Android-CICD

This repo demonstrates how to work on CI/CD for Mobile Apps ๐Ÿ“ฑ using Github Actions ๐Ÿ’Š + Firebase Distribution ๐ŸŽ‰

Getting Started

We are here setup a continious integration pipelines using Github Actions and a continious delivery using Firebase Distribution โšก โšก

If you want to know a brief definition for the two terms CI/CD ๐Ÿ™†โ€โ™‚๏ธ, Checkout out the quotes :

  • 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

  • ๐Ÿš€ pre_check.yaml : This workflow have to check for lint, testing and static code analyzer
  • ๐Ÿš€ build.yaml : This workflow have to build and deploy to firebase distribution

Getting Started With CI โšก

To get start with build CI pipelines, you should use Actions tab or create a new YAML file, then you could setup your workflow, please checkout Metadata syntax for GitHub Actions ๐Ÿง

How to create your own workflow

  1. name

Name of your workflow

  1. on

Control when the workflow will be triggerd

  1. jobs

Deterimne one or more jobs / pipelines to run for the workflow, but you have to specifiy some parameters to run the job

  • job_name

Pick up your own job name

  • runs_on

Specify your runner type

  • steps

Represent a squence of tasks will be exceuted for each job / pipeline, each step have a some of parameters

  • uses

One of step parameters, you can use it when your are trying to install enviornment or repository from marketplace

  • run

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

CI Sample ๐Ÿฅณ

This workflow run as a lint checker for each Pushing on master branch ๐Ÿš€

name: Build lint checker report

on:
  push:
    branches: [ master ]

jobs:
  lint:
    runs-on: ubuntu-latest
    steps: 
      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup Java JDK
        uses: actions/setup-java@v1
        with:
          java-version: 1.8

      - name: Build Lint
        run: ./gradlew lintDebug
    
      - name: Upload Build Lint Report
        uses: actions/upload-artifact@v2
        with:
          name: report
          path: app/build/reports/lint-results-debug.html
  • Checkout : This action checks-out your repository under $GITHUB_WORKSPACE, so your workflow can access it.
  • Setup Java JDK
  • Build Lint : Run lint report
  • 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.

Getting Started With CD โšก

To get start with build CD pipelines, you should integrate your app with Firebase Distribution, then you could setup your workflow, please checkout Firebase Distribution for more how to integrate your app with firebase ๐Ÿง

Firebase App Distribution makes distributing your apps to trusted testers painless. By getting your apps onto testers' devices quickly, you can get feedback early and often.

CD Sample ๐Ÿฅณ

This workflow builds a debug APK, then upload the artifact APK to a workflow dashboard and send another one to testers group on firebase distributions dashboard after each Pull Request on master branch ๐Ÿš€

name: Integrate Firebase Distributions + Github Actions

on:
  pull_request_target:
    branches: [ master ]

jobs:
  builds:
    runs-on: ubuntu-latest
    steps: 
      - name: Checkout
        uses: actions/checkout@v2
        
      - name: Setup Java JDK
        uses: actions/setup-java@v1
        with:
         java-version: 1.8
        
      - name: Build Gradle
        run: ./gradlew build
    
      - name: Upload a Build Artifact
        uses: actions/upload-artifact@v2
        with:
          name: app
          path: app/build/outputs/apk/debug/app-debug.apk
          
      - name: Upload Artifact To Firebase App Distribution
        uses: wzieba/[email protected]
        with:
          appId: ${{ secrets.FIREBASE_ID }}
          token: ${{ secrets.FIREBASE_TOKEN }}
          groups: Android-CICD-Testers
          releaseNotes: "Hey! This my first integrate Firebase distributions with Github Actions"
          file: app/build/outputs/apk/debug/app-debug.apk   
  • Build Gradle : Build your APK.
  • Upload Artifact To Firebase App Distribution : This action uploads artifacts (.apk,.aab) to Firebase App Distribution.
  • appId : Get it from your project settings on firebase console.
  • token : Run this command firebase login:ci, for more informations about how to get your firbase token, check out Firebase CLI

Secrets : This path to encrypt your sensitive information, you can access it from Settings/Secrets Tab, for more info checkout out Encrypted Secrets

Screenshot from firebase distribution dashboard after sending the debug_app using Actions workflow

Release

Contributing

Don't hesitate to contribute with any updates or improves, just fork this repository, make the change you'd like and then submit a pull request.

Issues

Notice any issues with a repository? Please file a Github Issue in this repository.

License

The MIT License (MIT)

Copyright (c) 2021 MohamedGElsharkawy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

android-cicd's People

Contributors

mgamale avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

android-cicd's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.