Skip to content
Permalink
Browse files

Merge pull request #624 from squanchy-dev/ci-tweaks

Tweak the CI setup and build
  • Loading branch information...
fourlastor committed Mar 31, 2019
2 parents a646b7d + 5e8614b commit 67f1f0d297b7792617476d7c40c3e86e3bc3a2f2

This file was deleted.

Oops, something went wrong.
@@ -4,7 +4,7 @@ executors:
android:
working_directory: ~/squanchy
docker:
- image: circleci/android:api-28-alpha
- image: circleci/android:api-28
environment:
ANDROID_HOME: /opt/android/sdk
APPLICATION_ID: net.squanchy.example
@@ -14,13 +14,6 @@ executors:
ALGOLIA_INDICES_PREFIX: squanchy_dev

commands:
# FOSSA CLI install
install_fossa_cli:
steps:
- run:
name: Install FOSSA CLI
command: workspace/repo/.circleci/ci-scripts/install-fossa.sh

# Build Tools cache commands
restore_build_tools_cache:
steps:
@@ -142,7 +135,7 @@ jobs:
# See https://issuetracker.google.com/issues/62217354 for the parallelism option
- run:
name: Run static analysis
command: cd workspace/repo && ./gradlew check -Djava.util.concurrent.ForkJoinPool.common.parallelism=2
command: cd workspace/repo && ./gradlew lintRelease detekt ktlintCheck -Djava.util.concurrent.ForkJoinPool.common.parallelism=2

# Collect static analysis reports as build artifacts
- store_artifacts:
@@ -166,25 +159,6 @@ jobs:
- store_test_results:
path: workspace/repo/app/build/test-results

license_checks:
executor: android
steps:
- restore_workspace
- restore_gradle_cache
- restore_android_build_cache
- restore_build_tools_cache

- install_fossa_cli

- run:
name: Run FOSSA license check
command: fossa --no-ansi
working_directory: workspace/repo
- run:
name: Wait for FOSSA license check to complete
command: fossa test --no-ansi
working_directory: workspace/repo

workflows:
version: 2
build_and_test:
@@ -199,6 +173,3 @@ workflows:
- tests:
requires:
- prepare_for_checks
- license_checks:
requires:
- prepare_for_checks

This file was deleted.

Oops, something went wrong.
@@ -28,8 +28,6 @@ If you wish to commit code that is failing this test for whatever reason, you ca
that if you don't address the issues before pushing, the CI will fail the build.


## License [![FOSSA Status](https://app.fossa.io/api/projects/custom%2B6635%2Fgit%40github.com%3Asquanchy-dev%2Fsquanchy-android.git.svg?type=shield)](https://app.fossa.io/projects/custom%2B6635%2Fgit%40github.com%3Asquanchy-dev%2Fsquanchy-android.git?ref=badge_shield)
## License

Squanchy Android is released under Apache 2.0 licence. See the [LICENSE](LICENSE) file.

