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

Lazy API + upgrade to Node plugin 3.x #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
50 changes: 50 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -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
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 }}
28 changes: 3 additions & 25 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ plugins {
id("org.jetbrains.kotlin.jvm")
id("org.jetbrains.dokka")
id("io.gitlab.arturbosch.detekt")
id("com.jfrog.bintray")
id("net.researchgate.release")
}

defaultTasks("build", "publishToMavenLocal")
group = "com.cognifide.gradle"

repositories {
jcenter()
mavenCentral()
gradlePluginPortal()
}

Expand All @@ -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")
Expand Down Expand Up @@ -63,7 +62,7 @@ tasks {
testLogging.showStandardStreams = true
}
named("afterReleaseBuild") {
dependsOn("bintrayUpload", "publishPlugins")
dependsOn("publishPlugins")
}
named("updateVersion") {
enabled = false
Expand Down Expand Up @@ -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<MavenPublication>("mavenJava") {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=1.0.3
version=2.0.0
release.useAutomaticVersion=true

kotlin.version=1.4.20
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -15,13 +15,13 @@ open class LighthousePlugin : Plugin<Project> {
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("""
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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()
Expand Down