Skip to content

Commit

Permalink
Add reusable workflows for PRs and testing builds
Browse files Browse the repository at this point in the history
  • Loading branch information
esensar committed Sep 28, 2024
1 parent 09f89f3 commit 1c70f8b
Show file tree
Hide file tree
Showing 7 changed files with 2,541 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: PR

on:
pull_request:
branches: [ master ]

jobs:
call-pr-workflow:
uses: FossifyOrg/.github/.github/workflows/pr.yml@main
10 changes: 10 additions & 0 deletions .github/workflows/testing-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Testing build (on PR)

on:
pull_request:
branches: [ master ]
types: [ labeled, opened, synchronize, reopened ]

jobs:
call-testing-build-workflow:
uses: FossifyOrg/.github/.github/workflows/testing-build.yml@main
9 changes: 8 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugins {
alias(libs.plugins.android)
alias(libs.plugins.kotlinAndroid)
alias(libs.plugins.ksp)
alias(libs.plugins.detekt)
}

val keystorePropertiesFile: File = rootProject.file("keystore.properties")
Expand Down Expand Up @@ -100,12 +101,18 @@ android {

lint {
checkReleaseBuilds = false
abortOnError = false
abortOnError = true
warningsAsErrors = true
baseline = file("lint-baseline.xml")
}

namespace = "com.fossify.calculator"
}

detekt {
baseline = file("detekt-baseline.xml")
}