[![FOSSA Status](https://app.fossa.io/api/projects/custom%2B6635%2Fgit%40github.com%3Asquanchy-dev%2Fsquanchy-android.git.svg?type=large)](https://app.fossa.io/projects/custom%2B6635%2Fgit%40github.com%3Asquanchy-dev%2Fsquanchy-android.git?ref=badge_large)
@@ -121,6 +121,7 @@ detekt {
html.enabled = true
}
parallel = true
buildUponDefaultConfig = true
}

ktlint {
@@ -39,6 +39,7 @@ internal class NotificationModule {

@Provides
@Named(UPCOMING_EVENT_THRESHOLD)
@Suppress("MagicNumber") // It's not a magic number in this case, this is equivalent to a constant declaration
fun provideUpcomingEventThreshold(): Duration = Duration.ofMinutes(10)

@Provides
@@ -7,7 +7,6 @@ import org.threeten.bp.LocalDateTime
import org.threeten.bp.ZoneId
import org.threeten.bp.ZonedDateTime

@Suppress("LongParameterList") // This is just a big model - TODO refactor this to split it up
data class Event(
val id: String,
val numericId: Long,
@@ -179,7 +179,7 @@ class FilterChipView @JvmOverloads constructor(
}
}

@Suppress("DEPRECATION", "OverridingDeprecatedMember") // We're just preventing others from messing with this, not really using it
@Suppress("deprecation") // We're just preventing others from messing with this, not really using it
override fun setBackgroundDrawable(background: Drawable?) {
allowOnlyWhileInitializing("Can't interact with a FilterChipView's background directly") {
super.setBackgroundDrawable(background)
@@ -35,7 +35,6 @@ import net.squanchy.support.view.enableLightNavigationBar
import timber.log.Timber
import java.util.concurrent.TimeUnit

// Might use some refactoring later on to extract some collaborator
class SearchActivity : AppCompatActivity(), SearchRecyclerView.OnSearchResultClickListener {

private val subscriptions = CompositeDisposable()
@@ -228,28 +227,25 @@ class SearchActivity : AppCompatActivity(), SearchRecyclerView.OnSearchResultCli
override fun onEventClicked(event: Event) {
navigator.toEventDetails(event.id)
}
}

private class SearchTextWatcher(private val querySubject: PublishSubject<String>) : TextWatcher {

override fun beforeTextChanged(query: CharSequence, start: Int, count: Int, after: Int) {
// No-op
}

override fun onTextChanged(query: CharSequence?, start: Int, before: Int, count: Int) {
query?.let { querySubject.onNext(it.toString()) }
}
private class SearchTextWatcher(private val querySubject: PublishSubject<String>) : TextWatcher {

override fun afterTextChanged(query: Editable) {
// No-op
}
override fun beforeTextChanged(query: CharSequence, start: Int, count: Int, after: Int) {
// No-op
}

companion object {
override fun onTextChanged(query: CharSequence?, start: Int, before: Int, count: Int) {
query?.let { querySubject.onNext(it.toString()) }
}

private const val SPEECH_REQUEST_CODE = 100
private const val QUERY_DEBOUNCE_TIMEOUT = 350L
private const val MIN_QUERY_LENGTH = 2
private const val QUERY_KEY = "SearchActivity.query_key"
private const val INITIAL_QUERY = ""
override fun afterTextChanged(query: Editable) {
// No-op
}
}

private const val SPEECH_REQUEST_CODE = 100
private const val QUERY_DEBOUNCE_TIMEOUT = 350L
private const val MIN_QUERY_LENGTH = 2
private const val QUERY_KEY = "SearchActivity.query_key"
private const val INITIAL_QUERY = ""
@@ -68,42 +68,12 @@ class SettingsFragment : PreferenceFragment() {
accountCategory.removePreference(accountEmailPreference)
accountSignInSignOutPreference = findPreference(getString(R.string.account_signin_signout_preference_key))

val aboutPreference = findPreference(getString(R.string.about_preference_key))
aboutPreference.setOnPreferenceClickListener {
navigator.toAboutSquanchy()
true
}

val notificationsPreference = findPreference(getString(R.string.about_to_start_notification_preference_key))
notificationsPreference.setOnPreferenceChangeListener { _, enabled ->
if (enabled as Boolean) {
analytics.trackNotificationsEnabled()
} else {
analytics.trackNotificationsDisabled()
}
true
}

val favoritesInSchedulePreference = findPreference(getString(R.string.favorites_in_schedule_preference_key))
favoritesInSchedulePreference.setOnPreferenceChangeListener { _, enabled ->
if (enabled as Boolean) {
analytics.trackFavoritesInScheduleEnabled()
} else {
analytics.trackFavoritesInScheduleDisabled()
}
true
}
setupAboutPreference()

setupAboutToStartNotificationPreference()
setupFavoritesInSchedulePreference()
setupAnalyticsOptOutPreference(activity)
setupWifiConfigPreference()

val disableAnalyticsPreferences = findPreference(getString(R.string.disable_analytics_key))
disableAnalyticsPreferences.setOnPreferenceChangeListener { _, _ ->
with(settingsFragmentComponent(activity)) {
analytics = analytics()
}
analytics.setupExceptionLogging()
true
}
}

private fun displayBuildVersion() {
@@ -119,11 +89,57 @@ class SettingsFragment : PreferenceFragment() {
preferenceScreen.removePreference(debugCategory)
}

private fun setupAboutPreference() {
findPreference(getString(R.string.about_preference_key))
.setOnPreferenceClickListener {
navigator.toAboutSquanchy()
true
}
}

private fun setupAboutToStartNotificationPreference() {
findPreference(getString(R.string.about_to_start_notification_preference_key))
.setOnPreferenceChangeListener { _, enabled ->
if (enabled as Boolean) {
analytics.trackNotificationsEnabled()
} else {
analytics.trackNotificationsDisabled()
}
true
}
}

private fun setupFavoritesInSchedulePreference() {
findPreference(getString(R.string.favorites_in_schedule_preference_key))
.setOnPreferenceChangeListener { _, enabled ->
if (enabled as Boolean) {
analytics.trackFavoritesInScheduleEnabled()
} else {
analytics.trackFavoritesInScheduleDisabled()
}
true
}
}

private fun setupAnalyticsOptOutPreference(activity: AppCompatActivity) {
findPreference(getString(R.string.disable_analytics_key))
.setOnPreferenceChangeListener { _, _ ->
with(settingsFragmentComponent(activity)) {
analytics = analytics()
}
analytics.setupExceptionLogging()
true
}
}

private fun setupWifiConfigPreference() {
val wifiPreference = findPreference(getString(R.string.auto_wifi_preference_key))

if (wifiAutoConfigEnabledNow(remoteConfig)) {
wifiPreference.setOnPreferenceClickListener { setupWifi(); true }
wifiPreference.setOnPreferenceClickListener {
setupWifi()
true
}
} else {
val settingsCategory = findPreference(getString(R.string.settings_category_key)) as PreferenceCategory
settingsCategory.removePreference(wifiPreference)
@@ -2,7 +2,6 @@ package net.squanchy.speaker.domain.view

import arrow.core.Option

@Suppress("LongParameterList") // This is just a big model - TODO refactor this to split it up
data class Speaker(
val numericId: Long,
val id: String,
@@ -11,7 +11,7 @@ internal fun String.parseHtml(): Spanned {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Html.fromHtml(this, Html.FROM_HTML_MODE_LEGACY)
} else {
@Suppress("DEPRECATION") // This is a "compat" method call, we only use this on pre-N
@Suppress("deprecation") // This is a "compat" method call, we only use this on pre-N
Html.fromHtml(this)
}
}
@@ -3,8 +3,7 @@ package net.squanchy.support.view
import android.view.MotionEvent
import android.view.View

@Suppress("DataClassPrivateConstructor")
data class Hotspot private constructor(val x: Float, val y: Float) {
data class Hotspot constructor(val x: Float, val y: Float) {

fun offsetToParent(parent: View) = Hotspot(x + parent.x, y + parent.y)

@@ -1,3 +1,5 @@
@file:Suppress("MatchingDeclarationName") // See https://github.com/arturbosch/detekt/issues/1500

package net.squanchy.support.widget

import android.os.Parcel
@@ -2,7 +2,6 @@ package net.squanchy.venue.domain.view

import org.threeten.bp.ZoneId

@Suppress("LongParameterList") // This is just a big model - TODO refactor this to split it up
data class Venue(
val name: String,
val address: String,
@@ -15,7 +15,7 @@ buildscript {

plugins {
id 'com.github.ben-manes.versions' version '0.20.0'
id 'io.gitlab.arturbosch.detekt' version '1.0.0-RC12'
id 'io.gitlab.arturbosch.detekt' version '1.0.0-RC14'
id 'org.jlleitschuh.gradle.ktlint' version '7.0.0'
}

BIN +426 Bytes (100%) gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
18 gradlew
@@ -1,5 +1,21 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
## Gradle start up script for UN*X
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m"'
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Oops, something went wrong.

0 comments on commit 67f1f0d

Please sign in to comment.
You can’t perform that action at this time.