Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New branch #399

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 95 additions & 5 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@ on:
branches: [ main ]

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
- name: Check out code
uses: actions/checkout@v4
with:
Expand All @@ -30,7 +26,19 @@ jobs:
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Run app Checks
- name: Run test without shared tests
run: ./gradlew test -Pshared-tests-are-android-tests=false

# - name: Run test with shared tests
# run: ./gradlew test -Pshared-tests-are-android-tests=true

- name: Run test without shared tests
run: ./gradlew assembleAndroidTest -Pshared-tests-are-android-tests=false

# - name: Run test with shared tests
# run: ./gradlew assembleAndroidTest -Pshared-tests-are-android-tests=true

- name: Run check
run: ./gradlew check

- name: Run core Checks
Expand All @@ -55,3 +63,85 @@ jobs:
name: Reports
path: '**/build/reports/*'
retention-days: 2

check-libraries:
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: '0'

- name: Check out java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Run core Checks
run: ./gradlew :toggles-core:check

- name: Run flow Checks
run: ./gradlew :toggles-flow:check

- name: Run flow noop Checks
run: ./gradlew :toggles-flow-noop:check

- name: Run prefs Checks
run: ./gradlew :toggles-prefs:check

- name: Run prefs noop Checks
run: ./gradlew :toggles-prefs-noop:check

- name: Upload reports
uses: actions/upload-artifact@v4
if: failure()
with:
name: Reports
path: '**/build/reports/*'
retention-days: 2

emulator-tests:
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: '0'

- name: Check out java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm

- name: run tests
run: ./gradlew :toggles-app:pixel2api30DebugAndroidTest

- name: "Upload reports"
uses: actions/upload-artifact@v4
if: failure()
with:
name: "Android test results"
path: '**/build/reports/*'
retention-days: 2
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,6 @@ captures/

