Skip to content

Commit a45f0af

Browse files
authored
feat: add adjust sample apps and CI example builds (#723)
* feat(kits): add adjust sample apps and CI example builds Introduce Kotlin/Java sample apps for adjust-5 and wire a CI-only settings file so example modules stay isolated from kit settings and settings-kits.gradle. * ci: pin build-kits workflow actions to commit SHAs Fix semgrep blocking findings for mutable GitHub Actions tag references. * fix(kits): align Gradle project paths with android- kit names Use explicit android- prefixed includes and projectDir mappings so kit examples, dependencies, and CI matrix tasks resolve the same modules. * revert: restore settings-kits.gradle rename pattern Keep kit registration unchanged and rely on the existing android- rename so example modules and CI matrix paths continue to resolve correctly. * chore(kits): remove Adjust Java sample app Keep only the Kotlin example and drop Java example wiring from CI matrix and kit example settings.
1 parent a130b07 commit a45f0af

14 files changed

Lines changed: 228 additions & 0 deletions

File tree

.github/workflows/build-kits.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Build Kits
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
load-matrix:
12+
name: Load kit matrix
13+
runs-on: ubuntu-latest
14+
outputs:
15+
matrix: ${{ steps.set.outputs.matrix }}
16+
steps:
17+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
18+
with:
19+
sparse-checkout: kits/matrix.json
20+
sparse-checkout-cone-mode: false
21+
- id: set
22+
run: echo "matrix=$(jq -c . kits/matrix.json)" >> "$GITHUB_OUTPUT"
23+
24+
build-kits:
25+
name: Build ${{ matrix.kit.name }}
26+
needs: load-matrix
27+
runs-on: ubuntu-latest
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
kit: ${{ fromJson(needs.load-matrix.outputs.matrix) }}
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
35+
36+
- name: Set SDK version
37+
run: |
38+
echo "ORG_GRADLE_PROJECT_VERSION=$(head -n 1 VERSION)" >> $GITHUB_ENV
39+
echo "ORG_GRADLE_PROJECT_version=$(head -n 1 VERSION)" >> $GITHUB_ENV
40+
41+
- name: Install JDK 17
42+
uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5
43+
with:
44+
distribution: zulu
45+
java-version: "17"
46+
47+
- name: Publish core SDK to Maven Local
48+
run: ./gradlew publishMavenPublicationToMavenLocal
49+
50+
- name: Run kit unit tests
51+
if: ${{ matrix.kit.skip_unit_tests != true }}
52+
run: |
53+
./gradlew "${{ matrix.kit.kit_project }}:testRelease" \
54+
-c settings-kits.gradle \
55+
-Pmparticle.kit.mparticleFromMavenLocalOnly=true
56+
57+
- name: Build Kotlin example
58+
if: ${{ matrix.kit.skip_example_builds != true && matrix.kit.example_kotlin_project != '' }}
59+
run: |
60+
./gradlew "${{ matrix.kit.example_kotlin_project }}:assembleDebug" \
61+
-c settings-kit-examples.gradle \
62+
-Pmparticle.kit.mparticleFromMavenLocalOnly=true
63+
64+
- name: Build Java example
65+
if: ${{ matrix.kit.skip_example_builds != true && matrix.kit.example_java_project != '' }}
66+
run: |
67+
./gradlew "${{ matrix.kit.example_java_project }}:assembleDebug" \
68+
-c settings-kit-examples.gradle \
69+
-Pmparticle.kit.mparticleFromMavenLocalOnly=true

.github/workflows/pull-request.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ jobs:
153153
with:
154154
base_branch: main
155155

156+
build-kits:
157+
uses: ./.github/workflows/build-kits.yml
158+
156159
kit-compatibility-test:
157160
name: "Kit Compatibility Test"
158161
runs-on: ubuntu-latest
@@ -188,6 +191,7 @@ jobs:
188191
lint-checks,
189192
kotlin-lint-checks,
190193
kit-compatibility-test,
194+
build-kits,
191195
]
192196
uses: mParticle/mparticle-workflows/.github/workflows/dependabot-save-pr-number.yml@main
193197

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
plugins {
2+
id 'com.android.application'
3+
id 'org.jetbrains.kotlin.android'
4+
}
5+
6+
android {
7+
namespace 'com.mparticle.kits.adjust.example.kotlin'
8+
compileSdk 34
9+
10+
defaultConfig {
11+
applicationId 'com.mparticle.kits.adjust.example.kotlin'
12+
minSdk 21
13+
targetSdk 34
14+
versionCode 1
15+
versionName '1.0'
16+
}
17+
18+
compileOptions {
19+
sourceCompatibility JavaVersion.VERSION_17
20+
targetCompatibility JavaVersion.VERSION_17
21+
}
22+
23+
kotlinOptions {
24+
jvmTarget = '17'
25+
}
26+
27+
buildTypes {
28+
release {
29+
minifyEnabled false
30+
}
31+
}
32+
}
33+
34+
dependencies {
35+
implementation project(':kits:adjust:adjust-5')
36+
implementation 'androidx.appcompat:appcompat:1.6.1'
37+
implementation 'com.google.android.material:material:1.11.0'
38+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
<application
5+
android:name=".ExampleApplication"
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:theme="@style/Theme.AppCompat.Light.DarkActionBar">
12+
<activity
13+
android:name=".MainActivity"
14+
android:exported="true">
15+
<intent-filter>
16+
<action android:name="android.intent.action.MAIN" />
17+
<category android:name="android.intent.category.LAUNCHER" />
18+
</intent-filter>
19+
</activity>
20+
</application>
21+
22+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.mparticle.kits.adjust.example.kotlin
2+
3+
import android.app.Application
4+
import com.mparticle.MPEvent
5+
import com.mparticle.MParticle
6+
import com.mparticle.MParticleOptions
7+
8+
class ExampleApplication : Application() {
9+
override fun onCreate() {
10+
super.onCreate()
11+
val options =
12+
MParticleOptions
13+
.builder(this)
14+
.credentials(
15+
"REPLACE WITH YOUR MPARTICLE API KEY",
16+
"REPLACE WITH YOUR MPARTICLE API SECRET",
17+
).logLevel(MParticle.LogLevel.VERBOSE)
18+
.build()
19+
MParticle.start(options)
20+
MParticle.getInstance()?.logEvent(
21+
MPEvent.Builder("foo", MParticle.EventType.Other).build(),
22+
)
23+
}
24+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.mparticle.kits.adjust.example.kotlin
2+
3+
import android.os.Bundle
4+
import androidx.appcompat.app.AppCompatActivity
5+
6+
class MainActivity : AppCompatActivity() {
7+
override fun onCreate(savedInstanceState: Bundle?) {
8+
super.onCreate(savedInstanceState)
9+
setContentView(R.layout.activity_main)
10+
}
11+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="108dp"
3+
android:height="108dp"
4+
android:viewportWidth="108"
5+
android:viewportHeight="108">
6+
<path
7+
android:fillColor="#3DDC84"
8+
android:pathData="M0,0h108v108h-108z" />
9+
<path
10+
android:fillColor="#00000000"
11+
android:pathData="M9,0L9,108"
12+
android:strokeWidth="0.8"
13+
android:strokeColor="#33FFFFFF" />
14+
</vector>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:gravity="center"
6+
android:orientation="vertical"
7+
android:padding="16dp">
8+
9+
<TextView
10+
android:layout_width="wrap_content"
11+
android:layout_height="wrap_content"
12+
android:text="@string/app_name" />
13+
14+
</LinearLayout>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3+
<background android:drawable="@color/ic_launcher_background" />
4+
<foreground android:drawable="@drawable/ic_launcher_foreground" />
5+
</adaptive-icon>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3+
<background android:drawable="@color/ic_launcher_background" />
4+
<foreground android:drawable="@drawable/ic_launcher_foreground" />
5+
</adaptive-icon>

0 commit comments

Comments
 (0)