From 0b9e571e1b408a8918977a65319536bf21a13bc0 Mon Sep 17 00:00:00 2001 From: Abdourahamane Boinaidi Date: Tue, 2 Jul 2024 10:12:32 +0200 Subject: [PATCH 1/4] core: Add ci and issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 34 ++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 22 +++++++++++++ .github/workflows/auto-author-assign.yml | 14 +++++++++ .github/workflows/dependent-issues.yml | 28 +++++++++++++++++ .github/workflows/multiplatform.yml | 38 +++++++++++++++++++++++ 5 files changed, 136 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/workflows/auto-author-assign.yml create mode 100644 .github/workflows/dependent-issues.yml create mode 100644 .github/workflows/multiplatform.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..cfc1850b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,34 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +*Note: Please write your issue only in english* + +**Description** +A clear and concise description of what the bug is. + +**Steps to reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Smartphone (please complete the following information):** + - Device: [e.g. Samsung S20 Ultra 5G] + - Android version: [e.g. Android 11] + - App version: [e.g. 4.0.1] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..0d4bf2c8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,22 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +*Note: Please write your issue only in english* + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/auto-author-assign.yml b/.github/workflows/auto-author-assign.yml new file mode 100644 index 00000000..85901ce7 --- /dev/null +++ b/.github/workflows/auto-author-assign.yml @@ -0,0 +1,14 @@ +name: Auto Author Assign + +on: + pull_request_target: + types: [ opened, reopened ] + +permissions: + pull-requests: write + +jobs: + assign-author: + runs-on: ubuntu-latest + steps: + - uses: toshimaru/auto-author-assign@v2.1.0 diff --git a/.github/workflows/dependent-issues.yml b/.github/workflows/dependent-issues.yml new file mode 100644 index 00000000..d081deed --- /dev/null +++ b/.github/workflows/dependent-issues.yml @@ -0,0 +1,28 @@ +name: Dependent Issues + +on: + issues: + types: + - opened + - edited + - closed + - reopened + pull_request_target: + types: + - opened + - edited + - closed + - reopened + # Makes sure we always add status check for PRs. Useful only if + # this action is required to pass before merging. Otherwise, it + # can be removed. + - synchronize + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: z0al/dependent-issues@v1.5.2 + env: + # (Required) The token to use to make API calls to GitHub. + GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/multiplatform.yml b/.github/workflows/multiplatform.yml new file mode 100644 index 00000000..6bf3c8e4 --- /dev/null +++ b/.github/workflows/multiplatform.yml @@ -0,0 +1,38 @@ +name: Android CI + +on: + pull_request: + +concurrency: + group: ${{ github.head_ref }} + cancel-in-progress: true + +jobs: + + instrumentation-tests: + if: github.event.pull_request.draft == false + runs-on: [ self-hosted, Android ] + + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.12.1 + with: + access_token: ${{ github.token }} + + - name: Checkout the code + uses: actions/checkout@v4.1.1 + with: + token: ${{ github.token }} + submodules: recursive + + # Setup Gradle and run Build + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle + run: | + ./gradlew clean + ./gradlew build + + # Run tests + - name: Run Unit tests + run: ./gradlew allTests --stacktrace From f2d7f05e94bc717cef636c309415c091aa7a9ac4 Mon Sep 17 00:00:00 2001 From: Abdourahamane Boinaidi Date: Tue, 2 Jul 2024 10:13:03 +0200 Subject: [PATCH 2/4] core: Init unit tests --- .../multiplatform_swisstransfer/common/Test.android.kt | 2 +- .../com/infomaniak/multiplatform_swisstransfer/common/Test.kt | 4 ++-- .../infomaniak/multiplatform_swisstransfer/common/Test.ios.kt | 4 ++-- .../infomaniak/multiplatform_swisstransfer/Test.android.kt | 2 +- .../kotlin/com/infomaniak/multiplatform_swisstransfer/Test.kt | 4 ++-- .../com/infomaniak/multiplatform_swisstransfer/Test.ios.kt | 4 ++-- .../infomaniak/multiplatform_swisstransfer/db/Test.android.kt | 2 +- .../com/infomaniak/multiplatform_swisstransfer/db/Test.kt | 4 ++-- .../com/infomaniak/multiplatform_swisstransfer/db/Test.ios.kt | 4 ++-- .../multiplatform_swisstransfer/network/Test.android.kt | 2 +- .../infomaniak/multiplatform_swisstransfer/network/Test.kt | 4 ++-- .../multiplatform_swisstransfer/network/Test.ios.kt | 4 ++-- 12 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Common/src/androidUnitTest/kotlin/com/infomaniak/multiplatform_swisstransfer/common/Test.android.kt b/Common/src/androidUnitTest/kotlin/com/infomaniak/multiplatform_swisstransfer/common/Test.android.kt index 3d0ca1d4..8263990f 100644 --- a/Common/src/androidUnitTest/kotlin/com/infomaniak/multiplatform_swisstransfer/common/Test.android.kt +++ b/Common/src/androidUnitTest/kotlin/com/infomaniak/multiplatform_swisstransfer/common/Test.android.kt @@ -25,6 +25,6 @@ class AndroidGreetingTest { @Test fun testExample() { - assertTrue("Check Android is mentioned", Greeting().greet().contains("Android")) + assertTrue("Check platform is android", getPlatform().name.contains("Android")) } } diff --git a/Common/src/commonTest/kotlin/com/infomaniak/multiplatform_swisstransfer/common/Test.kt b/Common/src/commonTest/kotlin/com/infomaniak/multiplatform_swisstransfer/common/Test.kt index a63217b1..8c2d965c 100644 --- a/Common/src/commonTest/kotlin/com/infomaniak/multiplatform_swisstransfer/common/Test.kt +++ b/Common/src/commonTest/kotlin/com/infomaniak/multiplatform_swisstransfer/common/Test.kt @@ -19,12 +19,12 @@ package com.infomaniak.multiplatform_swisstransfer.common import kotlin.test.Test -import kotlin.test.assertTrue +import kotlin.test.assertEquals class CommonGreetingTest { @Test fun testExample() { - assertTrue(Greeting().greet().contains("Hello"), "Check 'Hello' is mentioned") + assertEquals(4, 2 + 2, "Check for correct addition") } } diff --git a/Common/src/iosTest/kotlin/com/infomaniak/multiplatform_swisstransfer/common/Test.ios.kt b/Common/src/iosTest/kotlin/com/infomaniak/multiplatform_swisstransfer/common/Test.ios.kt index 7e169542..06d803a0 100644 --- a/Common/src/iosTest/kotlin/com/infomaniak/multiplatform_swisstransfer/common/Test.ios.kt +++ b/Common/src/iosTest/kotlin/com/infomaniak/multiplatform_swisstransfer/common/Test.ios.kt @@ -19,12 +19,12 @@ package com.infomaniak.multiplatform_swisstransfer.common import kotlin.test.Test -import kotlin.test.assertTrue +import kotlin.test.assertEquals class IosGreetingTest { @Test fun testExample() { - assertTrue(Greeting().greet().contains("iOS"), "Check iOS is mentioned") + assertEquals(4, 2 + 2, "Check for correct addition") } } diff --git a/Core/src/androidUnitTest/kotlin/com/infomaniak/multiplatform_swisstransfer/Test.android.kt b/Core/src/androidUnitTest/kotlin/com/infomaniak/multiplatform_swisstransfer/Test.android.kt index d64279a9..179857f9 100644 --- a/Core/src/androidUnitTest/kotlin/com/infomaniak/multiplatform_swisstransfer/Test.android.kt +++ b/Core/src/androidUnitTest/kotlin/com/infomaniak/multiplatform_swisstransfer/Test.android.kt @@ -25,6 +25,6 @@ class AndroidGreetingTest { @Test fun testExample() { - assertTrue("Check Android is mentioned", Greeting().greet().contains("Android")) + assertTrue("Check platform is android", getPlatform().name.contains("Android")) } } diff --git a/Core/src/commonTest/kotlin/com/infomaniak/multiplatform_swisstransfer/Test.kt b/Core/src/commonTest/kotlin/com/infomaniak/multiplatform_swisstransfer/Test.kt index 19fa47f0..f639caa3 100644 --- a/Core/src/commonTest/kotlin/com/infomaniak/multiplatform_swisstransfer/Test.kt +++ b/Core/src/commonTest/kotlin/com/infomaniak/multiplatform_swisstransfer/Test.kt @@ -19,12 +19,12 @@ package com.infomaniak.multiplatform_swisstransfer import kotlin.test.Test -import kotlin.test.assertTrue +import kotlin.test.assertEquals class CommonGreetingTest { @Test fun testExample() { - assertTrue(Greeting().greet().contains("Hello"), "Check 'Hello' is mentioned") + assertEquals(4, 2 + 2, "Check for correct addition") } } diff --git a/Core/src/iosTest/kotlin/com/infomaniak/multiplatform_swisstransfer/Test.ios.kt b/Core/src/iosTest/kotlin/com/infomaniak/multiplatform_swisstransfer/Test.ios.kt index b005bb4e..b2c501a2 100644 --- a/Core/src/iosTest/kotlin/com/infomaniak/multiplatform_swisstransfer/Test.ios.kt +++ b/Core/src/iosTest/kotlin/com/infomaniak/multiplatform_swisstransfer/Test.ios.kt @@ -19,12 +19,12 @@ package com.infomaniak.multiplatform_swisstransfer import kotlin.test.Test -import kotlin.test.assertTrue +import kotlin.test.assertEquals class IosGreetingTest { @Test fun testExample() { - assertTrue(Greeting().greet().contains("iOS"), "Check iOS is mentioned") + assertEquals(4, 2 + 2, "Check for correct addition") } } diff --git a/DB/src/androidUnitTest/kotlin/com/infomaniak/multiplatform_swisstransfer/db/Test.android.kt b/DB/src/androidUnitTest/kotlin/com/infomaniak/multiplatform_swisstransfer/db/Test.android.kt index f021777d..f9595e20 100644 --- a/DB/src/androidUnitTest/kotlin/com/infomaniak/multiplatform_swisstransfer/db/Test.android.kt +++ b/DB/src/androidUnitTest/kotlin/com/infomaniak/multiplatform_swisstransfer/db/Test.android.kt @@ -25,6 +25,6 @@ class AndroidGreetingTest { @Test fun testExample() { - assertTrue("Check Android is mentioned", Greeting().greet().contains("Android")) + assertTrue("Check platform is android", getPlatform().name.contains("Android")) } } diff --git a/DB/src/commonTest/kotlin/com/infomaniak/multiplatform_swisstransfer/db/Test.kt b/DB/src/commonTest/kotlin/com/infomaniak/multiplatform_swisstransfer/db/Test.kt index 24b3e353..d1c2c3c2 100644 --- a/DB/src/commonTest/kotlin/com/infomaniak/multiplatform_swisstransfer/db/Test.kt +++ b/DB/src/commonTest/kotlin/com/infomaniak/multiplatform_swisstransfer/db/Test.kt @@ -19,12 +19,12 @@ package com.infomaniak.multiplatform_swisstransfer.db import kotlin.test.Test -import kotlin.test.assertTrue +import kotlin.test.assertEquals class CommonGreetingTest { @Test fun testExample() { - assertTrue(Greeting().greet().contains("Hello"), "Check 'Hello' is mentioned") + assertEquals(4, 2 + 2, "Check for correct addition") } } diff --git a/DB/src/iosTest/kotlin/com/infomaniak/multiplatform_swisstransfer/db/Test.ios.kt b/DB/src/iosTest/kotlin/com/infomaniak/multiplatform_swisstransfer/db/Test.ios.kt index d47bb45b..c34ab818 100644 --- a/DB/src/iosTest/kotlin/com/infomaniak/multiplatform_swisstransfer/db/Test.ios.kt +++ b/DB/src/iosTest/kotlin/com/infomaniak/multiplatform_swisstransfer/db/Test.ios.kt @@ -19,12 +19,12 @@ package com.infomaniak.multiplatform_swisstransfer.db import kotlin.test.Test -import kotlin.test.assertTrue +import kotlin.test.assertEquals class IosGreetingTest { @Test fun testExample() { - assertTrue(Greeting().greet().contains("iOS"), "Check iOS is mentioned") + assertEquals(4, 2 + 2, "Check for correct addition") } } diff --git a/Network/src/androidUnitTest/kotlin/com/infomaniak/multiplatform_swisstransfer/network/Test.android.kt b/Network/src/androidUnitTest/kotlin/com/infomaniak/multiplatform_swisstransfer/network/Test.android.kt index 36e4ffe2..5d9b4cd0 100644 --- a/Network/src/androidUnitTest/kotlin/com/infomaniak/multiplatform_swisstransfer/network/Test.android.kt +++ b/Network/src/androidUnitTest/kotlin/com/infomaniak/multiplatform_swisstransfer/network/Test.android.kt @@ -25,6 +25,6 @@ class AndroidGreetingTest { @Test fun testExample() { - assertTrue("Check Android is mentioned", Greeting().greet().contains("Android")) + assertTrue("Check platform is android", getPlatform().name.contains("Android")) } } diff --git a/Network/src/commonTest/kotlin/com/infomaniak/multiplatform_swisstransfer/network/Test.kt b/Network/src/commonTest/kotlin/com/infomaniak/multiplatform_swisstransfer/network/Test.kt index 288431ef..48295b59 100644 --- a/Network/src/commonTest/kotlin/com/infomaniak/multiplatform_swisstransfer/network/Test.kt +++ b/Network/src/commonTest/kotlin/com/infomaniak/multiplatform_swisstransfer/network/Test.kt @@ -19,12 +19,12 @@ package com.infomaniak.multiplatform_swisstransfer.network import kotlin.test.Test -import kotlin.test.assertTrue +import kotlin.test.assertEquals class CommonGreetingTest { @Test fun testExample() { - assertTrue(Greeting().greet().contains("Hello"), "Check 'Hello' is mentioned") + assertEquals(4, 2 + 2, "Check for correct addition") } } diff --git a/Network/src/iosTest/kotlin/com/infomaniak/multiplatform_swisstransfer/network/Test.ios.kt b/Network/src/iosTest/kotlin/com/infomaniak/multiplatform_swisstransfer/network/Test.ios.kt index 0e2c3bb5..96c7f841 100644 --- a/Network/src/iosTest/kotlin/com/infomaniak/multiplatform_swisstransfer/network/Test.ios.kt +++ b/Network/src/iosTest/kotlin/com/infomaniak/multiplatform_swisstransfer/network/Test.ios.kt @@ -19,12 +19,12 @@ package com.infomaniak.multiplatform_swisstransfer.network import kotlin.test.Test -import kotlin.test.assertTrue +import kotlin.test.assertEquals class IosGreetingTest { @Test fun testExample() { - assertTrue(Greeting().greet().contains("iOS"), "Check iOS is mentioned") + assertEquals(4, 2 + 2, "Check for correct addition") } } From 2c5cca4897e66057a9962352d1cc2a25bf6f8953 Mon Sep 17 00:00:00 2001 From: Abdourahamane Boinaidi Date: Tue, 2 Jul 2024 10:36:26 +0200 Subject: [PATCH 3/4] Update build multiplatform ci --- .github/workflows/multiplatform.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/multiplatform.yml b/.github/workflows/multiplatform.yml index 6bf3c8e4..c35b68a7 100644 --- a/.github/workflows/multiplatform.yml +++ b/.github/workflows/multiplatform.yml @@ -1,4 +1,4 @@ -name: Android CI +name: Multiplatform CI on: pull_request: @@ -31,7 +31,10 @@ jobs: - name: Build with Gradle run: | ./gradlew clean - ./gradlew build + ./gradlew :Common:build + ./gradlew :Core:build + ./gradlew :DB:build + ./gradlew :Network:build # Run tests - name: Run Unit tests From 0cb9416a5bfdcf908ac10b21c1b0dff89409aeec Mon Sep 17 00:00:00 2001 From: Abdourahamane Boinaidi Date: Tue, 2 Jul 2024 10:44:30 +0200 Subject: [PATCH 4/4] core: Update gradle tasks and kotlin daemon memory --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index f033588c..7a1a9904 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ #Gradle -org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx2048M" +org.gradle.jvmargs=-Xmx4g -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx4g" org.gradle.caching=true org.gradle.configuration-cache=true #Kotlin