-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2dd669f
commit 5527a9c
Showing
1 changed file
with
121 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
name: Build and Test | ||
on: [ push ] | ||
jobs: | ||
|
||
local_test_job: | ||
name: Running Local Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v4 | ||
- name: Set up JDK | ||
with: | ||
distribution: 'zulu' | ||
java-version: '17' | ||
uses: actions/setup-java@v4 | ||
- name: Change wrapper permissions | ||
run: chmod +x ./gradlew | ||
- name: Restore Cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Run Debug Tests | ||
run: ./gradlew testDebugUnitTest --continue | ||
- name: Upload Test Reports | ||
if: ${{ always() }} | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: test-reports | ||
path: '**/build/reports/tests/' | ||
|
||
android_test_job: | ||
name: Android Tests | ||
runs-on: macos-latest | ||
continue-on-error: true | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up JDK | ||
with: | ||
distribution: 'zulu' | ||
java-version: '17' | ||
uses: actions/setup-java@v4 | ||
- name: Change wrapper permissions | ||
run: chmod +x ./gradlew | ||
- name: Restore Cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Instrumentation Tests | ||
uses: reactivecircus/android-emulator-runner@v2 | ||
with: | ||
api-level: 29 | ||
script: ./gradlew connectedAndroidTest | ||
|
||
- name: Upload Android Test Reports | ||
if: ${{ always() }} | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: android-test-reports | ||
path: '**/build/reports/androidTests/' | ||
|
||
build_job: | ||
name: Building the APK | ||
runs-on: ubuntu-latest | ||
continue-on-error: true | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up JDK | ||
with: | ||
distribution: 'zulu' | ||
java-version: '17' | ||
uses: actions/setup-java@v4 | ||
- name: Restore Cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Change wrapper permissions | ||
run: chmod +x ./gradlew | ||
- name: Assemble Debug | ||
run: ./gradlew assembleDebug | ||
|
||
- name: Upload APK | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: apk | ||
path: app/build/outputs/apk/debug/**.apk | ||
|
||
notification_job: | ||
needs: [ local_test_job, android_test_job, build_job ] | ||
name: Notify Workflow Results | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: technote-space/workflow-conclusion-action@v1 | ||
- name: Send mail | ||
if: failure() | ||
uses: dawidd6/action-send-mail@v2 | ||
with: | ||
server_address: smtp.gmail.com | ||
server_port: 465 | ||
username: ${{ secrets.MAIL_USERNAME }} | ||
password: ${{ secrets.MAIL_PASSWORD }} | ||
subject: Github Actions Job result | ||
body: Build job of ${{github.repository}} completed successfully! The Job worflow ${{ github.workflow }} of ${{ github.repository }} has result of ${{ env.WORKFLOW_CONCLUSION }} | ||
to: mojtabashirkhani.nba@gmail.com | ||
from: From Github Action |