diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yml similarity index 69% rename from .github/workflows/build.yaml rename to .github/workflows/build.yml index f1870eb9f..7334f99ef 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yml @@ -15,21 +15,23 @@ jobs: name: "Build JDK 1.8" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.4 + - uses: actions/checkout@v2 - name: Set up JDK 1.8 - uses: actions/setup-java@v1 + uses: actions/setup-java@v2 with: - java-version: 1.8 + distribution: 'zulu' + java-version: 8.0.x - name: Build with Gradle run: ./gradlew build build_11: name: "Build JDK 11" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.4 + - uses: actions/checkout@v2 - name: Set up JDK 11 - uses: actions/setup-java@v1 + uses: actions/setup-java@v2 with: + distribution: 'zulu' java-version: 11.0.x - name: Build with Gradle run: ./gradlew build diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 000000000..f1e628065 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,34 @@ +name: Publish + +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 1.8 + uses: actions/setup-java@v2 + with: + distribution: 'zulu' + java-version: 8.0.x + - name: Set up GPG + run: echo -n "${GPG_PRIVATE_KEY}" | base64 --decode > ${GITHUB_WORKSPACE}/${GPG_KEY_ID}.gpg + env: + GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + - name: "Gradle Build" + run: ./gradlew build -Pversion=${GITHUB_REF:10} + - name: "Gradle Publish" + run: | + ./gradlew publishToSonatype -Pversion=${GITHUB_REF:10} \ + -Psigning.keyId=${GPG_KEY_ID} \ + -Psigning.password=${GPG_PASSPHRASE} \ + -Psigning.secretKeyRingFile=${GITHUB_WORKSPACE}/${GPG_KEY_ID}.gpg + env: + ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }} + ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_PASSWORD }} + GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index 1df69505c..000000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,22 +0,0 @@ -name: Release - -on: - release: - types: [published] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2.3.4 - - name: Set up JDK - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: "Gradle Build" - run: ./gradlew build -Pversion=${GITHUB_REF:10} - - name: "Gradle Publish to Bintray" - env: - BINTRAY_USER: ${{ secrets.BINTRAY_USER }} - BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }} - run: ./gradlew bintrayUpload -Pversion=${GITHUB_REF:10} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..47a3ff206 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,55 @@ +name: Release + +on: + workflow_dispatch: + inputs: + releaseVersion: + description: "The release version in .. format" + required: true + nextVersion: + description: "The next version in . format WITHOUT SNAPSHOT SUFFIX" + required: true + +jobs: + triage: + runs-on: ubuntu-latest + steps: + - name: "Check release version" + run: | + expr "${{ github.event.inputs.releaseVersion }}" : '[[:digit:]][[:digit:]]*\.[[:digit:]][[:digit:]]*\.[[:digit:]][[:digit:]]*$' + + - name: "Check next version" + run: | + expr "${{ github.event.inputs.nextVersion }}" : '[[:digit:]][[:digit:]]*\.[[:digit:]][[:digit:]]*$' + + - uses: actions/checkout@v2.3.4 + with: + token: ${{ secrets.QAMETA_CI }} + + - name: "Configure CI Git User" + run: | + git config --global user.name qameta-ci + git config --global user.email qameta-ci@qameta.io + + - name: "Set release version in gradle.properties file" + run: | + sed -i -e '/version=/s/.*/version=${{ github.event.inputs.releaseVersion }}/g' gradle.properties + cat gradle.properties + + - name: "Commit release version and create tag" + run: | + git commit -am "release ${{ github.event.inputs.releaseVersion }}" + git tag ${{ github.event.inputs.releaseVersion }} + git push origin ${{ github.event.inputs.releaseVersion }} + + - name: "Set next development version in gradle.properties file" + run: | + sed -i -e '/version=/s/.*/version=${{ github.event.inputs.nextVersion }}-SNAPSHOT/g' gradle.properties + cat gradle.properties + + - name: "Commit next development version and push it" + run: | + git commit -am "set next development version ${{ github.event.inputs.releaseVersion }}" + git push origin master + + diff --git a/allure-junit-platform/build.gradle.kts b/allure-junit-platform/build.gradle.kts index a4b970826..417709e6b 100644 --- a/allure-junit-platform/build.gradle.kts +++ b/allure-junit-platform/build.gradle.kts @@ -40,14 +40,15 @@ tasks.test { } } -val spiOffJar by tasks.creating(Jar::class) { +val spiOffJar: Jar by tasks.creating(Jar::class) { from(sourceSets.getByName("main").output) - classifier = "spi-off" + archiveClassifier.set("spi-off") } -val spiOff by configurations.creating { - extendsFrom(configurations.getByName("compile")) +publishing { + publications { + named("maven") { + artifact(spiOffJar) + } + } } - -artifacts.add("archives", spiOffJar) -artifacts.add("spiOff", spiOffJar) diff --git a/allure-junit-platform/src/main/java/io/qameta/allure/junitplatform/AllurePostDiscoveryFilter.java b/allure-junit-platform/src/main/java/io/qameta/allure/junitplatform/AllurePostDiscoveryFilter.java index e43a76230..c66e592de 100644 --- a/allure-junit-platform/src/main/java/io/qameta/allure/junitplatform/AllurePostDiscoveryFilter.java +++ b/allure-junit-platform/src/main/java/io/qameta/allure/junitplatform/AllurePostDiscoveryFilter.java @@ -56,7 +56,7 @@ public FilterResult apply(final TestDescriptor object) { if (Objects.isNull(testPlan)) { return FilterResult.included("test plan is empty"); } - if (!object.isTest()) { + if (!object.getChildren().isEmpty()) { return FilterResult.included("filter only applied for tests"); } diff --git a/allure-junit-platform/src/test/java/io/qameta/allure/junitplatform/AllureJunitPlatformTestUtils.java b/allure-junit-platform/src/test/java/io/qameta/allure/junitplatform/AllureJunitPlatformTestUtils.java index b8d76cd08..b26897f22 100644 --- a/allure-junit-platform/src/test/java/io/qameta/allure/junitplatform/AllureJunitPlatformTestUtils.java +++ b/allure-junit-platform/src/test/java/io/qameta/allure/junitplatform/AllureJunitPlatformTestUtils.java @@ -22,11 +22,11 @@ import io.qameta.allure.aspects.StepsAspects; import io.qameta.allure.test.AllureResults; import io.qameta.allure.test.AllureResultsWriterStub; +import io.qameta.allure.testfilter.TestPlan; import org.junit.platform.engine.discovery.ClassSelector; import org.junit.platform.engine.discovery.DiscoverySelectors; import org.junit.platform.launcher.Launcher; import org.junit.platform.launcher.LauncherDiscoveryRequest; -import org.junit.platform.launcher.TestPlan; import org.junit.platform.launcher.core.LauncherConfig; import org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder; import org.junit.platform.launcher.core.LauncherFactory; @@ -44,6 +44,11 @@ private AllureJunitPlatformTestUtils() { @Step("Run classes {classes}") public static AllureResults runClasses(final Class... classes) { + return runClasses(null, classes); + } + + @Step("Run classes {classes}") + public static AllureResults runClasses(final TestPlan testPlan, final Class... classes) { final AllureResultsWriterStub writerStub = new AllureResultsWriterStub(); final AllureLifecycle lifecycle = new AllureLifecycle(writerStub); @@ -52,6 +57,7 @@ public static AllureResults runClasses(final Class... classes) { .toArray(ClassSelector[]::new); final LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request() + .filters(new AllurePostDiscoveryFilter(testPlan)) .selectors(classSelectors) .build(); @@ -77,8 +83,9 @@ public static AllureResults runClasses(final Class... classes) { } @Step("Build test plan for {classes}") - public static TestPlan buildPlan(final io.qameta.allure.testfilter.TestPlan testPlan, - final Class... classes) { + public static org.junit.platform.launcher.TestPlan buildPlan( + final io.qameta.allure.testfilter.TestPlan testPlan, + final Class... classes) { final ClassSelector[] classSelectors = Stream.of(classes) .map(DiscoverySelectors::selectClass) .toArray(ClassSelector[]::new); diff --git a/allure-junit-platform/src/test/java/io/qameta/allure/junitplatform/AllurePostDiscoveryFilterTest.java b/allure-junit-platform/src/test/java/io/qameta/allure/junitplatform/AllurePostDiscoveryFilterTest.java index e03a1ec0b..2f7dfc144 100644 --- a/allure-junit-platform/src/test/java/io/qameta/allure/junitplatform/AllurePostDiscoveryFilterTest.java +++ b/allure-junit-platform/src/test/java/io/qameta/allure/junitplatform/AllurePostDiscoveryFilterTest.java @@ -15,16 +15,16 @@ */ package io.qameta.allure.junitplatform; -import io.qameta.allure.junitplatform.features.PassedTests; -import io.qameta.allure.junitplatform.features.TestsWithAllureId; +import io.qameta.allure.junitplatform.features.FilterParameterizedTests; +import io.qameta.allure.junitplatform.features.FilterSimpleTests; +import io.qameta.allure.test.AllureResults; +import io.qameta.allure.testfilter.TestPlan; import io.qameta.allure.testfilter.TestPlanV1_0; import org.junit.jupiter.api.Test; -import org.junit.platform.launcher.TestIdentifier; -import org.junit.platform.launcher.TestPlan; import java.util.Arrays; -import static io.qameta.allure.junitplatform.AllureJunitPlatformTestUtils.buildPlan; +import static io.qameta.allure.junitplatform.AllureJunitPlatformTestUtils.runClasses; import static org.assertj.core.api.Assertions.assertThat; /** @@ -34,79 +34,113 @@ public class AllurePostDiscoveryFilterTest { @Test void shouldRunAllTestsIfNoTestPlanProvided() { - final TestPlan testPlan = buildPlan(null, PassedTests.class); + final AllureResults results = runClasses(FilterSimpleTests.class); - final long testsCount = testPlan.countTestIdentifiers(TestIdentifier::isTest); + assertThat(results.getTestResults()) + .hasSize(3); + } + + @Test + void shouldRunAllParameterizedTestsIfNoTestPlanProvided() { + final AllureResults results = runClasses(FilterParameterizedTests.class); - assertThat(testsCount) - .isEqualTo(3); + assertThat(results.getTestResults()) + .hasSize(6); } @Test void shouldRunAllTestsIfEmptyTestPlanProvided() { - final TestPlan testPlan = buildPlan(new TestPlanV1_0(), PassedTests.class); - - final long testsCount = testPlan.countTestIdentifiers(TestIdentifier::isTest); + final AllureResults results = runClasses(new TestPlanV1_0(), FilterSimpleTests.class); + assertThat(results.getTestResults()) + .hasSize(3); + } - assertThat(testsCount) - .isEqualTo(3); + @Test + void shouldRunAllParameterizedTestsIfEmptyTestPlanProvided() { + final AllureResults results = runClasses(new TestPlanV1_0(), FilterParameterizedTests.class); + assertThat(results.getTestResults()) + .hasSize(6); } @Test void shouldFilterTestCasesByFullName() { - final TestPlan testPlan = buildPlan( - new TestPlanV1_0().setTests(Arrays.asList( - new TestPlanV1_0.TestCase() - .setSelector("io.qameta.allure.junitplatform.features.PassedTests.second"), - new TestPlanV1_0.TestCase() - .setSelector("io.qameta.allure.junitplatform.features.PassedTests.first") - )), - PassedTests.class + final TestPlan testPlan = new TestPlanV1_0().setTests(Arrays.asList( + new TestPlanV1_0.TestCase() + .setSelector(String.format("%s.second", FilterSimpleTests.class.getCanonicalName())), + new TestPlanV1_0.TestCase() + .setSelector(String.format("%s.first", FilterSimpleTests.class.getCanonicalName()))) ); - final long testsCount = testPlan.countTestIdentifiers(TestIdentifier::isTest); + final AllureResults results = runClasses(testPlan, FilterSimpleTests.class); + assertThat(results.getTestResults()) + .hasSize(2); + } - assertThat(testsCount) - .isEqualTo(2); + @Test + void shouldFilterParameterizedTestCasesByFullName() { + final TestPlan testPlan = new TestPlanV1_0().setTests(Arrays.asList( + new TestPlanV1_0.TestCase() + .setSelector(String.format("%s.second", FilterParameterizedTests.class.getCanonicalName())), + new TestPlanV1_0.TestCase() + .setSelector(String.format("%s.first", FilterParameterizedTests.class.getCanonicalName())) + )); + + final AllureResults results = runClasses(testPlan, FilterParameterizedTests.class); + assertThat(results.getTestResults()) + .hasSize(4); } @Test void shouldFilterTestCasesByUniqueId() { - final TestPlan testPlan = buildPlan( - new TestPlanV1_0().setTests(Arrays.asList( - new TestPlanV1_0.TestCase() - .setSelector("[engine:junit-jupiter]/[class:io.qameta.allure.junitplatform.features.PassedTests]/[method:second()]"), - new TestPlanV1_0.TestCase() - .setSelector("[engine:junit-jupiter]/[class:io.qameta.allure.junitplatform.features.PassedTests]/[method:third()]") - )), - PassedTests.class - ); - - final long testsCount = testPlan.countTestIdentifiers(TestIdentifier::isTest); - - assertThat(testsCount) - .isEqualTo(2); + final TestPlan testPlan = new TestPlanV1_0().setTests(Arrays.asList( + new TestPlanV1_0.TestCase() + .setSelector(testId(FilterSimpleTests.class, "first")), + new TestPlanV1_0.TestCase() + .setSelector(testId(FilterSimpleTests.class, "third")) + )); + + final AllureResults results = runClasses(testPlan, FilterSimpleTests.class); + assertThat(results.getTestResults()) + .hasSize(2); } @Test void shouldFilterTestCasesByAllureId() { - final TestPlan testPlan = buildPlan( - new TestPlanV1_0().setTests(Arrays.asList( - new TestPlanV1_0.TestCase() - .setId("32"), - new TestPlanV1_0.TestCase() - .setId("34"), - new TestPlanV1_0.TestCase() - .setId("41"), - new TestPlanV1_0.TestCase() - .setId("48") - )), - TestsWithAllureId.class - ); + final TestPlan testPlan = new TestPlanV1_0().setTests(Arrays.asList( + new TestPlanV1_0.TestCase() + .setId("10"), + new TestPlanV1_0.TestCase() + .setId("20"), + new TestPlanV1_0.TestCase() + .setId("30") + )); + + final AllureResults results = runClasses(testPlan, FilterSimpleTests.class); + assertThat(results.getTestResults()) + .hasSize(2); + } + + @Test + void shouldFilterParameterizedTestCasesByAllureId() { + final TestPlan testPlan = new TestPlanV1_0().setTests(Arrays.asList( + new TestPlanV1_0.TestCase() + .setId("10"), + new TestPlanV1_0.TestCase() + .setId("20") + )); + + final AllureResults results = runClasses(testPlan, FilterParameterizedTests.class); + assertThat(results.getTestResults()) + .hasSize(4); + } - final long testsCount = testPlan.countTestIdentifiers(TestIdentifier::isTest); - assertThat(testsCount) - .isEqualTo(3); + private String testId(final Class testClass, String method) { + return String.format("[engine:%s]/[class:%s]/[method:%s()]", + "junit-jupiter", + testClass.getCanonicalName(), + method); } + + } diff --git a/allure-junit-platform/src/test/java/io/qameta/allure/junitplatform/features/FilterParameterizedTests.java b/allure-junit-platform/src/test/java/io/qameta/allure/junitplatform/features/FilterParameterizedTests.java new file mode 100644 index 000000000..f7bf17ad1 --- /dev/null +++ b/allure-junit-platform/src/test/java/io/qameta/allure/junitplatform/features/FilterParameterizedTests.java @@ -0,0 +1,50 @@ +/* + * Copyright 2019 Qameta Software OÜ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.qameta.allure.junitplatform.features; + +import io.qameta.allure.AllureId; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; + +/** + * @author charlie (Dmitry Baev). + */ +public class FilterParameterizedTests { + + @BeforeAll + static void doNothing() { + + } + + @AllureId("10") + @ParameterizedTest + @ValueSource(strings = {"a", "b"}) + void first(String value) { + } + + @AllureId("20") + @ParameterizedTest + @ValueSource(strings = {"a", "b"}) + void second(String value) { + } + + @ParameterizedTest + @ValueSource(strings = {"a", "b"}) + void third(String value) { + } + +} diff --git a/allure-junit-platform/src/test/java/io/qameta/allure/junitplatform/features/FilterSimpleTests.java b/allure-junit-platform/src/test/java/io/qameta/allure/junitplatform/features/FilterSimpleTests.java new file mode 100644 index 000000000..11ee50512 --- /dev/null +++ b/allure-junit-platform/src/test/java/io/qameta/allure/junitplatform/features/FilterSimpleTests.java @@ -0,0 +1,46 @@ +/* + * Copyright 2019 Qameta Software OÜ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.qameta.allure.junitplatform.features; + +import io.qameta.allure.AllureId; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +/** + * @author charlie (Dmitry Baev). + */ +public class FilterSimpleTests { + + @BeforeAll + static void doNothing(){ + + } + + @Test + @AllureId("10") + void first() { + } + + @Test + @AllureId("20") + void second() { + } + + @Test + void third() { + } + +} diff --git a/allure-junit5/build.gradle.kts b/allure-junit5/build.gradle.kts index 91499fd26..0b63accf3 100644 --- a/allure-junit5/build.gradle.kts +++ b/allure-junit5/build.gradle.kts @@ -38,15 +38,16 @@ tasks.test { } } -val spiOffJar by tasks.creating(Jar::class) { +val spiOffJar: Jar by tasks.creating(Jar::class) { from(sourceSets.getByName("main").output) archiveClassifier.set("spi-off") } -val spiOff by configurations.creating { - extendsFrom(configurations.getByName("compile")) +publishing { + publications { + named("maven") { + artifact(spiOffJar) + } + } } -artifacts.add("archives", spiOffJar) -artifacts.add("spiOff", spiOffJar) - diff --git a/allure-model/build.gradle.kts b/allure-model/build.gradle.kts index 507dfdf45..5d8287fdf 100644 --- a/allure-model/build.gradle.kts +++ b/allure-model/build.gradle.kts @@ -4,7 +4,7 @@ val agent: Configuration by configurations.creating dependencies { agent("org.aspectj:aspectjweaver") - implementation("com.fasterxml.jackson.core:jackson-databind") + implementation("com.fasterxml.jackson.core:jackson-databind:2.12.3") testImplementation("io.github.benas:random-beans") testImplementation("org.assertj:assertj-core") testImplementation("org.junit.jupiter:junit-jupiter-api") diff --git a/allure-selenide/build.gradle.kts b/allure-selenide/build.gradle.kts index 2d4890884..c0b0b4e32 100644 --- a/allure-selenide/build.gradle.kts +++ b/allure-selenide/build.gradle.kts @@ -2,7 +2,7 @@ description = "Allure Selenide Integration" val agent: Configuration by configurations.creating -val selenideVersion = "5.20.1" +val selenideVersion = "5.20.4" dependencies { agent("org.aspectj:aspectjweaver") diff --git a/allure-spring-web/build.gradle.kts b/allure-spring-web/build.gradle.kts index edd5d70a7..754716507 100644 --- a/allure-spring-web/build.gradle.kts +++ b/allure-spring-web/build.gradle.kts @@ -2,7 +2,7 @@ description = "Allure Spring Web Integration" val agent: Configuration by configurations.creating -val springWebVersion = "5.3.5" +val springWebVersion = "5.3.6" dependencies { agent("org.aspectj:aspectjweaver") diff --git a/allure-testng/build.gradle.kts b/allure-testng/build.gradle.kts index c48c6d44c..f6b2d0107 100644 --- a/allure-testng/build.gradle.kts +++ b/allure-testng/build.gradle.kts @@ -39,14 +39,15 @@ tasks.test { } } -val spiOffJar by tasks.creating(Jar::class) { +val spiOffJar: Jar by tasks.creating(Jar::class) { from(sourceSets.getByName("main").output) - classifier = "spi-off" + archiveClassifier.set("spi-off") } -val spiOff by configurations.creating { - extendsFrom(configurations.getByName("compile")) +publishing { + publications { + named("maven") { + artifact(spiOffJar) + } + } } - -artifacts.add("archives", spiOffJar) -artifacts.add("spiOff", spiOffJar) diff --git a/build.gradle.kts b/build.gradle.kts index c0b0e101b..3cf7c43d0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,8 +1,5 @@ import com.diffplug.gradle.spotless.SpotlessExtension -import io.qameta.allure.gradle.AllureExtension import io.qameta.allure.gradle.task.AllureReport -import io.spring.gradle.dependencymanagement.dsl.DependencyManagementExtension -import org.gradle.jvm.tasks.Jar import ru.vyarus.gradle.plugin.quality.QualityExtension buildscript { @@ -13,10 +10,8 @@ buildscript { } dependencies { - classpath("com.diffplug.spotless:spotless-plugin-gradle:5.11.1") - classpath("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5") - classpath("io.spring.gradle:dependency-management-plugin:1.0.11.RELEASE") - classpath("ru.vyarus:gradle-quality-plugin:4.5.0") + classpath("com.diffplug.spotless:spotless-plugin-gradle:5.12.4") + classpath("ru.vyarus:gradle-quality-plugin:4.6.0") } } @@ -37,7 +32,10 @@ tasks.withType(Wrapper::class) { plugins { java `java-library` - id("net.researchgate.release") version "2.8.1" + `maven-publish` + signing + id("io.spring.dependency-management") version "1.0.11.RELEASE" + id("io.github.gradle-nexus.publish-plugin") version "1.1.0" id("io.qameta.allure") version "2.8.1" } @@ -50,35 +48,34 @@ tasks.withType(JavaCompile::class) { options.encoding = "UTF-8" } -release { - tagTemplate = "\${version}" -} - -val afterReleaseBuild by tasks.existing - configure(listOf(rootProject)) { description = "Allure Java" group = "io.qameta.allure" } +nexusPublishing { + repositories { + sonatype() + } +} + configure(subprojects) { val project = this group = "io.qameta.allure" version = version apply(plugin = "java") + apply(plugin = "signing") apply(plugin = "java-library") - apply(plugin = "maven") - apply(plugin = "io.spring.dependency-management") + apply(plugin = "maven-publish") + apply(plugin = "io.qameta.allure") apply(plugin = "ru.vyarus.quality") apply(plugin = "com.diffplug.spotless") - apply(plugin = "io.qameta.allure") - apply(from = "$gradleScriptDir/bintray.gradle") - apply(from = "$gradleScriptDir/maven-publish.gradle") + apply(plugin = "io.spring.dependency-management") - configure { + dependencyManagement { imports { - mavenBom("com.fasterxml.jackson:jackson-bom:2.12.2") + mavenBom("com.fasterxml.jackson:jackson-bom:2.12.3") mavenBom("org.junit:junit-bom:5.7.1") } dependencies { @@ -91,16 +88,16 @@ configure(subprojects) { dependency("io.github.glytching:junit-extensions:2.4.0") dependency("org.apache.commons:commons-lang3:3.12.0") dependency("org.apache.httpcomponents:httpclient:4.5.13") - dependency("org.apache.tika:tika-core:1.25") + dependency("org.apache.tika:tika-core:1.26") dependency("org.aspectj:aspectjrt:1.9.6") dependency("org.aspectj:aspectjweaver:1.9.6") dependency("org.assertj:assertj-core:3.19.0") dependency("org.codehaus.groovy:groovy-all:2.5.13") dependency("org.freemarker:freemarker:2.3.31") dependency("org.jboss.resteasy:resteasy-client:4.6.0.Final") - dependency("org.jooq:joor-java-8:0.9.13") + dependency("org.jooq:joor-java-8:0.9.14") dependency("org.mock-server:mockserver-netty:5.11.2") - dependency("org.mockito:mockito-core:3.8.0") + dependency("org.mockito:mockito-core:3.9.0") dependencySet("org.slf4j:1.7.30") { entry("slf4j-api") entry("slf4j-nop") @@ -159,7 +156,7 @@ configure(subprojects) { if (spotbugs != null) { dependencies { spotbugs("org.slf4j:slf4j-simple") - spotbugs("com.github.spotbugs:spotbugs:3.1.12") + spotbugs("com.github.spotbugs:spotbugs:4.2.3") } } } @@ -206,31 +203,63 @@ configure(subprojects) { encoding("UTF-8") } - configure { + allure { autoconfigure = false aspectjweaver = false } - val sourceJar by tasks.creating(Jar::class) { - from(sourceSets.getByName("main").allSource) - archiveClassifier.set("sources") - } - - val javadocJar by tasks.creating(Jar::class) { - from(tasks.getByName("javadoc")) - archiveClassifier.set("javadoc") + java { + withJavadocJar() + withSourcesJar() } tasks.withType(Javadoc::class) { (options as StandardJavadocDocletOptions).addStringOption("Xdoclint:none", "-quiet") } - artifacts.add("archives", sourceJar) - artifacts.add("archives", javadocJar) + publishing { + publications { + create("maven") { + from(components["java"]) + suppressAllPomMetadataWarnings() + pom { + name.set(project.name) + description.set("Module ${project.name} of Allure Framework.") + url.set("https://github.com/allure-framework/allure-java") + licenses { + license { + name.set("The Apache License, Version 2.0") + url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") + } + } + developers { + developer { + id.set("baev") + name.set("Dmitry Baev") + email.set("dmitry.baev@qameta.io") + } + developer { + id.set("eroshenkoam") + name.set("Artem Eroshenko") + email.set("artem.eroshenko@qameta.io") + } + } + scm { + developerConnection.set("scm:git:git://github.com/allure-framework/allure-java") + connection.set("scm:git:git://github.com/allure-framework/allure-java") + url.set("https://github.com/allure-framework/allure-java") + } + issueManagement { + system.set("GitHub Issues") + url.set("https://github.com/allure-framework/allure-java/issues") + } + } + } + } + } - val bintrayUpload by tasks.existing - afterReleaseBuild { - dependsOn(bintrayUpload) + signing { + sign(publishing.publications["maven"]) } repositories { diff --git a/gradle.properties b/gradle.properties index 1022fe6b1..9ebd5e23f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=2.14-SNAPSHOT +version=2.13.10 org.gradle.daemon=true org.gradle.parallel=true diff --git a/gradle/bintray.gradle b/gradle/bintray.gradle deleted file mode 100644 index 60e005f04..000000000 --- a/gradle/bintray.gradle +++ /dev/null @@ -1,31 +0,0 @@ -apply plugin: 'com.jfrog.bintray' - -bintray { - user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER') - key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') - - configurations = ['archives'] - - publish = true - pkg { - userOrg = 'qameta' - repo = 'maven' - name = 'allure-java' - desc = 'Allure Java integrations' - websiteUrl = 'https://github.com/allure-framework/allure-java' - issueTrackerUrl = 'https://github.com/allure-framework/allure-java' - vcsUrl = 'https://github.com/allure-framework/allure-java.git' - licenses = ['Apache-2.0'] - - githubRepo = 'allure-framework/allure-java' - githubReleaseNotesFile = 'README.md' - - version { - name = project.version - released = new Date() - gpg { - sign = true - } - } - } -} diff --git a/gradle/maven-publish.gradle b/gradle/maven-publish.gradle deleted file mode 100644 index 7543a22be..000000000 --- a/gradle/maven-publish.gradle +++ /dev/null @@ -1,55 +0,0 @@ -apply plugin: 'maven' - -install { - repositories.mavenInstaller { - customizePom(pom, project) - } -} - -def customizePom(pom, gradleProject) { - pom.whenConfigured { generatedPom -> - // eliminate testng-scoped dependencies (no need in maven central poms) - generatedPom.dependencies.removeAll { dep -> - dep.scope == "test" - } - - // sort to make pom dependencies order consistent to ease comparison of older poms - generatedPom.dependencies = generatedPom.dependencies.sort { dep -> - "$dep.scope:$dep.groupId:$dep.artifactId" - } - - // add all items necessary for maven central publication - generatedPom.project { - name = gradleProject.description - description = gradleProject.description - url = "https://github.com/allure-framework/allure-java" - organization { - name = "Qameta IO" - url = "https://qameta.io" - } - licenses { - license { - name = 'The Apache Software License, Version 2.0' - url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - distribution = 'repo' - } - } - scm { - url = 'https://github.com/allure-framework/allure-java' - connection = 'scm:git:git://github.com/allure-framework/allure-java' - developerConnection = 'scm:git:git://github.com/allure-framework/allure-java' - } - developers { - developer { - id = 'baev' - name = 'Dmitry Baev' - email = 'baev@qameta.io' - } - } - issueManagement { - system = 'Github Issues' - url = 'https://github.com/allure-framework/allure-java/issues' - } - } - } -}