Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Android CI & CD | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
types: [opened, synchronize, reopened] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v3 | |
- name: Grant Permission to Execute | |
run: chmod +x gradlew | |
- name: Run lint | |
run: ./gradlew lintDebug | |
- name: Upload html test report | |
uses: actions/[email protected] | |
with: | |
name: lint.html | |
path: app/build/reports/lint-results-debug.html | |
unit-test: | |
name: Run Unit Tests | |
needs: [lint] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# Cache gradle | |
- name: Cache Gradle and wrapper | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: cache-${{ runner.os }}-${{ matrix.jdk }}-gradle-${{ hashFiles('**/*.gradle*') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Validate Gradle Wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
- name: Run Unit tests | |
run: bash ./gradlew test --stacktrace | |
- name: Upload test report | |
uses: actions/[email protected] | |
with: | |
name: unit_test_report | |
path: app/build/reports/tests/testDebugUnitTest/ | |
instrumentation-test: | |
needs: [unit-test] | |
runs-on: macos-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Grant Permission to Execute | |
run: chmod +x gradlew | |
- name: run tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 29 | |
script: ./gradlew connectedCheck | |
- name: generate report | |
uses: actions/[email protected] | |
with: | |
name: report | |
path: app/build/reports/coverage/debug | |
- name: Download Test Reports Folder | |
uses: actions/[email protected] | |
with: | |
name: report | |
path: app/build/reports/coverage/debug | |
- name: Upload Test Report | |
uses: codecov/codecov-action@v3 | |
with: | |
files: "app/build/reports/coverage/debug/report.xml" | |
static-code-analysis: | |
name: Build and analyze | |
needs: [unit-test] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v1 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Cache Gradle packages | |
uses: actions/cache@v1 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | |
restore-keys: ${{ runner.os }}-gradle | |
- name: Grant Permission to Execute | |
run: chmod +x gradlew | |
- name: Build and analyze | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: ./gradlew build sonarqube --info | |
package: | |
name: Generate APK | |
needs: [static-code-analysis] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Java JDK | |
uses: actions/[email protected] | |
with: | |
java-version: 11 | |
distribution: 'temurin' | |
- name: Grant Permission to Execute | |
run: chmod +x gradlew | |
- name: Build debug APK | |
run: bash ./gradlew assembleDebug --stacktrace | |
- name: Upload APK to Github Artifacts | |
uses: actions/[email protected] | |
with: | |
name: app | |
path: app/build/outputs/apk/debug/app-debug.apk | |
delevery-on-telegram: | |
name: Send Results on Telegram | |
needs: [ package ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Apk Stored Artifact | |
uses: actions/[email protected] | |
with: | |
name: app | |
- name: send Apk on telegram message on push | |
uses: appleboy/telegram-action@master | |
with: | |
to: ${{ secrets.TELEGRAM_TO }} | |
token: ${{ secrets.TELEGRAM_TOKEN }} | |
message: | | |
Hi Guys, | |
${{ github.actor }} created commit: | |
Commit message: ${{ github.event.commits[0].message }} | |
Repository: ${{ github.repository }} | |
See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}} | |
Created By @JahidHasanCo | |
document: app-debug.apk |