diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..e05572c --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,50 @@ +name: Check + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + check: + name: Run Gradle + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: 11 + distribution: adopt + + - name: Build & run functional tests + run: ./gradlew -i -S build functionalTest + + - name: Publish unit test results + uses: mikepenz/action-junit-report@v2 + if: always() + with: + report_paths: | + **/target/**/TEST-*.xml + **/build/**/TEST-*.xml + **/cypress/results/**/TEST-*.xml + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish unit test reports + uses: actions/upload-artifact@v2 + if: always() + with: + name: gap-unit-tests-reports + path: build/reports/tests/test + + - name: Publish functional test reports + uses: actions/upload-artifact@v2 + if: always() + with: + name: gap-functional-tests-reports + path: build/reports/tests/functionalTest \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..1600bf0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,25 @@ +name: Release + +on: workflow_dispatch + +jobs: + release: + name: Run Gradle + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: fregante/setup-git-user@v1 + + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: 11 + distribution: adopt + + - name: Build, release then publish assets + run: | + ./gradlew -i -S fullRelease \ + -Pgithub.token=${{ secrets.GITHUB_TOKEN }} \ + -Pgradle.publish.key=${{ secrets.GRADLE_PUBLISH_KEY }} \ + -Pgradle.publish.secret=${{ secrets.GRADLE_PUBLISH_SECRET }} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 4045ae3..c7ccd11 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,7 +7,6 @@ plugins { id("org.jetbrains.kotlin.jvm") id("org.jetbrains.dokka") id("io.gitlab.arturbosch.detekt") - id("com.jfrog.bintray") id("net.researchgate.release") } @@ -15,7 +14,7 @@ defaultTasks("build", "publishToMavenLocal") group = "com.cognifide.gradle" repositories { - jcenter() + mavenCentral() gradlePluginPortal() } @@ -24,7 +23,7 @@ dependencies { implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.8.8") implementation("commons-io:commons-io:2.6") - implementation("com.github.node-gradle:gradle-node-plugin:2.1.1") + implementation("com.github.node-gradle:gradle-node-plugin:3.1.1") testImplementation("org.jetbrains.kotlin:kotlin-test") testImplementation("org.jetbrains.kotlin:kotlin-test-junit") @@ -63,7 +62,7 @@ tasks { testLogging.showStandardStreams = true } named("afterReleaseBuild") { - dependsOn("bintrayUpload", "publishPlugins") + dependsOn("publishPlugins") } named("updateVersion") { enabled = false @@ -95,27 +94,6 @@ pluginBundle { tags = listOf("lighthouse", "performance", "test", "seo", "pwa") } -bintray { - user = (project.findProperty("bintray.user") ?: System.getenv("BINTRAY_USER"))?.toString() - key = (project.findProperty("bintray.key") ?: System.getenv("BINTRAY_KEY"))?.toString() - setPublications("mavenJava") - with(pkg) { - repo = "maven-public" - name = "gradle-lighthouse-plugin" - userOrg = "cognifide" - setLicenses("Apache-2.0") - vcsUrl = "https://github.com/wttech/gradle-lighthouse-plugin.git" - setLabels("lighthouse", "performance", "test", "seo", "pwa") - with(version) { - name = project.version.toString() - desc = "${project.description} ${project.version}" - vcsTag = project.version.toString() - } - } - publish = (project.findProperty("bintray.publish") ?: "true").toString().toBoolean() - override = (project.findProperty("bintray.override") ?: "false").toString().toBoolean() -} - publishing { publications { create("mavenJava") { diff --git a/gradle.properties b/gradle.properties index f6a1892..11e435c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=1.0.3 +version=2.0.0 release.useAutomaticVersion=true kotlin.version=1.4.20 diff --git a/src/main/kotlin/com/cognifide/gradle/lighthouse/LighthousePlugin.kt b/src/main/kotlin/com/cognifide/gradle/lighthouse/LighthousePlugin.kt index 52ea2d6..bb3d4a3 100644 --- a/src/main/kotlin/com/cognifide/gradle/lighthouse/LighthousePlugin.kt +++ b/src/main/kotlin/com/cognifide/gradle/lighthouse/LighthousePlugin.kt @@ -1,8 +1,8 @@ package com.cognifide.gradle.lighthouse import com.cognifide.gradle.lighthouse.tasks.LighthouseRun -import com.moowork.gradle.node.NodeExtension -import com.moowork.gradle.node.yarn.YarnInstallTask +import com.github.gradle.node.NodeExtension +import com.github.gradle.node.yarn.task.YarnInstallTask import org.gradle.api.Plugin import org.gradle.api.Project import java.io.File @@ -15,13 +15,13 @@ open class LighthousePlugin : Plugin { val node = NodeExtension.get(project) node.apply { - version = "10.16.3" - yarnVersion = "1.19.0" - download = true + version.set("10.16.3") + yarnVersion.set("1.19.0") + download.set(true) } val yarnInstall = project.tasks.named(YarnInstallTask.NAME, YarnInstallTask::class.java) { - File(node.nodeModulesDir, "package.json").apply { + File(node.nodeProjectDir.get().asFile, "package.json").apply { if (!exists()) { writeText(""" { diff --git a/src/main/kotlin/com/cognifide/gradle/lighthouse/runner/Runner.kt b/src/main/kotlin/com/cognifide/gradle/lighthouse/runner/Runner.kt index 065ac5d..f142e4f 100644 --- a/src/main/kotlin/com/cognifide/gradle/lighthouse/runner/Runner.kt +++ b/src/main/kotlin/com/cognifide/gradle/lighthouse/runner/Runner.kt @@ -3,7 +3,7 @@ package com.cognifide.gradle.lighthouse.runner import com.cognifide.gradle.lighthouse.LighthouseException import com.cognifide.gradle.lighthouse.LighthouseExtension import com.cognifide.gradle.lighthouse.Utils -import com.moowork.gradle.node.yarn.YarnExecRunner +import com.github.gradle.node.yarn.exec.YarnExecRunner import java.io.File class Runner(lighthouse: LighthouseExtension) { @@ -50,7 +50,9 @@ class Runner(lighthouse: LighthouseExtension) { val reportName = reportFile.name reportDir.mkdirs() - YarnExecRunner(project).apply { + + // TODO needs https://github.com/node-gradle/gradle-node-plugin/pull/202 + project.objects.newInstance(YarnExecRunner::class.java).apply { workingDir = project.projectDir arguments = mutableListOf("lighthouse-ci", url, "--report=$reportDir", "--filename=$reportName") + extraArgs execute()