Skip to content

Commit b099c42

Browse files
authored
Create AndroidMainTestReviewGenerateAndSendToTelegram.yml
1 parent 41c05c1 commit b099c42

File tree

1 file changed

+122
-0
lines changed

1 file changed

+122
-0
lines changed
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: Test, Review and Generate APK
2+
on:
3+
push:
4+
branches: [ "master" ]
5+
pull_request:
6+
# The branches below must be a subset of the branches above
7+
branches: [ "master" ]
8+
9+
permissions:
10+
contents: read
11+
12+
13+
jobs:
14+
codacy-security-scan:
15+
permissions:
16+
contents: read # for actions/checkout to fetch code
17+
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
18+
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
19+
name: Codacy Security Scan
20+
runs-on: ubuntu-latest
21+
steps:
22+
# Checkout the repository to the GitHub Actions runner
23+
- name: Checkout code
24+
uses: actions/checkout@v3
25+
26+
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
27+
- name: Run Codacy Analysis CLI
28+
uses: codacy/codacy-analysis-cli-action@d840f886c4bd4edc059706d09c6a1586111c540b
29+
with:
30+
# Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
31+
# You can also omit the token and run the tools that support default configurations
32+
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
33+
verbose: true
34+
output: results.sarif
35+
format: sarif
36+
# Adjust severity of non-security issues
37+
gh-code-scanning-compat: true
38+
# Force 0 exit code to allow SARIF file generation
39+
# This will handover control about PR rejection to the GitHub side
40+
max-allowed-issues: 2147483647
41+
42+
# Upload the SARIF file generated in the previous step
43+
- name: Upload SARIF results file
44+
uses: github/codeql-action/upload-sarif@v2
45+
with:
46+
sarif_file: results.sarif
47+
48+
test:
49+
name: Run Unit Tests
50+
runs-on: ubuntu-latest
51+
52+
steps:
53+
- uses: actions/checkout@v3
54+
55+
# Cache gradle
56+
- name: Cache Gradle and wrapper
57+
uses: actions/cache@v3
58+
with:
59+
path: |
60+
~/.gradle/caches
61+
~/.gradle/wrapper
62+
key: cache-${{ runner.os }}-${{ matrix.jdk }}-gradle-${{ hashFiles('**/*.gradle*') }}
63+
restore-keys: |
64+
${{ runner.os }}-gradle-
65+
- name: Validate Gradle Wrapper
66+
uses: gradle/wrapper-validation-action@v1
67+
68+
- name: Run Unit tests
69+
run: bash ./gradlew test --stacktrace
70+
apk:
71+
name: Generate APK
72+
needs: [ test , codacy-security-scan ]
73+
runs-on: ubuntu-latest
74+
75+
steps:
76+
- uses: actions/checkout@v3
77+
- name: Setup Java JDK
78+
uses: actions/setup-java@v3.8.0
79+
with:
80+
java-version: 11
81+
distribution: 'temurin'
82+
83+
- name: Grant Permission to Execute
84+
run: chmod +x gradlew
85+
86+
- name: Build debug APK
87+
run: bash ./gradlew assembleDebug --stacktrace
88+
89+
- name: Upload APK to Github Artifacts
90+
uses: actions/upload-artifact@v3.1.1
91+
with:
92+
name: app
93+
path: app/build/outputs/apk/debug/app-debug.apk
94+
95+
send-apk-on-telegram:
96+
name: Send Apk on Telegram
97+
needs: apk
98+
runs-on: ubuntu-latest
99+
steps:
100+
- name: Download Stored Artifact
101+
uses: actions/download-artifact@v3
102+
with:
103+
name: app
104+
105+
- name: send telegram message on push
106+
uses: appleboy/telegram-action@master
107+
with:
108+
to: ${{ secrets.TELEGRAM_TO }}
109+
token: ${{ secrets.TELEGRAM_TOKEN }}
110+
message: |
111+
Hi Guys,
112+
${{ github.actor }} created commit:
113+
Commit message: ${{ github.event.commits[0].message }}
114+
Repository: ${{ github.repository }}
115+
See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}}
116+
117+
118+
Created By @JahidHasanCo
119+
120+
document: app-debug.apk
121+
photo: https://media.giphy.com/media/A6aHBCFqlE0Rq/giphy.gif
122+

0 commit comments

Comments
 (0)