dependencies {
implementation(libs.fossify.commons)
implementation(libs.auto.fit.text.view)
Expand Down
93 changes: 93 additions & 0 deletions app/detekt-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?xml version="1.0" ?>
<SmellBaseline>
<ManuallySuppressedIssues></ManuallySuppressedIssues>
<CurrentIssues>
<ID>CyclomaticComplexMethod:CalculatorImpl.kt$CalculatorImpl$fun handleOperation(operation: String)</ID>
<ID>CyclomaticComplexMethod:CalculatorImpl.kt$CalculatorImpl$private fun calculateResult()</ID>
<ID>CyclomaticComplexMethod:MyWidgetProvider.kt$MyWidgetProvider$private fun myAction(action: String, context: Context)</ID>
<ID>EmptyFunctionBlock:WidgetConfigureActivity.kt$WidgetConfigureActivity.&lt;no name provided&gt;${}</ID>
<ID>ForEachOnRange:Context.kt$(0 until cnt).map { viewGroup.getChildAt(it) }</ID>
<ID>FunctionNaming:SettingsScreen.kt$@Composable internal fun SettingsScreen( goBack: () -&gt; Unit, customizeColors: () -&gt; Unit, customizeWidgetColors: () -&gt; Unit, preventPhoneFromSleeping: Boolean, onPreventPhoneFromSleeping: (Boolean) -&gt; Unit, vibrateOnButtonPressFlow: Boolean, onVibrateOnButtonPressFlow: (Boolean) -&gt; Unit, isOrWasThankYouInstalled: Boolean, onThankYou: () -&gt; Unit, isUseEnglishEnabled: Boolean, isUseEnglishChecked: Boolean, onUseEnglishPress: (Boolean) -&gt; Unit, onSetupLanguagePress: () -&gt; Unit, useCommaAsDecimalMarkFlow: Boolean, onUseCommaAsDecimalMarkFlow: (Boolean) -&gt; Unit, lockedCustomizeColorText: String, displayLanguage: String, featureLockedDialogState: AlertDialogState )</ID>
<ID>FunctionNaming:SettingsScreen.kt$@MyDevices @Composable private fun SettingsScreenPreview()</ID>
<ID>LongMethod:CalculatorImpl.kt$CalculatorImpl$private fun calculateResult()</ID>
<ID>LongMethod:SettingsScreen.kt$@Composable internal fun SettingsScreen( goBack: () -&gt; Unit, customizeColors: () -&gt; Unit, customizeWidgetColors: () -&gt; Unit, preventPhoneFromSleeping: Boolean, onPreventPhoneFromSleeping: (Boolean) -&gt; Unit, vibrateOnButtonPressFlow: Boolean, onVibrateOnButtonPressFlow: (Boolean) -&gt; Unit, isOrWasThankYouInstalled: Boolean, onThankYou: () -&gt; Unit, isUseEnglishEnabled: Boolean, isUseEnglishChecked: Boolean, onUseEnglishPress: (Boolean) -&gt; Unit, onSetupLanguagePress: () -&gt; Unit, useCommaAsDecimalMarkFlow: Boolean, onUseCommaAsDecimalMarkFlow: (Boolean) -&gt; Unit, lockedCustomizeColorText: String, displayLanguage: String, featureLockedDialogState: AlertDialogState )</ID>
<ID>LongParameterList:SettingsScreen.kt$( goBack: () -&gt; Unit, customizeColors: () -&gt; Unit, customizeWidgetColors: () -&gt; Unit, preventPhoneFromSleeping: Boolean, onPreventPhoneFromSleeping: (Boolean) -&gt; Unit, vibrateOnButtonPressFlow: Boolean, onVibrateOnButtonPressFlow: (Boolean) -&gt; Unit, isOrWasThankYouInstalled: Boolean, onThankYou: () -&gt; Unit, isUseEnglishEnabled: Boolean, isUseEnglishChecked: Boolean, onUseEnglishPress: (Boolean) -&gt; Unit, onSetupLanguagePress: () -&gt; Unit, useCommaAsDecimalMarkFlow: Boolean, onUseCommaAsDecimalMarkFlow: (Boolean) -&gt; Unit, lockedCustomizeColorText: String, displayLanguage: String, featureLockedDialogState: AlertDialogState )</ID>
<ID>MagicNumber:CalculatorImpl.kt$CalculatorImpl$100</ID>
<ID>MagicNumber:CalculatorImpl.kt$CalculatorImpl$100f</ID>
<ID>MagicNumber:CalculatorImpl.kt$CalculatorImpl$3</ID>
<ID>MagicNumber:CalculatorImpl.kt$CalculatorImpl$4</ID>
<ID>MagicNumber:CalculatorImpl.kt$CalculatorImpl$5</ID>
<ID>MagicNumber:CalculatorImpl.kt$CalculatorImpl$6</ID>
<ID>MagicNumber:CalculatorImpl.kt$CalculatorImpl$7</ID>
<ID>MagicNumber:CalculatorImpl.kt$CalculatorImpl$8</ID>
<ID>MagicNumber:CalculatorImpl.kt$CalculatorImpl$9</ID>
<ID>MagicNumber:ConverterView.kt$ConverterView$3</ID>
<ID>MagicNumber:ConverterView.kt$ConverterView$4</ID>
<ID>MagicNumber:ConverterView.kt$ConverterView$5</ID>
<ID>MagicNumber:ConverterView.kt$ConverterView$6</ID>
<ID>MagicNumber:ConverterView.kt$ConverterView$7</ID>
<ID>MagicNumber:ConverterView.kt$ConverterView$8</ID>
<ID>MagicNumber:ConverterView.kt$ConverterView$9</ID>
<ID>MagicNumber:NumberFormatHelper.kt$NumberFormatHelper$12</ID>
<ID>MagicNumber:WidgetConfigureActivity.kt$WidgetConfigureActivity$100</ID>
<ID>MaxLineLength:AreaConverter.kt$AreaConverter.Unit$sealed</ID>
<ID>MaxLineLength:CalculatorDatabase.kt$CalculatorDatabase.Companion$db</ID>
<ID>MaxLineLength:CalculatorImpl.kt$CalculatorImpl$// handle percents manually, it doesn't seem to be possible via net.objecthunter:exp4j. "%" is used only for modulo there</ID>
<ID>MaxLineLength:CalculatorImpl.kt$CalculatorImpl$History(id = null, formula = newFormula, result = result.format(), timestamp = System.currentTimeMillis())</ID>
<ID>MaxLineLength:CalculatorImpl.kt$CalculatorImpl$if</ID>
<ID>MaxLineLength:CalculatorImpl.kt$CalculatorImpl$value == "0" &amp;&amp; !valueToCheck.contains(operationsRegex.toRegex()) -&gt; inputDisplayedFormula = "0$decimalSeparator"</ID>
<ID>MaxLineLength:Context.kt$// we are reusing the same layout in the app and widget, but cannot use MyTextView etc in a widget, so color regular view types like this</ID>
<ID>MaxLineLength:Context.kt$val</ID>
<ID>MaxLineLength:ConverterView.kt$ConverterView$private</ID>
<ID>MaxLineLength:ConverterView.kt$ConverterView$val bgLayer = bgLayerList.findDrawableByLayerId(org.fossify.commons.R.id.button_pill_background_shape) as GradientDrawable</ID>
<ID>MaxLineLength:ConverterView.kt$ConverterView$val bgLayerList = drawable.findDrawableByLayerId(org.fossify.commons.R.id.button_pill_background_holder) as LayerDrawable</ID>
<ID>MaxLineLength:ConverterView.kt$ConverterView$val converted = convert(topUnit!!.withValue(formatter.removeGroupingSeparator(binding.topUnitText.text.toString()).toDouble()), bottomUnit!!).value</ID>
<ID>MaxLineLength:ConverterView.kt$ConverterView$val width = listOf(symbolHeight, binding.topUnitSymbol.measuredWidth, binding.bottomUnitSymbol.measuredWidth).max()</ID>
<ID>MaxLineLength:HistoryAdapter.kt$HistoryAdapter$class</ID>
<ID>MaxLineLength:LengthConverter.kt$LengthConverter.Unit$sealed</ID>
<ID>MaxLineLength:MainActivity.kt$MainActivity$arrayOf(btnPercent, btnPower, btnRoot, btnClear, btnReset, btnDivide, btnMultiply, btnPlus, btnMinus, btnEquals, btnDecimal)</ID>
<ID>MaxLineLength:MainActivity.kt$MainActivity$faqItems.add(FAQItem(org.fossify.commons.R.string.faq_2_title_commons, org.fossify.commons.R.string.faq_2_text_commons))</ID>
<ID>MaxLineLength:MainActivity.kt$MainActivity$faqItems.add(FAQItem(org.fossify.commons.R.string.faq_6_title_commons, org.fossify.commons.R.string.faq_6_text_commons))</ID>
<ID>MaxLineLength:MainActivity.kt$MainActivity$findItem(R.id.more_apps_from_us).isVisible = !resources.getBoolean(org.fossify.commons.R.bool.hide_google_relations)</ID>
<ID>MaxLineLength:MainActivity.kt$MainActivity$it?.background = ResourcesCompat.getDrawable(resources, org.fossify.commons.R.drawable.pill_background, theme)</ID>
<ID>MaxLineLength:MainActivity.kt$MainActivity$updateMaterialActivityViews(binding.mainCoordinator, null, useTransparentNavigation = false, useTopSearchMenu = false)</ID>
<ID>MaxLineLength:MassConverter.kt$MassConverter.Unit$sealed</ID>
<ID>MaxLineLength:MyWidgetProvider.kt$MyWidgetProvider$DECIMAL</ID>
<ID>MaxLineLength:MyWidgetProvider.kt$MyWidgetProvider$R.id.btn_7</ID>
<ID>MaxLineLength:MyWidgetProvider.kt$MyWidgetProvider$R.id.formula</ID>
<ID>MaxLineLength:SettingsActivity.kt$SettingsActivity$val preventPhoneFromSleeping by preferences.preventPhoneFromSleepingFlow.collectAsStateWithLifecycle(preferences.preventPhoneFromSleeping)</ID>
<ID>MaxLineLength:SettingsActivity.kt$SettingsActivity$val useCommaAsDecimalMarkFlow by preferences.useCommaAsDecimalMarkFlow.collectAsStateWithLifecycle(preferences.useCommaAsDecimalMark)</ID>
<ID>MaxLineLength:SettingsActivity.kt$SettingsActivity$val vibrateOnButtonPressFlow by preferences.vibrateOnButtonPressFlow.collectAsStateWithLifecycle(preferences.vibrateOnButtonPress)</ID>
<ID>MaxLineLength:SettingsActivity.kt$SettingsActivity$val wasUseEnglishToggledFlow by preferences.wasUseEnglishToggledFlow.collectAsStateWithLifecycle(preferences.wasUseEnglishToggled)</ID>
<ID>MaxLineLength:TemperatureConverter.kt$TemperatureConverter.Unit$sealed</ID>
<ID>MaxLineLength:TimeConverter.kt$TimeConverter.Unit$sealed</ID>
<ID>MaxLineLength:UnitConverterActivity.kt$UnitConverterActivity$it.background = ResourcesCompat.getDrawable(resources, org.fossify.commons.R.drawable.pill_background, theme)</ID>
<ID>MaxLineLength:UnitConverterActivity.kt$UnitConverterActivity$updateMaterialActivityViews(binding.unitConverterCoordinator, null, useTransparentNavigation = false, useTopSearchMenu = false)</ID>
<ID>MaxLineLength:UnitConverterPickerActivity.kt$UnitConverterPickerActivity$binding.unitTypesGrid.layoutManager = AutoGridLayoutManager(this, resources.getDimensionPixelSize(R.dimen.unit_type_size))</ID>
<ID>MaxLineLength:UnitConverterPickerActivity.kt$UnitConverterPickerActivity$updateMaterialActivityViews(binding.unitConverterPickerCoordinator, null, useTransparentNavigation = false, useTopSearchMenu = false)</ID>
<ID>MaxLineLength:UnitTypesAdapter.kt$UnitTypesAdapter.ViewHolder$layerDrawable.findDrawableByLayerId(R.id.background_shape).applyColorFilter(context.getProperBackgroundColor().darkenColor(2))</ID>
<ID>MaxLineLength:UnitTypesAdapter.kt$UnitTypesAdapter.ViewHolder$val rippleBg = ResourcesCompat.getDrawable(resources, R.drawable.unit_type_background, context.theme) as RippleDrawable</ID>
<ID>MaxLineLength:VolumeConverter.kt$VolumeConverter.Unit$sealed</ID>
<ID>MaxLineLength:WidgetConfigureActivity.kt$WidgetConfigureActivity$R.id.btn_9</ID>
<ID>MaxLineLength:WidgetConfigureActivity.kt$WidgetConfigureActivity$if</ID>
<ID>NestedBlockDepth:CalculatorImpl.kt$CalculatorImpl$fun handleOperation(operation: String)</ID>
<ID>NestedBlockDepth:CalculatorImpl.kt$CalculatorImpl$private fun calculateResult()</ID>
<ID>ReturnCount:CalculatorImpl.kt$CalculatorImpl$fun turnToNegative(): Boolean</ID>
<ID>ReturnCount:CalculatorImpl.kt$CalculatorImpl$private fun calculateResult()</ID>
<ID>SwallowedException:CalculatorImpl.kt$CalculatorImpl$e: Exception</ID>
<ID>TooGenericExceptionCaught:CalculatorImpl.kt$CalculatorImpl$e: Exception</ID>
<ID>TooGenericExceptionCaught:Context.kt$e: Exception</ID>
<ID>TooManyFunctions:CalculatorImpl.kt$CalculatorImpl</ID>
<ID>TooManyFunctions:ConverterView.kt$ConverterView : LinearLayout</ID>
<ID>TooManyFunctions:MainActivity.kt$MainActivity : SimpleActivityCalculator</ID>
<ID>TooManyFunctions:MyWidgetProvider.kt$MyWidgetProvider : AppWidgetProviderCalculator</ID>
<ID>UnusedPrivateMember:SettingsScreen.kt$@MyDevices @Composable private fun SettingsScreenPreview()</ID>
<ID>WildcardImport:ConverterView.kt$import org.fossify.calculator.helpers.*</ID>
<ID>WildcardImport:ConverterView.kt$import org.fossify.commons.extensions.*</ID>
<ID>WildcardImport:MainActivity.kt$import org.fossify.calculator.helpers.*</ID>
<ID>WildcardImport:MainActivity.kt$import org.fossify.commons.extensions.*</ID>
<ID>WildcardImport:SettingsActivity.kt$import org.fossify.commons.helpers.*</ID>
<ID>WildcardImport:UnitTypesAdapter.kt$import org.fossify.commons.extensions.*</ID>
<ID>WildcardImport:WidgetConfigureActivity.kt$import org.fossify.commons.extensions.*</ID>
</CurrentIssues>
</SmellBaseline>
Loading

0 comments on commit 1c70f8b

Please sign in to comment.