From a54e475cb10178ffe91384012f1b91ac3a761529 Mon Sep 17 00:00:00 2001 From: Utkarsh Saxena Date: Fri, 13 Oct 2023 20:24:42 +0530 Subject: [PATCH] integrated ci pipeline --- .github/workflows/ci.yaml | 110 +++++++++++++++++++++++++++++++ .github/workflows/dependabot.yml | 11 ++++ 2 files changed, 121 insertions(+) create mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/dependabot.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..24b9efa6 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,110 @@ +name: CI + +on: + push: + branches: [master] + + pull_request: + branches: [master] + +jobs: + start: + runs-on: ubuntu-latest + steps: + - name: Checkout the code + uses: actions/checkout@v2 + + - name: Run sample script + run: echo Hello, world + + lint: + name: Perform lint check + needs: [start] + runs-on: ubuntu-latest + steps: + - name: Checkout the code + uses: actions/checkout@v2 + + - name: Cache Gradle + uses: actions/cache@v2 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} + restore-keys: ${{ runner.os }}-gradle- + + - name: Make Gradle executable + run: chmod +x ./gradlew + + - name: Run lint + run: ./gradlew lintDebug + + - name: Upload html test report + uses: actions/upload-artifact@v2 + with: + name: lint.html + path: app/build/reports/lint-results-debug.html + + unit-test: + name: Perform Unit Testing + needs: [lint] + runs-on: ubuntu-latest + steps: + - name: Checkout the code + uses: actions/checkout@v2 + + - name: Run tests + run: ./gradlew test + + - name: Upload test report + uses: actions.upload-artifact@v2 + with: + name: unit_test_report + path: app/build/reports/test/testDebugUnitTest/ + + instrumentation-test: + name: Perform Instrumentation Testing + needs: [unit-test] + runs-on: macos-latest # MacOS runs faster + steps: + - name: Checkout the code + uses: actions/checkout@v2 + + # Gradle v8.0.0 requires java JDK v17 + - name: Set up Java JDK 17 + uses: actions/setup-java@v1 + with: + java-version: '17' + + - name: Run espresso tests + uses: reactivecircus/android-emulator-runner@v2 # 3rd party tool + with: + api-level: 29 + script: ./gradlew connectedCheck + + - name: Upload Instrumentation Test report + uses: actions/upload-artifact@v2 + with: + name: instrumentation_test_report + path: app/build/reports/androidTests/connected + + debug-apk: + name: Generate Debug APK + needs: [static-code-analysis] + runs-on: ubuntu-latest + steps: + - name: Checkout the code + uses: actions/checkout@v2 + + - name: Set up Java JDK 17 + uses: actions/setup-java@v1 + with: + java-version: '17' + + - name: Build debug APK + run: ./gradlew assembleDebug --stacktrace + + - name: Upload APK + uses: actions/upload-artifact@v2 + with: + name: sample-app.apk + path: app/build/outputs/apk/debug/app-debug.apk \ No newline at end of file diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml new file mode 100644 index 00000000..0bd7dbcb --- /dev/null +++ b/.github/workflows/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "gradle" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "daily" \ No newline at end of file