**/release/*.*

build-cache
build-cache

.kotlin
6 changes: 4 additions & 2 deletions build-logic/conventions/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ java {

dependencies {
// implementation("gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.7.2")
implementation("se.premex:ownership-gradle-plugin:0.0.11")
implementation(libs.se.premex.ownership.gradle.plugin)
implementation(libs.io.gitlab.arturbosch.detekt.detekt.gradle.plugin)
implementation(libs.com.android.tools.build.gradle)
implementation(libs.org.jetbrains.kotlin.kotlin.gradle.plugin)
implementation("com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:1.9.10-1.0.13")
implementation(libs.com.google.devtools.ksp.com.google.devtools.ksp.gradle.plugin)
implementation(libs.com.squareup.kotlinpoet)
implementation(libs.org.jetbrains.kotlin.compose.compiler.gradle.plugin)

// https://github.com/gradle/gradle/issues/15383
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
Expand Down
13 changes: 10 additions & 3 deletions build-logic/conventions/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rootProject.name="conventions"
rootProject.name = "conventions"

pluginManagement {
repositories {
Expand All @@ -23,6 +23,13 @@ dependencyResolutionManagement {
}

plugins {
id("com.gradle.enterprise") version "3.16.1"
id("org.gradle.toolchains.foojay-resolver-convention") version("0.7.0")
id("com.gradle.develocity") version "3.18"
id("org.gradle.toolchains.foojay-resolver-convention") version ("0.8.0")
}

develocity {
buildScan {
termsOfUseUrl.set("https://gradle.com/help/legal-terms-of-use")
termsOfUseAgree.set("yes")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,70 @@ plugins {
kotlin("android")
id("kotlin-android")
id("toggles.detekt-conventions")
id("org.jetbrains.kotlin.plugin.compose")
}

android {
compileSdk = 34
compileSdk = 35

defaultConfig {
minSdk = 21
targetSdk = 34
targetSdk = 35

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

buildFeatures {
compose = true
}

composeOptions {
kotlinCompilerExtensionVersion = libs.versions.androidx.compose.compiler.get()
}

@Suppress("UnstableApiUsage")
testOptions {
unitTests.isIncludeAndroidResources = true
}

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

testOptions {
animationsDisabled = true
execution = "ANDROIDX_TEST_ORCHESTRATOR"
unitTests {
isReturnDefaultValues = true
isIncludeAndroidResources = true
}
managedDevices {
devices {
maybeCreate<com.android.build.api.dsl.ManagedVirtualDevice>("pixel2api30").apply {
// Use device profiles you typically see in Android Studio.
device = "Pixel 2"
// Use only API levels 30 and higher.
apiLevel = 30
// To include Google services, use "google".
systemImageSource = "aosp"
}
}
}
}

sourceSets {
// val sharedTestDir = "src/sharedTest/"
// if(project.file(sharedTestDir).exists()) {
// val sharedTestSourceDir = sharedTestDir + "java"
// val sharedTestResourceDir = sharedTestDir + "resources"
// val sharedIsAndroid =
// providers.gradleProperty("shared-tests-are-android-tests").get().toBoolean()
// if (sharedIsAndroid) {
// logger.lifecycle("Shared tests are androidTests")
// named("androidTest") {
// java.srcDir(sharedTestSourceDir)
// resources.srcDir(sharedTestResourceDir)
// }
// } else {
// logger.lifecycle("Shared tests are unitTests")
// named("test") {
// java.srcDir(sharedTestSourceDir)
// resources.srcDir(sharedTestResourceDir)
// }
// }
// }
}
}

kotlin {
Expand All @@ -51,4 +83,13 @@ kotlin {

dependencies {
lintChecks(libs.com.slack.lint.compose.compose.lint.checks)

testImplementation(libs.androidx.test.ext.junit)
testImplementation(libs.org.robolectric)
testImplementation(libs.androidx.test.runner)

androidTestImplementation(libs.androidx.test.ext.junit)
androidTestImplementation(libs.androidx.test.runner)

androidTestUtil(libs.androidx.test.orchestrator)
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@

plugins {
id("com.android.library")
kotlin("android")
id("io.gitlab.arturbosch.detekt")
id("toggles.detekt-library-conventions")

}

android {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,50 @@ android {
warningsAsErrors = true
lintConfig = File("../../lint.xml")
}

testOptions {
animationsDisabled = true
execution = "ANDROIDX_TEST_ORCHESTRATOR"
unitTests {
isReturnDefaultValues = true
isIncludeAndroidResources = true
}
managedDevices {
devices {
maybeCreate<com.android.build.api.dsl.ManagedVirtualDevice>("pixel2api30").apply {
// Use device profiles you typically see in Android Studio.
device = "Pixel 2"
// Use only API levels 30 and higher.
apiLevel = 30
// To include Google services, use "google".
systemImageSource = "aosp"
}
}
}
}

sourceSets {
// val sharedTestDir = "src/sharedTest/"
// if(project.file(sharedTestDir).exists()) {
// val sharedTestSourceDir = sharedTestDir + "java"
// val sharedTestResourceDir = sharedTestDir + "resources"
// val sharedIsAndroid =
// providers.gradleProperty("shared-tests-are-android-tests").get().toBoolean()
// if (sharedIsAndroid) {
// logger.lifecycle("Shared tests are androidTests")
// named("androidTest") {
// java.srcDir(sharedTestSourceDir)
// resources.srcDir(sharedTestResourceDir)
// }
// } else {
// logger.lifecycle("Shared tests are unitTests")
// named("test") {
// java.srcDir(sharedTestSourceDir)
// resources.srcDir(sharedTestResourceDir)
// }
// }
// }
}
}

kotlin {
Expand All @@ -35,4 +79,13 @@ kotlin {

dependencies {
lintChecks(libs.com.slack.lint.compose.compose.lint.checks)

testImplementation(libs.androidx.test.ext.junit)
testImplementation(libs.org.robolectric)
testImplementation(libs.androidx.test.runner)

androidTestImplementation(libs.androidx.test.ext.junit)
androidTestImplementation(libs.androidx.test.runner)

androidTestUtil(libs.androidx.test.orchestrator)
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

dependencies {
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.22.0")
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.6")
}

detekt {
Expand Down
17 changes: 16 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ buildscript {
}
}

versionCatalogUpdate {
keep {
keepUnusedVersions = true
keepUnusedLibraries = true
keepUnusedPlugins = true
}
}

plugins {
alias(libs.plugins.com.github.ben.manes.versions)
alias(libs.plugins.nl.littlerobots.version.catalog.update)
Expand All @@ -28,6 +36,13 @@ plugins {
alias(libs.plugins.com.autonomousapps.dependency.analysis)
}

develocity {
buildScan {
termsOfUseUrl.set("https://gradle.com/help/legal-terms-of-use")
termsOfUseAgree.set("yes")
}
}

fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any {
version.uppercase(Locale.getDefault()).contains(it)
Expand All @@ -44,5 +59,5 @@ tasks.named("dependencyUpdates", DependencyUpdatesTask::class.java).configure {
}

task<Delete>("clean") {
delete(rootProject.buildDir)
delete(rootProject.layout.buildDirectory)
}
Loading
Loading