From cdf68f55d08a1d546f35c75aa72677cc8aab8278 Mon Sep 17 00:00:00 2001 From: Joscha Henningsen Date: Fri, 12 Mar 2021 21:05:35 +0100 Subject: [PATCH 01/10] basic github action for ci --- .github/workflows/branches.yml | 16 +++++++++++++ .gitignore | 1 - .travis.yml | 41 ---------------------------------- app/build.gradle | 2 +- 4 files changed, 17 insertions(+), 43 deletions(-) create mode 100644 .github/workflows/branches.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/branches.yml b/.github/workflows/branches.yml new file mode 100644 index 0000000000..f4823e4d3b --- /dev/null +++ b/.github/workflows/branches.yml @@ -0,0 +1,16 @@ +name: CI +on: + pull_request: + branches: master +jobs: + test-build: + runs-on: ubuntu-latest + steps: + - name: Checkout the code + uses: actions/checkout@v2 + - name: Check Dependencies + run: ./gradlew dependencies + - name: Lint + run: ./gradlew klintCheck + - name: Test + run: ./gradlew test diff --git a/.gitignore b/.gitignore index 0179e46c03..375971191c 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ !.idea/inspectionProfiles/ !.idea/vcs.xml *.apk -gradlew /app/release/ fastlane/report.xml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 25c95cfe03..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,41 +0,0 @@ -sudo: false -language: android -jdk: oraclejdk8 -before_cache: - - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock - - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ -cache: - directories: - - $HOME/.gradle/caches/ - - $HOME/.gradle/wrapper/ - - $HOME/.android/build-cache -env: - global: - - ANDROID_API=30 - - ANDROID_BUILD_TOOLS=29.0.2 -android: - components: - - tools - - platform-tools - - extra-android-support - - extra-android-m2repository - - extra-google-google_play_services - - extra-google-m2repository - - android-$ANDROID_API_LEVEL - - build-tools-$ANDROID_BUILD_TOOLS - - addon-google_apis-google-$ANDROID_API_LEVEL - licenses: - - '.+' -before_install: -- yes | sdkmanager "platforms;android-27" -- chmod +x gradlew -install: -- "./gradlew dependencies" -script: -- "./gradlew ktlintCheck" -- "./gradlew check" -before_deploy: -- cat "$TRAVIS_BUILD_DIR/app/build/reports/lint-results.xml" -- cat "$TRAVIS_BUILD_DIR/app/build/reports/pmd/duplicates.xml" -- cat "$TRAVIS_BUILD_DIR/app/build/reports/detekt/detekt-checkstyle.xml" -- cat "$TRAVIS_BUILD_DIR/app/build/reports/findbugs/findBugsDebug.xml" \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 1451dacc08..fa41da89c9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -188,7 +188,7 @@ dependencies { testImplementation 'com.android.support.test:rules:1.0.2' testImplementation 'com.android.support.test:runner:1.0.2' testImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' - testImplementation "org.robolectric:robolectric:4.4" + testImplementation "org.robolectric:robolectric:4.5.1" // TicketSale implementation 'com.stripe:stripe-android:6.1.2' From 00366dc5bf82fac237f4d31d504e57bd9271020a Mon Sep 17 00:00:00 2001 From: Joscha Henningsen Date: Fri, 12 Mar 2021 21:21:11 +0100 Subject: [PATCH 02/10] fix yaml syntax (perhaps) --- .github/workflows/branches.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/branches.yml b/.github/workflows/branches.yml index f4823e4d3b..548af470f5 100644 --- a/.github/workflows/branches.yml +++ b/.github/workflows/branches.yml @@ -6,7 +6,6 @@ jobs: test-build: runs-on: ubuntu-latest steps: - - name: Checkout the code uses: actions/checkout@v2 - name: Check Dependencies run: ./gradlew dependencies From 35e71bff7d445cdb44f760138a587e0592089be9 Mon Sep 17 00:00:00 2001 From: Joscha Henningsen Date: Fri, 12 Mar 2021 21:41:38 +0100 Subject: [PATCH 03/10] I don't know what I'm doing --- .github/workflows/branches.yml | 41 +++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/.github/workflows/branches.yml b/.github/workflows/branches.yml index 548af470f5..daae1752dd 100644 --- a/.github/workflows/branches.yml +++ b/.github/workflows/branches.yml @@ -1,15 +1,36 @@ name: CI + +# Controls when the action will run. on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ master ] pull_request: - branches: master + branches: [ master ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - test-build: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on runs-on: ubuntu-latest - steps: - uses: actions/checkout@v2 - - name: Check Dependencies - run: ./gradlew dependencies - - name: Lint - run: ./gradlew klintCheck - - name: Test - run: ./gradlew test + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + - name: Check dependencies + run: ./gradlew dependencies + + - name: Lint Check + run: ./gradlew klintCheck + + - name: Build + run: ./gradlew build + + - name: Test + run: ./gradlew test From 3f674484ac2536734d6dd9a5658918ff9a70ccde Mon Sep 17 00:00:00 2001 From: Joscha Henningsen Date: Fri, 12 Mar 2021 21:50:40 +0100 Subject: [PATCH 04/10] remove some comments --- .github/workflows/branches.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/branches.yml b/.github/workflows/branches.yml index daae1752dd..ba229a1fe8 100644 --- a/.github/workflows/branches.yml +++ b/.github/workflows/branches.yml @@ -1,6 +1,5 @@ name: CI -# Controls when the action will run. on: # Triggers the workflow on push or pull request events but only for the master branch push: @@ -11,14 +10,10 @@ on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" build: - # The type of runner that the job will run on runs-on: ubuntu-latest - # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 From 153c4e1e7996fb2353017a6ca71049629d50276c Mon Sep 17 00:00:00 2001 From: Joscha Henningsen Date: Fri, 12 Mar 2021 21:52:07 +0100 Subject: [PATCH 05/10] please just run this . . --- .github/workflows/branches.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/branches.yml b/.github/workflows/branches.yml index ba229a1fe8..457cfb50cb 100644 --- a/.github/workflows/branches.yml +++ b/.github/workflows/branches.yml @@ -3,7 +3,7 @@ name: CI on: # Triggers the workflow on push or pull request events but only for the master branch push: - branches: [ master ] + branches: [ master, actions ] pull_request: branches: [ master ] @@ -21,11 +21,11 @@ jobs: - name: Check dependencies run: ./gradlew dependencies - - name: Lint Check - run: ./gradlew klintCheck - - name: Build run: ./gradlew build - name: Test run: ./gradlew test + + - name: Lint Check + run: ./gradlew ktlintCheck \ No newline at end of file From a6129940779d15345e4aefd750b36a4570930421 Mon Sep 17 00:00:00 2001 From: Joscha Henningsen Date: Fri, 12 Mar 2021 22:52:14 +0100 Subject: [PATCH 06/10] build only --- .github/workflows/branches.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/branches.yml b/.github/workflows/branches.yml index 457cfb50cb..30d98c695c 100644 --- a/.github/workflows/branches.yml +++ b/.github/workflows/branches.yml @@ -18,14 +18,5 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 - - name: Check dependencies - run: ./gradlew dependencies - - name: Build run: ./gradlew build - - - name: Test - run: ./gradlew test - - - name: Lint Check - run: ./gradlew ktlintCheck \ No newline at end of file From c616e9ebb5d6b8e448ff796997b8f59700b77f5f Mon Sep 17 00:00:00 2001 From: Joscha Henningsen Date: Fri, 12 Mar 2021 23:01:56 +0100 Subject: [PATCH 07/10] run without detekt --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index fa41da89c9..701a4175ef 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,7 +1,7 @@ plugins { id 'de.aaschmid.cpd' version '3.1' } -apply plugin: "io.gitlab.arturbosch.detekt" +// apply plugin: "io.gitlab.arturbosch.detekt" apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' apply plugin: 'kotlin-android' From 82beda22a1b9554f9cc37d4afdeccb413e4fdc21 Mon Sep 17 00:00:00 2001 From: Joscha Henningsen Date: Fri, 12 Mar 2021 23:04:06 +0100 Subject: [PATCH 08/10] . --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 701a4175ef..1f33d7d16f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,7 +12,7 @@ apply plugin: 'com.google.firebase.crashlytics' apply from: '../gradle/scripts/pmd.gradle' apply from: '../gradle/scripts/jacoco.gradle' apply from: '../gradle/scripts/checkstyle.gradle' -apply from: '../gradle/scripts/detekt.gradle' +// apply from: '../gradle/scripts/detekt.gradle' apply from: '../gradle/scripts/testLogging.gradle' android { From 637bab28e4892777af42caa8b7af56fa95a08ae8 Mon Sep 17 00:00:00 2001 From: Joscha Henningsen Date: Sat, 13 Mar 2021 09:05:42 +0100 Subject: [PATCH 09/10] ktlintFormat --- app/src/main/java/de/tum/in/tumcampusapp/App.kt | 1 - .../other/settings/SettingsFragment.kt | 17 ++++++++--------- .../component/tumui/grades/GradesFragment.kt | 3 +-- .../component/ui/onboarding/StartupActivity.kt | 6 +++--- .../component/ui/overview/card/Card.kt | 11 +++++------ .../ui/transportation/DepartureView.kt | 1 - 6 files changed, 17 insertions(+), 22 deletions(-) diff --git a/app/src/main/java/de/tum/in/tumcampusapp/App.kt b/app/src/main/java/de/tum/in/tumcampusapp/App.kt index 7a0e9fba69..5424d35845 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/App.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/App.kt @@ -1,7 +1,6 @@ package de.tum.`in`.tumcampusapp import android.app.Application -import android.content.res.Resources import android.os.StrictMode import androidx.appcompat.app.AppCompatDelegate import com.google.firebase.crashlytics.FirebaseCrashlytics diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/other/settings/SettingsFragment.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/other/settings/SettingsFragment.kt index ee4c821418..d1c8677d35 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/other/settings/SettingsFragment.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/other/settings/SettingsFragment.kt @@ -41,7 +41,6 @@ import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.disposables.CompositeDisposable import io.reactivex.schedulers.Schedulers import kotlinx.android.synthetic.main.activity_setup_eduroam.* -import org.jetbrains.anko.appcompat.v7.Appcompat import org.jetbrains.anko.defaultSharedPreferences import org.jetbrains.anko.notificationManager import java.util.concurrent.ExecutionException @@ -66,8 +65,8 @@ class SettingsFragment : PreferenceFragmentCompat(), Preference.OnPreferenceClic } override fun onCreatePreferences( - savedInstanceState: Bundle?, - rootKey: String? + savedInstanceState: Bundle?, + rootKey: String? ) { setPreferencesFromResource(R.xml.settings, rootKey) populateNewsSources() @@ -134,8 +133,8 @@ class SettingsFragment : PreferenceFragmentCompat(), Preference.OnPreferenceClic } private fun loadNewsSourceIcon( - preference: Preference, - url: String + preference: Preference, + url: String ) { compositeDisposable += Single .fromCallable { Picasso.get().load(url).get() } @@ -157,8 +156,8 @@ class SettingsFragment : PreferenceFragmentCompat(), Preference.OnPreferenceClic } override fun onSharedPreferenceChanged( - sharedPrefs: SharedPreferences, - key: String? + sharedPrefs: SharedPreferences, + key: String? ) { if (key == null) { return @@ -268,7 +267,7 @@ class SettingsFragment : PreferenceFragmentCompat(), Preference.OnPreferenceClic } override fun onPreferenceClick( - preference: Preference? + preference: Preference? ): Boolean { when (preference?.key) { SETUP_EDUROAM -> startActivity(Intent(context, SetupEduroamActivity::class.java)) @@ -334,7 +333,7 @@ class SettingsFragment : PreferenceFragmentCompat(), Preference.OnPreferenceClic private const val SETUP_EDUROAM = "card_eduroam_setup" fun newInstance( - key: String? + key: String? ) = SettingsFragment().apply { arguments = bundleOf(ARG_PREFERENCE_ROOT to key) } } } diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/grades/GradesFragment.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/grades/GradesFragment.kt index 52e7514309..1cc8002078 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/grades/GradesFragment.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/grades/GradesFragment.kt @@ -15,7 +15,6 @@ import android.widget.AdapterView import android.widget.ArrayAdapter import android.widget.ImageView import androidx.core.content.ContextCompat -import com.github.mikephil.charting.charts.Chart import com.github.mikephil.charting.components.Legend import com.github.mikephil.charting.components.LegendEntry import com.github.mikephil.charting.data.* @@ -162,7 +161,7 @@ class GradesFragment : FragmentForAccessingTumOnline( setFitBars(true) // only label grades that are associated with at least one grade - data.setValueFormatter(object: ValueFormatter() { + data.setValueFormatter(object : ValueFormatter() { override fun getFormattedValue(value: Float): String? { if (value > 0.0) return value.toString() diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/onboarding/StartupActivity.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/onboarding/StartupActivity.kt index 575ea92c59..d1f9c3ae59 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/onboarding/StartupActivity.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/onboarding/StartupActivity.kt @@ -160,9 +160,9 @@ class StartupActivity : BaseActivity(R.layout.activity_startup) { } override fun onRequestPermissionsResult( - requestCode: Int, - permissions: Array, - grantResults: IntArray + requestCode: Int, + permissions: Array, + grantResults: IntArray ) { openMainActivityIfInitializationFinished() } diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/card/Card.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/card/Card.kt index cfedfe10ae..c8729752b0 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/card/Card.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/card/Card.kt @@ -4,7 +4,6 @@ import android.content.Context import android.content.SharedPreferences import android.content.SharedPreferences.Editor import android.preference.PreferenceManager -import android.util.Log import androidx.recyclerview.widget.DiffUtil import de.tum.`in`.tumcampusapp.R import de.tum.`in`.tumcampusapp.component.other.navigation.NavDestination @@ -19,9 +18,9 @@ import de.tum.`in`.tumcampusapp.utils.Utils * @param settingsPrefix Preference key prefix used for all preferences belonging to that card */ abstract class Card( - val cardType: Int, - protected var context: Context, - val settingsPrefix: String = "" + val cardType: Int, + protected var context: Context, + val settingsPrefix: String = "" ) : Comparable { // Settings for showing this card on start page or as notification @@ -127,8 +126,8 @@ abstract class Card( protected abstract fun discard(editor: Editor) class DiffCallback( - private val oldList: List, - private val newList: List + private val oldList: List, + private val newList: List ) : DiffUtil.Callback() { override fun getOldListSize() = oldList.size diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/transportation/DepartureView.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/transportation/DepartureView.kt index 74a88f9824..0f06385aaa 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/transportation/DepartureView.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/transportation/DepartureView.kt @@ -3,7 +3,6 @@ package de.tum.`in`.tumcampusapp.component.ui.transportation import android.animation.ValueAnimator import android.content.Context import android.content.res.ColorStateList -import android.graphics.Color import android.os.Handler import android.view.Gravity import android.view.LayoutInflater From aca56bf7e4e53433faccba45e1f4b5a64d950950 Mon Sep 17 00:00:00 2001 From: Joscha Henningsen Date: Sat, 13 Mar 2021 09:14:42 +0100 Subject: [PATCH 10/10] remove trailing comma in Exam.kt --- .../de/tum/in/tumcampusapp/component/tumui/grades/model/Exam.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/grades/model/Exam.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/grades/model/Exam.kt index c965c55842..60503dd8f9 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/grades/model/Exam.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/grades/model/Exam.kt @@ -112,7 +112,7 @@ data class Exam( "4,7" to R.color.grade_4_7, "4,8" to R.color.grade_4_8, "4,9" to R.color.grade_4_9, - "5,0" to R.color.grade_5_0, + "5,0" to R.color.grade_5_0 ) } } \ No newline at end of file