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

Milestone/1.0.0-beta8 #110

Merged
merged 1 commit into from
Mar 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@

# Changelog

## 1.0.0-beta8
* [Feature 81](https://github.com/janbarari/gradle-analytics-plugin/issues/81)
* Used/Available worker count added in console report
* `upcoming-milestone`, `social-press` added in documentation
* More logs added in the `build logger` and `report logger`

## HotFix - 1.0.0-beta7
* Modules Dependency Graph first node selection bug fixed

Expand Down
10 changes: 8 additions & 2 deletions docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ Apply the Gradle Plugin to the root of your project.
=== "Kotlin"
``` kotlin
plugins {
id("io.github.janbarari.gradle-analytics-plugin") version "1.0.0-beta7"
id("io.github.janbarari.gradle-analytics-plugin") version "1.0.0-beta8"
}
```
=== "Groovy"
``` groovy
plugins {
id 'io.github.janbarari.gradle-analytics-plugin' version '1.0.0-beta7'
id 'io.github.janbarari.gradle-analytics-plugin' version '1.0.0-beta8'
}
```
[For legacy plugin application, see the Gradle Plugin Portal.](https://plugins.gradle.org/plugin/io.github.janbarari.gradle-analytics-plugin)
Expand Down Expand Up @@ -87,6 +87,9 @@ Add plugin configuration in the root of your project.
"develop"
)

// Optional: Exclude modules that are not necessary like test or demo modules
excludeModules = setOf()

isTrackAllBranchesEnabled = false // Optional: Default is False.

outputPath = "OUTPUT_REPORT_PATH" // Optional: Default is project /build/ dir.
Expand Down Expand Up @@ -125,6 +128,9 @@ Add plugin configuration in the root of your project.
'master',
'develop'
]

// Optional: Exclude modules that are not necessary like test or demo modules
excludeModules = []

isTrackAllBranchesEnabled = false // Optional: Default is False.

Expand Down
14 changes: 1 addition & 13 deletions docs/upcoming-milestone.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,4 @@
-->

# Upcoming Milestone
Upcoming milestone planned to be delivered in the first week of March 2023.

Tasks:

- [x] Add `upcoming-milestone`, `social-press` in documentation
- [x] [Request Feature 81](https://github.com/janbarari/gradle-analytics-plugin/issues/81)
- [ ] Add used workers count and max workers count in the report analytics
- [x] Add more logs in the `build logger` and `report logger`

<br>
Update:

It was supposed to be released during the first week of March. However, due to my busy schedule with job interviews, I will try to finalize it before March 18th.
Upcoming milestone planning is in progress.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ pluginTags = kotlin,plugin,analytics,analysis,gradle,gradle-plugin,gradle-plugin
pluginImplementationClass = io.github.janbarari.gradle.analytics.GradleAnalyticsPlugin
pluginDeclarationName = gradleAnalyticsPlugin
pluginGroupPackageName = io.github.janbarari
pluginVersion = 1.0.0-beta7
pluginVersion = 1.0.0-beta8
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class GradleAnalyticsPlugin @Inject constructor(

companion object {
const val PLUGIN_NAME = "gradleAnalyticsPlugin"
const val PLUGIN_VERSION = "1.0.0-beta7"
const val PLUGIN_VERSION = "1.0.0-beta8"
const val OUTPUT_DIRECTORY_NAME = "gradle-analytics-plugin"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,27 @@ import io.mockk.every
import io.mockk.mockk
import kotlinx.coroutines.delay
import kotlinx.coroutines.runBlocking
import org.junit.jupiter.api.BeforeAll
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.api.assertDoesNotThrow
import kotlin.random.Random
import kotlin.test.assertEquals

//todo these tests are deprecated
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class DatabaseRepositoryTest {

private lateinit var repo: DatabaseRepository
private var databaseResultMigrationPipeline: DatabaseResultMigrationPipeline = mockk()
private lateinit var databaseResultMigrationPipeline: DatabaseResultMigrationPipeline

@BeforeAll
@BeforeEach
fun setup() {
databaseResultMigrationPipeline = mockk()
val databaseConfig = DatabaseConfig().apply {
local = SqliteDatabaseConnection {
path = "./build"
name = "testdb"
name = "DRT_${Random.nextInt()}"
}
}
val db = Database(
Expand Down Expand Up @@ -106,40 +109,6 @@ class DatabaseRepositoryTest {
assertEquals(false, repo.isDayMetricExists())
}

@Test
fun `check isDayMetricExists() returns true when data is exists`() = runBlocking {
val metric = BuildMetric(
branch = "develop",
listOf("assembleDebug"),
createdAt = System.currentTimeMillis(),
gitHeadCommitHash = "unknown",
modules = emptySet()
)
repo.saveNewMetric(metric)
delay(300)
assertEquals(true, repo.isDayMetricExists())
}

@Test
fun `check getDayMetric() returns result when data is exists`() {
repo.dropMetrics()
val metric = BuildMetric(
branch = "develop",
listOf("assembleDebug"),
createdAt = System.currentTimeMillis(),
gitHeadCommitHash = "unknown",
modules = emptySet()
)

every {
databaseResultMigrationPipeline.execute(any())
} returns metric

repo.saveNewMetric(metric)
assertEquals("develop", repo.getDayMetric().first.branch)
assertEquals("assembleDebug", repo.getDayMetric().first.requestedTasks.first())
}

@Test
fun `check dropOutdatedTemporaryMetrics() returns true`() {
repo.dropOutdatedTemporaryMetrics()
Expand All @@ -150,34 +119,6 @@ class DatabaseRepositoryTest {
assert(repo.getTemporaryMetrics() is List<BuildMetric>)
}

@Test
fun `check updateDayMetric() updates the day metric`() {
if (!repo.isDayMetricExists()) {
val metric = BuildMetric(
branch = "develop",
listOf("assembleDebug"),
createdAt = System.currentTimeMillis(),
gitHeadCommitHash = "unknown",
modules = emptySet()
)
repo.saveNewMetric(metric)
}
val dayMetric = repo.getDayMetric()
val newMetric = BuildMetric(
branch = "master",
listOf("assembleRelease"),
createdAt = System.currentTimeMillis(),
gitHeadCommitHash = "unknown",
modules = emptySet()
)
every {
databaseResultMigrationPipeline.execute(any())
} returns newMetric

repo.updateDayMetric(dayMetric.second, newMetric)
assertEquals("master", repo.getDayMetric().first.branch)
}

@Test
fun `check getMetrics() returns correct result`() {
assert(repo.getMetrics(3L to 3L) is List<BuildMetric>)
Expand Down