diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9e60fe6 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,49 @@ +name: Continuous Integration +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: "recursive" + + - name: Set up JDK environment + uses: actions/setup-java@v3 + with: + distribution: "zulu" + java-version: 17 + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + + - name: Run local unit tests + run: bash ./gradlew test --stacktrace + + build: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: "recursive" + + - name: Set up JDK environment + uses: actions/setup-java@v3 + with: + distribution: "zulu" + java-version: 17 + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + + - name: Build the app + run: bash ./gradlew build --stacktrace diff --git a/app/build.gradle b/app/build.gradle index d126c12..a5c9637 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -25,8 +25,8 @@ android { applicationId 'org.secuso.privacyfriendlyactivitytracker' minSdkVersion 17 targetSdkVersion 34 - versionCode 15 - versionName "3.0.1" + versionCode 16 + versionName "3.1.0" multiDexEnabled true } @@ -71,6 +71,9 @@ dependencies { implementation 'com.github.PhilJay:MPAndroidChart:v3.0.0-beta1' implementation 'androidx.multidex:multidex:2.0.1' //with androidx libraries + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test:runner:1.5.2' + def work_version = '2.9.0' implementation "androidx.work:work-runtime:$work_version" implementation "androidx.work:work-runtime-ktx:$work_version" diff --git a/app/src/androidTest/java/org/secuso/privacyfriendlyactivitytracker/ApplicationTest.java b/app/src/androidTest/java/org/secuso/privacyfriendlyactivitytracker/ApplicationTest.java index 31a9674..4fbe8bb 100644 --- a/app/src/androidTest/java/org/secuso/privacyfriendlyactivitytracker/ApplicationTest.java +++ b/app/src/androidTest/java/org/secuso/privacyfriendlyactivitytracker/ApplicationTest.java @@ -1,13 +1,20 @@ package org.secuso.privacyfriendlyactivitytracker; -import android.app.Application; -import android.test.ApplicationTestCase; +import static junit.framework.TestCase.assertEquals; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; /** * Testing Fundamentals */ -public class ApplicationTest extends ApplicationTestCase { - public ApplicationTest() { - super(Application.class); +@RunWith(AndroidJUnit4.class) +public class ApplicationTest { + @Test + public void instrumentationTest() throws Exception { + assertEquals("org.secuso.privacyfriendlyactivitytracker", InstrumentationRegistry.getInstrumentation().getTargetContext().getPackageName()); } } \ No newline at end of file