Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge of demo branch incl. build pipeline #170

Open
wants to merge 7 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
version: 2.1

orbs:
android: circleci/[email protected]
jobs:
test:
description: Runs unit tests and instrumented tests on the Survey app
executor:
name: android/android-machine
resource-class: large
tag: 2021.10.1

steps:
- checkout
- run:
name: Install OpenJDK 8
command: |
sudo apt-get update && sudo apt-get install -y openjdk-8-jdk
sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
sudo update-alternatives --set javac /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
echo 'export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"' >> $BASH_ENV
java -version
- run:
name: Chmod Permissions
command: sudo chmod +x gradlew

- run:
name: Update Package list
command: sudo apt-get update
- run:
name: Install the latest Android SDK
command: |
sdkmanager --update
sdkmanager --list
- android/create-avd:
avd-name: customavd
install: true
system-image: system-images;android-30;default;x86_64
additional-args: --sdcard 2048M

- android/start-emulator:
avd-name: customavd
no-window: true
restore-gradle-cache-prefix: v1
post-emulator-launch-assemble-command: ./gradlew assemble

- run:
name: show package name
command: adb shell pm list packages

- android/run-tests:
test-command: ./gradlew test

- android/run-tests:
test-command: ./gradlew connectedAndroidTest
- android/save-gradle-cache:
cache-prefix: v1

- store_artifacts:
name: Store Test Results
path: survey_app/build/outputs/androidTest-results
- store_artifacts:
name: Store Test Reports
path: tables_app/build/reports

build:
docker:
- image: cimg/android:2023.06
steps:
- checkout
- run:
name: Install OpenJDK 8
command: |
sudo apt-get update && sudo apt-get install -y openjdk-8-jdk
sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
sudo update-alternatives --set javac /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
echo 'export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"' >> $BASH_ENV
java -version

- run:
name: Chmod Permissions
command: sudo chmod +x gradlew
- android/restore-gradle-cache:
cache-prefix: v1

- run:
name: Echo JAVA HOME
command: |
echo $JAVA_HOME

- run:
name: Download Dependencies
command: ./gradlew androidDependencies
- android/save-gradle-cache:
cache-prefix: v1
- run:
name: Build Survey
command: ./gradlew assemble

- store_artifacts:
name: Store Build Artifacts
path: survey_app/build/outputs/apk


workflows:
build-test-deploy-workflow:
jobs:
- build
- test:
requires:
- build

23 changes: 16 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,27 @@ allprojects {
repositories {
google()
mavenCentral()
ivy {
url 'http://cwe.cs.washington.edu:8082/artifactory/libs-demo/'
}
maven {
url 'http://cwe.cs.washington.edu:8082/artifactory/libs-master/'
name = "GithubPackages"
url = "https://maven.pkg.github.com/odk-x/androidlibrary"

credentials {
username = System.getenv('GITHUB_ACTOR')
password = System.getenv('GITHUB_TOKEN')
}
}
ivy {
url 'http://cwe.cs.washington.edu:8082/artifactory/libs-snapshot/'
maven {
name = "GithubPackages"
url = "https://maven.pkg.github.com/odk-x/androidcommon"

credentials {
username = System.getenv('GITHUB_ACTOR')
password = System.getenv('GITHUB_TOKEN')
}
}
}
}

configurations.all {
transitive = true
}
}
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
gradle.ext.gradleConfigVersion = 155
gradle.ext.gradleConfigVersion = 156

if (!gradle.ext.has('workspacePath')) {
logger.warn("rootDir: " + rootDir.getAbsolutePath());
Expand Down
48 changes: 27 additions & 21 deletions survey_app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
/**************************************************************************************************
GRADLE CONFIG
*************************************************************************************************/
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
}

if ((new File(gradle.local)).exists()) {
apply from: gradle.local
Expand All @@ -12,7 +17,6 @@ applicationScripts.each {
apply from: it
}

apply plugin: 'com.android.application'

android {
// The following are set in the common.gradle file
Expand Down Expand Up @@ -110,51 +114,53 @@ allprojects {
}

dependencies {
implementation 'androidx.annotation:annotation:1.2.0'
implementation 'androidx.annotation:annotation:1.3.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.fragment:fragment:1.3.6'
implementation 'com.google.android.material:material:1.4.0'

implementation 'com.google.firebase:firebase-analytics:19.0.2'
implementation 'com.google.firebase:firebase-crashlytics:18.2.3'

if (libraryProjectPath.exists() && gradle.useLocal) { // Local project is favoured
implementation project(libraryProjectName)
} else {
demoImplementation(group: groupId, name: libraryDemoArtifactName, classifier: demoRelease,
version: latestVersion, ext: 'aar')
masterImplementation(group: groupId, name: libraryMasterArtifactName, classifier: masterRelease,
version: masterArtifactVersion, ext: 'aar')
snapshotImplementation(group: groupId, name: librarySnapshotArtifactName,
classifier: snapshotRelease, version: latestVersion, ext: 'aar')
///Todo: properly specify all flavour implementations of the androidLibrary
implementation(group:'org.opendatakit', name: 'androidlibrary_lib', classifier: 'snapshotBasicRelease', version: '1.0.0-+', ext: 'aar')

// demoImplementation(group: groupId, name: libraryDemoArtifactName, classifier: demoRelease,
// version: latestVersion, ext: 'aar')
// masterImplementation(group: groupId, name: libraryMasterArtifactName, classifier: masterRelease,
// version: masterArtifactVersion, ext: 'aar')
// snapshotImplementation(group: groupId, name: librarySnapshotArtifactName,
// classifier: snapshotRelease, version: latestVersion, ext: 'aar')
}

if (commonProjectPath.exists() && gradle.useLocal) { // Local project is favoured
implementation project(commonProjectName)
} else {
demoImplementation(group: groupId, name: commonDemoArtifactName, classifier: demoRelease,
version: latestVersion, ext: 'aar')
masterImplementation(group: groupId, name: commonMasterArtifactName, classifier: masterRelease,
version: masterArtifactVersion, ext: 'aar')
snapshotImplementation(group: groupId, name: commonSnapshotArtifactName,
classifier: snapshotRelease, version: latestVersion, ext: 'aar')
///Todo: properly specify all flavour implementations of the androidCommon
implementation(group:'org.opendatakit', name: 'androidcommon', classifier: 'snapshotBasicRelease', version: '1.0.0-+', ext: 'aar')
// demoImplementation(group: groupId, name: commonDemoArtifactName, classifier: demoRelease,
// version: latestVersion, ext: 'aar')
// masterImplementation(group: groupId, name: commonMasterArtifactName, classifier: masterRelease,
// version: masterArtifactVersion, ext: 'aar')
// snapshotImplementation(group: groupId, name: commonSnapshotArtifactName,
// classifier: snapshotRelease, version: latestVersion, ext: 'aar')
}

// Testing dependencies
testImplementation 'junit:junit:4.13.1'
testImplementation 'junit:junit:4.13.2'

androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test:rules:1.4.0'
androidTestImplementation 'androidx.annotation:annotation:1.2.0'
androidTestImplementation 'androidx.annotation:annotation:1.3.0'

}

task grantPermissionForODKApp {
dependsOn grantServicesReadExternalStoragePermission
dependsOn grantServicesWriteExternalStoragePermission
}

apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
}
Binary file modified survey_app/src/main/res/raw/configzip
Binary file not shown.
Binary file modified survey_app/src/main/res/raw/systemzip
Binary file not shown.