From 22e6657e794dfec38de91679e159f44188dbcde2 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Thu, 10 Mar 2022 22:25:17 +0700 Subject: [PATCH 1/4] Write GitHub Actions scripts --- .github/workflows/build.yml | 30 ++++++++++++++++++++++++ .github/workflows/publish.yml | 28 +++++++++++++++------- gradle.properties | 1 + gradle/wrapper/gradle-wrapper.properties | 2 +- 4 files changed, 52 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 gradle.properties diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..943d0ac --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,30 @@ +name: Gradle build + +on: + push: + branches: [ dev, master ] + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 40 + + steps: + - uses: actions/checkout@v2 + - uses: DeLaGuardo/setup-graalvm@5.0 + with: + graalvm: 22.0.0.2 + java: java11 + arch: amd64 + - uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }} + restore-keys: | + ${{ runner.os }}-gradle- + - uses: gradle/wrapper-validation-action@v1.0.4 + - name: Build + run: ./gradlew build --build-cache --no-daemon --stacktrace diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 74a385e..fb3d188 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,14 +8,26 @@ on: jobs: build: runs-on: ubuntu-latest + timeout-minutes: 40 steps: - uses: actions/checkout@v2 - - - name: Run a one-line script - run: echo Hello, world! - - - name: Run a multi-line script - run: | - echo Add other actions to build, - echo test, and deploy your project. + - uses: DeLaGuardo/setup-graalvm@5.0 + with: + graalvm: 22.0.0.2 + java: java11 + arch: amd64 + - uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }} + restore-keys: | + ${{ runner.os }}-gradle- + - uses: gradle/wrapper-validation-action@v1.0.4 + - name: Publish artifacts + run: > + ./gradlew publishAllPublicationsToSpaceRepository --no-daemon --build-cache + -Ppublishing.space.user=${{ secrets.SPACE_APP_ID }} + -Ppublishing.space.token=${{ secrets.SPACE_APP_SECRET }} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..7fc6f1f --- /dev/null +++ b/gradle.properties @@ -0,0 +1 @@ +kotlin.code.style=official diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 41dfb87..00e33ed 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From e1a11452d2d9e266e28e4e8fc81b05f19bbf361e Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 15 Mar 2022 13:03:32 +0300 Subject: [PATCH 2/4] Update release task generation --- .../mipt/npm/gradle/KScienceProjectPlugin.kt | 69 ++++++++++--------- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt index f48f6d0..22f7ec6 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt @@ -166,39 +166,9 @@ public open class KScienceProjectPlugin : Plugin { } } - tasks.withType { - dependsOn(generateReadme) - } - } - - val releaseAll by tasks.creating { - group = RELEASE_GROUP - description = "Publish development or production release based on version suffix" - } - - allprojects { - afterEvaluate { - ksciencePublish.repositoryNames.forEach { repositoryName -> - val repositoryNameCapitalized = repositoryName.capitalize() - - tasks.withType() - .filter { it.name.startsWith("publish") && it.name.endsWith("To${repositoryNameCapitalized}Repository") } - .forEach { - val theName = "release${ - it.name.removePrefix("publish").removeSuffix("To${repositoryNameCapitalized}Repository") - }" - - val targetReleaseTask = tasks.findByName(theName) ?: tasks.create(theName) { - group = RELEASE_GROUP - description = "Publish platform release artifact" - } - - releaseAll.dependsOn(targetReleaseTask) - - targetReleaseTask.dependsOn(it) - } - } - } +// tasks.withType { +// dependsOn(generateReadme) +// } } val generateReadme by tasks.creating { @@ -264,6 +234,39 @@ public open class KScienceProjectPlugin : Plugin { dependsOn(generateReadme) } + + val releaseAll by tasks.creating { + group = RELEASE_GROUP + description = "Publish development or production release based on version suffix" + dependsOn(generateReadme) + } + + allprojects { + afterEvaluate { + ksciencePublish.repositoryNames.forEach { repositoryName -> + val repositoryNameCapitalized = repositoryName.capitalize() + + val pattern = "publish(?.*)PublicationTo${repositoryNameCapitalized}Repository" + .toRegex() + + tasks.withType().toList().forEach forEachPublication@ { + val matchResult = pattern.matchEntire(it.name) ?: return@forEachPublication + val publicationName = matchResult.groups["publication"]!!.value.capitalize() + val releaseTaskName = "release$publicationName" + + val targetReleaseTask = rootProject.tasks.findByName(releaseTaskName) ?: rootProject.tasks.create(releaseTaskName) { + group = RELEASE_GROUP + description = "Publish platform release artifact for $publicationName to all repositories" + } + + releaseAll.dependsOn(targetReleaseTask) + + targetReleaseTask.dependsOn(it) + } + } + } + } + // Disable API validation for snapshots if (isSnapshot()) { extensions.findByType()?.apply { From b150fd5fd3d92f942b68fe5795485cb8dadedf41 Mon Sep 17 00:00:00 2001 From: Iaroslav Postovalov Date: Wed, 16 Mar 2022 02:31:44 +0700 Subject: [PATCH 3/4] Use standard workflow actions for Java, Gradle --- .github/workflows/build.yml | 19 +++++-------------- .github/workflows/publish.yml | 21 ++++++--------------- 2 files changed, 11 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 943d0ac..5347757 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,19 +12,10 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: DeLaGuardo/setup-graalvm@5.0 + - uses: actions/setup-java@v2.5.0 with: - graalvm: 22.0.0.2 - java: java11 - arch: amd64 - - uses: actions/cache@v2 + java-version: 11 + distribution: liberica + - uses: gradle/gradle-build-action@v2 with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }} - restore-keys: | - ${{ runner.os }}-gradle- - - uses: gradle/wrapper-validation-action@v1.0.4 - - name: Build - run: ./gradlew build --build-cache --no-daemon --stacktrace + arguments: build diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index fb3d188..0576154 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,22 +12,13 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: DeLaGuardo/setup-graalvm@5.0 + - uses: actions/setup-java@v2.5.0 with: - graalvm: 22.0.0.2 - java: java11 - arch: amd64 - - uses: actions/cache@v2 + java-version: 11 + distribution: liberica + - uses: gradle/gradle-build-action@v2 with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }} - restore-keys: | - ${{ runner.os }}-gradle- - - uses: gradle/wrapper-validation-action@v1.0.4 - - name: Publish artifacts - run: > - ./gradlew publishAllPublicationsToSpaceRepository --no-daemon --build-cache + arguments: | + publishAllPublicationsToSpaceRepository -Ppublishing.space.user=${{ secrets.SPACE_APP_ID }} -Ppublishing.space.token=${{ secrets.SPACE_APP_SECRET }} From 027a00a486b4291754a7b91647e998e4ab7230d9 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 10 Apr 2022 10:48:02 +0300 Subject: [PATCH 4/4] 0.11.3 --- CHANGELOG.md | 5 +++++ gradle/libs.versions.toml | 12 ++++++------ .../ru/mipt/npm/gradle/commonConfigurations.kt | 5 ++++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b97937..8c45f7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added +- Coroutine tests as default dependency for tests +- Context receiver flag ### Changed - Separate release tasks for each target +- Kotlin 1.6.20 +- Context receivers enabled +- Ktor 2.0 ### Deprecated diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e54f996..98a51c7 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,22 +1,22 @@ [versions] -tools = "0.11.2-kotlin-1.6.10" -kotlin = "1.6.10" +tools = "0.11.3-kotlin-1.6.20" +kotlin = "1.6.20" atomicfu = "0.17.1" binary-compatibility-validator = "0.8.0" changelog = "1.3.1" dokka = "1.6.10" -kotlin-jupyter = "0.11.0-62" +kotlin-jupyter = "0.11.0-71" kotlinx-benchmark = "0.4.2" kotlinx-cli = "0.3.4" kotlinx-collections-immutable = "0.3.5" -kotlinx-coroutines = "1.6.0" +kotlinx-coroutines = "1.6.1" kotlinx-datetime = "0.3.2" kotlinx-html = "0.7.3" kotlinx-knit = "0.3.0" kotlinx-nodejs = "0.0.7" kotlinx-serialization = "1.3.2" -ktor = "1.6.7" -xmlutil = "0.84.0" +ktor = "2.0.0" +xmlutil = "0.84.1" yamlkt = "0.10.2" jsBom = "0.0.1-pre.313-kotlin-1.6.10" junit = "5.8.2" diff --git a/src/main/kotlin/ru/mipt/npm/gradle/commonConfigurations.kt b/src/main/kotlin/ru/mipt/npm/gradle/commonConfigurations.kt index de1b304..433e462 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/commonConfigurations.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/commonConfigurations.kt @@ -15,7 +15,7 @@ import ru.mipt.npm.gradle.internal.applySettings import ru.mipt.npm.gradle.internal.fromJsDependencies -private val defaultJvmArgs: List = listOf("-Xjvm-default=all", "-Xlambdas=indy") +private val defaultJvmArgs: List = listOf("-Xjvm-default=all", "-Xlambdas=indy", "-Xcontext-receivers") public fun Project.configureKScience( kotlinVersion: KotlinVersion @@ -38,6 +38,7 @@ public fun Project.configureKScience( dependencies { implementation(kotlin("test-junit5")) implementation("org.junit.jupiter:junit-jupiter:${KScienceVersions.junit}") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${KScienceVersions.coroutinesVersion}") } } } @@ -83,6 +84,7 @@ public fun Project.configureKScience( sourceSets["test"].apply { dependencies { implementation(kotlin("test-js")) + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${KScienceVersions.coroutinesVersion}") } } } @@ -124,6 +126,7 @@ public fun Project.configureKScience( dependencies { implementation(kotlin("test-common")) implementation(kotlin("test-annotations-common")) + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${KScienceVersions.coroutinesVersion}") } } val jvmMain by getting