-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into pld-add-codeql
- Loading branch information
Showing
410 changed files
with
37,434 additions
and
10,099 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 |
---|---|---|
|
@@ -4,8 +4,15 @@ | |
name: CI | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: [ main ] | ||
merge_group: | ||
branches: [ main ] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
FHIRCORE_USERNAME: ${{ secrets.FHIRCORE_USERNAME }} | ||
|
@@ -15,26 +22,27 @@ env: | |
|
||
jobs: | ||
engine-tests: | ||
runs-on: macos-13 | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
api-level: [30] | ||
api-level: [34] | ||
|
||
steps: | ||
- name: Cancel Previous workflow runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 2 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v1 | ||
with: | ||
distribution: temurin | ||
java-version: 17 | ||
|
||
- name: Enable KVM | ||
run: | | ||
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | ||
sudo udevadm control --reload-rules | ||
sudo udevadm trigger --name-match=kvm | ||
- name: Add empty local.properties | ||
run: touch local.properties | ||
working-directory: android | ||
|
@@ -46,19 +54,19 @@ jobs: | |
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
working-directory: android | ||
|
||
- name: Copy CI gradle.properties | ||
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties && cat ~/.gradle/gradle.properties | ||
|
||
- name: Setup Gradle cache | ||
uses: gradle/gradle-build-action@v2 | ||
- name: Gradle cache | ||
uses: gradle/actions/setup-gradle@v3 | ||
|
||
- name: Spotless check engine module | ||
run: ./gradlew -PlocalPropertiesFile=local.properties :engine:spotlessCheck :engine:ktlintCheck --stacktrace | ||
working-directory: android | ||
working-directory: android | ||
|
||
- name: Load AVD cache | ||
uses: actions/cache@v2 | ||
uses: actions/cache@v4 | ||
id: avd-cache | ||
with: | ||
path: | | ||
|
@@ -77,44 +85,53 @@ jobs: | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | ||
disable-animations: false | ||
script: echo "Generated AVD snapshot for caching." | ||
|
||
- name: Run Engine module unit and instrumentation tests and generate coverage report | ||
uses: reactivecircus/android-emulator-runner@v2 | ||
with: | ||
with: | ||
working-directory: android | ||
api-level: ${{ matrix.api-level }} | ||
arch: x86_64 | ||
force-avd-creation: true | ||
force-avd-creation: false | ||
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | ||
disable-animations: true | ||
script: ./gradlew -PlocalPropertiesFile=local.properties :engine:clean :engine:fhircoreJacocoReport --stacktrace | ||
|
||
- name: Upload Test reports | ||
if: ${{ !cancelled() }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: engine-test-reports | ||
path: android/engine/build/reports | ||
|
||
|
||
- name: Upload Engine module test coverage report to Codecov | ||
if: matrix.api-level == 30 # Only upload coverage on API level 30 | ||
if: matrix.api-level == 34 # Only upload coverage on API level 34 | ||
working-directory: android | ||
run: bash <(curl -s https://codecov.io/bash) -F engine -f "engine/build/reports/jacoco/fhircoreJacocoReport/fhircoreJacocoReport.xml" | ||
|
||
geowidget-tests: | ||
runs-on: macos-13 | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
api-level: [30] | ||
api-level: [34] | ||
|
||
steps: | ||
- name: Cancel Previous workflow runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 2 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v1 | ||
with: | ||
distribution: temurin | ||
java-version: 17 | ||
|
||
- name: Enable KVM | ||
run: | | ||
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | ||
sudo udevadm control --reload-rules | ||
sudo udevadm trigger --name-match=kvm | ||
- name: Add empty local.properties | ||
run: touch local.properties | ||
working-directory: android | ||
|
@@ -126,19 +143,19 @@ jobs: | |
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
working-directory: android | ||
|
||
- name: Copy CI gradle.properties | ||
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties && cat ~/.gradle/gradle.properties | ||
|
||
- name: Setup Gradle cache | ||
uses: gradle/gradle-build-action@v2 | ||
- name: Gradle cache | ||
uses: gradle/actions/setup-gradle@v3 | ||
|
||
- name: Spotless check geowidget module | ||
run: ./gradlew -PlocalPropertiesFile=local.properties :geowidget:spotlessCheck --stacktrace | ||
working-directory: android | ||
working-directory: android | ||
|
||
- name: Load AVD cache | ||
uses: actions/cache@v2 | ||
uses: actions/cache@v4 | ||
id: avd-cache | ||
with: | ||
path: | | ||
|
@@ -157,10 +174,10 @@ jobs: | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | ||
disable-animations: false | ||
script: echo "Generated AVD snapshot for caching." | ||
|
||
- name: Run Geowidget module unit and instrumentation tests and generate coverage report | ||
uses: reactivecircus/android-emulator-runner@v2 | ||
with: | ||
with: | ||
working-directory: android | ||
api-level: ${{ matrix.api-level }} | ||
arch: x86_64 | ||
|
@@ -169,31 +186,40 @@ jobs: | |
disable-animations: true | ||
script: ./gradlew -PlocalPropertiesFile=local.properties :geowidget:clean :geowidget:fhircoreJacocoReport --stacktrace | ||
|
||
- name: Upload Test reports | ||
if: ${{ !cancelled() }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: geowidget-test-reports | ||
path: android/geowidget/build/reports | ||
|
||
- name: Upload Geowidget module test coverage report to Codecov | ||
if: matrix.api-level == 30 # Only upload coverage on API level 30 | ||
if: matrix.api-level == 34 # Only upload coverage on API level 34 | ||
working-directory: android | ||
run: bash <(curl -s https://codecov.io/bash) -F geowidget -f "geowidget/build/reports/jacoco/fhircoreJacocoReport/fhircoreJacocoReport.xml" | ||
|
||
quest-tests: | ||
runs-on: macos-13 | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
api-level: [30] | ||
steps: | ||
- name: Cancel Previous workflow runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
api-level: [34] | ||
|
||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 2 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v1 | ||
with: | ||
distribution: temurin | ||
java-version: 17 | ||
|
||
- name: Enable KVM | ||
run: | | ||
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | ||
sudo udevadm control --reload-rules | ||
sudo udevadm trigger --name-match=kvm | ||
- name: Add empty local.properties | ||
run: touch local.properties | ||
working-directory: android | ||
|
@@ -209,15 +235,15 @@ jobs: | |
- name: Copy CI gradle.properties | ||
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties && cat ~/.gradle/gradle.properties | ||
|
||
- name: Setup Gradle cache | ||
uses: gradle/gradle-build-action@v2 | ||
- name: Gradle cache | ||
uses: gradle/actions/setup-gradle@v3 | ||
|
||
- name: Spotless check quest application | ||
run: ./gradlew -PlocalPropertiesFile=local.properties :quest:spotlessCheck --stacktrace :quest:ktlintCheck --stacktrace | ||
working-directory: android | ||
|
||
- name: Load AVD cache | ||
uses: actions/cache@v2 | ||
uses: actions/cache@v4 | ||
id: avd-cache | ||
with: | ||
path: | | ||
|
@@ -237,7 +263,7 @@ jobs: | |
disable-animations: false | ||
script: echo "Generated AVD snapshot for caching." | ||
|
||
- name: Run Quest module unit and instrumentation tests and generate coverage report | ||
- name: Run Quest module unit and instrumentation tests and generate unit tests coverage report | ||
uses: reactivecircus/android-emulator-runner@v2 | ||
with: | ||
working-directory: android | ||
|
@@ -246,10 +272,42 @@ jobs: | |
force-avd-creation: true | ||
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | ||
disable-animations: true | ||
script: ./gradlew clean -PlocalPropertiesFile=local.properties :quest:fhircoreJacocoReport --stacktrace -Pandroid.testInstrumentationRunnerArguments.notPackage=org.smartregister.fhircore.quest.performance | ||
# ./gradlew -PlocalPropertiesFile=local.properties :quest:clean && ./gradlew -PlocalPropertiesFile=local.properties :quest:assembleOpensrpDebugAndroidTest --stacktrace && /Users/runner/Library/Android/sdk/platform-tools/adb install quest/build/outputs/apk/androidTest/opensrp/debug/quest-opensrp-debug-androidTest.apk && ./gradlew -PlocalPropertiesFile=local.properties :quest:assembleOpensrpDebug --stacktrace && /Users/runner/Library/Android/sdk/platform-tools/adb install quest/build/outputs/apk/opensrp/debug/quest-opensrp-debug.apk && /Users/runner/Library/Android/sdk/platform-tools/adb shell am instrument -w -e package org.smartregister.fhircore.quest.ui.profile -e coverage "true" org.smartregister.opensrp.test/org.smartregister.fhircore.quest.QuestTestRunner && /Users/runner/Library/Android/sdk/platform-tools/adb shell run-as org.smartregister.opensrp cat "/data/user/0/org.smartregister.opensrp/files/coverage.ec" > quest/coverage.ec && ./gradlew -PlocalPropertiesFile=local.properties :quest:fhircoreJacocoReport --stacktrace | ||
script: ./gradlew clean -PlocalPropertiesFile=local.properties :quest:fhircoreJacocoReport --info -Pandroid.testInstrumentationRunnerArguments.notPackage=org.smartregister.fhircore.quest.performance | ||
|
||
- name: Run Quest module unit and instrumentation tests and generate aggregated coverage report (Disabled) | ||
if: false | ||
uses: reactivecircus/android-emulator-runner@v2 | ||
with: | ||
working-directory: android | ||
api-level: ${{ matrix.api-level }} | ||
arch: x86_64 | ||
force-avd-creation: true | ||
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | ||
disable-animations: true | ||
run: | | ||
set -e | ||
./gradlew -PlocalPropertiesFile=local.properties :quest:clean | ||
./gradlew -PlocalPropertiesFile=local.properties :quest:assembleOpensrpDebugAndroidTest --stacktrace | ||
/Users/martin/Library/Android/sdk/platform-tools/adb install quest/build/outputs/apk/androidTest/opensrp/debug/quest-opensrp-debug-androidTest.apk | ||
./gradlew -PlocalPropertiesFile=local.properties :quest:assembleOpensrpDebug --stacktrace | ||
/Users/martin/Library/Android/sdk/platform-tools/adb install quest/build/outputs/apk/opensrp/debug/quest-opensrp-debug.apk | ||
/Users/martin/Library/Android/sdk/platform-tools/adb shell am instrument -w \ | ||
--no-window-animation \ | ||
-e coverage "true" \ | ||
-e debug false \ | ||
org.smartregister.opensrp.test/org.smartregister.fhircore.quest.QuestTestRunner | ||
/Users/martin/Library/Android/sdk/platform-tools/adb shell run-as org.smartregister.opensrp \ | ||
cat "/data/user/0/org.smartregister.opensrp/files/coverage.ec" > quest/coverage.ec | ||
./gradlew -PlocalPropertiesFile=local.properties :quest:fhircoreJacocoReport --stacktrace | ||
- name: Upload Test reports | ||
if: ${{ !cancelled() }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: quest-test-reports | ||
path: android/quest/build/reports | ||
|
||
- name: Upload Quest module test coverage report to Codecov | ||
if: matrix.api-level == 30 # Only upload coverage on API level 30 | ||
if: matrix.api-level == 34 # Only upload coverage on API level 34 | ||
working-directory: android | ||
run: bash <(curl -s https://codecov.io/bash) -F quest -f "quest/build/reports/jacoco/fhircoreJacocoReport/fhircoreJacocoReport.xml" |
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
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
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
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
Oops, something went wrong.