Skip to content

Commit

Permalink
Merge branch 'main' into pld-add-codeql
Browse files Browse the repository at this point in the history
  • Loading branch information
pld authored Nov 21, 2024
2 parents d6babe7 + 84ebc68 commit 3aea862
Show file tree
Hide file tree
Showing 410 changed files with 37,434 additions and 10,099 deletions.
170 changes: 114 additions & 56 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
Expand All @@ -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: |
Expand All @@ -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
Expand All @@ -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: |
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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: |
Expand All @@ -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
Expand All @@ -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"
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [1.1.1] - 2024-05-20

### Added
- Added a new class (PdfGenerator) for generating PDF documents from HTML content using Android's WebView and PrintManager
- Introduced a new class (HtmlPopulator) to populate HTML templates with data from a Questionnaire Response
- Added the in-app PDF Generation feature
1. Added a new class (PdfGenerator) for generating PDF documents from HTML content using Android's WebView and PrintManager
2. Introduced a new class (HtmlPopulator) to populate HTML templates with data from a Questionnaire Response
3. Implemented functionality to launch PDF generation using a configuration setup
- Added Save draft MVP functionality

## [1.1.0] - 2024-02-15

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2021-2023, Ona Systems, Inc.
Copyright 2021-2024, Ona Systems, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
3 changes: 2 additions & 1 deletion android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ allprojects {
mavenCentral()
maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
maven(url = "https://s01.oss.sonatype.org/content/repositories/snapshots")
maven(url = "https://jcenter.bintray.com/")
maven(url = "https://repo.spring.io/plugins-release")
maven(url = "https://repository.liferay.com/nexus/content/repositories/public")
apply(plugin = "org.owasp.dependencycheck")
tasks.dependencyCheckAggregate{
dependencyCheck.formats.add("XML")
Expand Down
7 changes: 5 additions & 2 deletions android/buildSrc/src/main/kotlin/BuildConfigs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ object BuildConfigs {
const val compileSdk = 34
const val targetSdk = 34
const val versionCode = 11
const val versionName = "2.0.0"
const val versionName = "2.0.1"
const val applicationId = "org.smartregister.opensrp"
const val jvmToolchain = 17
const val kotlinCompilerExtensionVersion = "1.5.8"
const val jacocoVersion ="0.8.11"
const val ktLintVersion = "0.49.0"
}
const val enableUnitTestCoverage = true
const val enableAndroidTestCoverage = false
}

Loading

0 comments on commit 3aea862

Please sign in to comment.