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

V 0.5 #19

Closed
wants to merge 13 commits into from
Closed
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
18 changes: 0 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,10 @@ jobs:
java-version: '17'
distribution: 'temurin'

# - uses: actions/checkout@v2
# - name: Set up Java
# uses: actions/setup-java@v2
# with:
# java-version: '11'
# distribution: 'adopt'

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1

- name: Run Tests
uses: gradle/gradle-build-action@v2
with:
arguments: allTests

# - name: List Tests
# run: ls .;echo "---build";ls build/;echo "---test-results"; ls build/test-results/;echo "---jvmTest"; ls build/test-results/jvmTest/
#
# - name: Test Report
# uses: dorny/test-reporter@v1
# if: success() || failure()
# with:
# name: Unit Test Results
# path: build/test-results/**/*.xml
# reporter: java-junit
21 changes: 3 additions & 18 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,25 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1

- name: Decode
run: |
mkdir -p ~/.gradle
echo "${{secrets.OSSRH_SIGNING_SECRET_KEY_RING_FILE}}" > ~/.gradle/secring.gpg.b64
base64 -d ~/.gradle/secring.gpg.b64 > ~/.gradle/secring.gpg

# - name: Run Tests
# uses: gradle/gradle-build-action@v2
# env:
# NEXUS_HOST: ${{ secrets.OSSRH_HOST }}
# NEXUS_USER: ${{ secrets.OSSRH_USER }}
# NEXUS_PASS: ${{ secrets.OSSRH_PASS }}
# # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# arguments: --stacktrace deploy -Psigning.keyId=${{secrets.OSSRH_SIGNING_KEY_ID}} -Psigning.password='${{secrets.OSSRH_GPG_SECRET_KEY_PASSWORD}}' -Psigning.secretKeyRingFile=$(echo ~/.gradle/secring.gpg)
- name: Publish package
run: ./gradlew --stacktrace deploy -Psigning.keyId=${{secrets.OSSRH_SIGNING_KEY_ID}} -Psigning.password='${{secrets.OSSRH_GPG_SECRET_KEY_PASSWORD}}' -Psigning.secretKeyRingFile=$(echo ~/.gradle/secring.gpg)
env:
NEXUS_HOST: ${{ secrets.OSSRH_HOST }}
NEXUS_USER: ${{ secrets.OSSRH_USER }}
NEXUS_PASS: ${{ secrets.OSSRH_PASS }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Report unit tests
# uses: dorny/test-reporter@v1
# if: always()
# with:
# name: Gradle Tests
# path: '**/build/test-results/*/TEST-*.xml'
# reporter: java-junit
# fail-on-error: true
22 changes: 9 additions & 13 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
}

group = "com.crowdproj"
version = "0.5.6"
version = "0.5.7"

repositories {
mavenCentral()
Expand All @@ -31,13 +31,10 @@ kotlin {
jvm()
linuxX64()
linuxArm64()
// linuxArm32Hfp()
// linuxMips32()
// linuxMipsel32()
ios()
iosX64()
iosArm64()
iosSimulatorArm64()
// iosSimulatorArm64()
macosX64()
macosArm64()
tvos()
Expand All @@ -51,7 +48,6 @@ kotlin {
watchosX64()
// wasm()
// wasm32()
// mingwX86()
mingwX64()

sourceSets {
Expand Down Expand Up @@ -147,7 +143,10 @@ publishing {
artifact(javadocJar)
pom {
name.set("Kotlin CoR")
description.set("Chain of Responsibility Design Template Library for human readable business logic: $name platform")
description.set(
"Chain of Responsibility Design Template Library for human readable business " +
"logic: $name platform"
)
url.set("https://github.com/crowdproj/kotlin-cor")
licenses {
license {
Expand Down Expand Up @@ -180,9 +179,6 @@ tasks {
dependsOn(publish)
}

// this.forEach {
// println("${it.name} ${it::class}")
// }
withType<Test> {
useJUnitPlatform()
reports {
Expand All @@ -198,9 +194,7 @@ tasks {
create("deploy") {
group = "build"
dependsOn(publish)
// dependsOn(closeAndReleaseRepository)
}

}

fun Test.setupTestLogging() {
Expand All @@ -222,7 +216,9 @@ fun Test.setupTestLogging() {
override fun afterTest(testDescriptor: TestDescriptor, result: TestResult) {}
override fun afterSuite(suite: TestDescriptor, result: TestResult) {
if (suite.parent != null) { // will match the outermost suite
val output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)"
val output = "Results: ${result.resultType} (${result.testCount} tests, " +
"${result.successfulTestCount} passed, ${result.failedTestCount} failed, " +
"${result.skippedTestCount} skipped)"
val startItem = "| "
val endItem = " |"
val repeatLength = startItem.length + output.length + endItem.length
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
12 changes: 9 additions & 3 deletions src/commonTest/kotlin/subChain/SubChainSequentialTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import kotlinx.coroutines.flow.asFlow
import kotlinx.coroutines.test.runTest
import kotlinx.coroutines.withContext
import kotlin.test.Test
import kotlin.test.assertContains
import kotlin.test.assertEquals
import kotlin.time.ExperimentalTime
import kotlin.time.measureTime
Expand Down Expand Up @@ -45,13 +46,18 @@ class SubChainSequentialTest {

@Test
fun parallelData() = runTest {
val symbols = "0123456789"
withContext(Dispatchers.Default) {
val ctx = TestContext(text = "0123456789", some = 3)
val ctx = TestContext(text = symbols, some = 3)
val t = measureTime {
chain.exec(ctx)
}
println("TIME: $t")
assertEquals("9;8;7;6;5;4;3;2;1;0;", ctx.atomicText.value)
// In parallel mode the order is not guaranteed
symbols.forEach {
assertContains(ctx.atomicText.value, "$it;")
}

}
}

Expand Down Expand Up @@ -94,7 +100,7 @@ class SubChainSequentialTest {
text = ""
str.map { TestSubContext(str = it.toString(), parent = this) }.asFlow()
}
worker("") { val del = 1000 - str.toLong() * 100; println("$str $del"); delay(del); str += ";" }
worker("") { val del = 20 - str.toLong() * 2; println("$str $del"); delay(del); str += ";" }
worker("") { parent.atomicText.update { it + str } }
}
}.build()
Expand Down
Loading