diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index b3cf179..f83b377 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -11,46 +11,89 @@ jobs: build: runs-on: ubuntu-latest env: - WORKSPACE: ${{ github.workspace }} GRADLE_OPTS: -Xmx1500m -Dfile.encoding=UTF-8 steps: - - uses: actions/checkout@v4 - - name: Set up JDK + - name: "πŸ“₯ Checkout repository" + uses: actions/checkout@v4 + - name: "β˜•οΈ Setup JDK" uses: actions/setup-java@v4 with: - distribution: 'temurin' + distribution: liberica java-version: 17 - - name: Run Tests - if: github.event_name == 'pull_request' - id: tests - uses: gradle/gradle-build-action@v2 + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 with: - arguments: check -Dgeb.env=chromeHeadless - - name: Run Build - if: github.event_name == 'push' + develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + - name: "πŸ”¨ Build project" id: build - uses: gradle/gradle-build-action@v2 env: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - with: - arguments: build -Dgeb.env=chromeHeadless + DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} + DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} + run: + ./gradlew build - name: Publish Test Report - if: steps.build.outcome == 'failure' || steps.tests.outcome == 'failure' + if: steps.build.outcome == 'failure' uses: scacap/action-surefire-report@v1 with: github_token: ${{ secrets.GITHUB_TOKEN }} report_paths: '**/build/test-results/test/TEST-*.xml' - - name: Publish to repo.grails.org + publish: + if: github.event_name == 'push' + needs: [ 'build' ] + runs-on: ubuntu-latest + steps: + - name: "πŸ“₯ Checkout repository" + uses: actions/checkout@v4 + - name: "β˜•οΈ Setup JDK" + uses: actions/setup-java@v4 + with: + distribution: liberica + java-version: 17 + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + - name: "πŸ“€ Publish Snapshot Artifacts" id: publish - uses: gradle/gradle-build-action@v2 - if: steps.build.outcome == 'success' && github.event_name == 'push' env: - ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} - ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} + MAVEN_PUBLISH_USERNAME: ${{ secrets.MAVEN_PUBLISH_USERNAME }} + MAVEN_PUBLISH_PASSWORD: ${{ secrets.MAVEN_PUBLISH_PASSWORD }} + DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} + DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} + run: ./gradlew publish + docs: + if: github.event_name == 'push' + needs: publish + runs-on: ubuntu-latest + permissions: + contents: write + env: + GIT_USER_NAME: grails-build + GIT_USER_EMAIL: grails-build@users.noreply.github.com + steps: + - name: "πŸ“₯ Checkout repository" + uses: actions/checkout@v4 + - name: "β˜•οΈ Setup JDK" + uses: actions/setup-java@v4 with: - arguments: -Dorg.gradle.internal.publish.checksums.insecure=true publish - - name: Build Documentation - id: docs - uses: gradle/gradle-build-action@v2 + distribution: liberica + java-version: 17 + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 with: - arguments: docs:docs + develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + - name: "πŸ“œ Build Documentation" + run: ./gradlew docs:docs + - name: "πŸš€ Publish to Github Pages" + id: docs + if: success() + uses: grails/github-pages-deploy-action@v2 + env: + SKIP_SNAPSHOT: ${{ contains(needs.publish.outputs.release_version, 'M') }} + TARGET_REPOSITORY: ${{ github.repository }} + GH_TOKEN: ${{ secrets.GH_TOKEN }} + BRANCH: gh-pages + FOLDER: docs/build/docs + DOC_FOLDER: gh-pages + COMMIT_EMAIL: ${{ env.GIT_USER_EMAIL }} + COMMIT_NAME: ${{ env.GIT_USER_NAME }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 31133dc..4721021 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,18 +8,22 @@ jobs: release_version: ${{ steps.release_version.outputs.value }} runs-on: ubuntu-latest env: - GIT_USER_NAME: puneetbehl - GIT_USER_EMAIL: behlp@unityfoundation.io + GIT_USER_NAME: 'grails-build' + GIT_USER_EMAIL: 'grails-build@users.noreply.github.com' steps: - - name: Checkout repository + - name: "πŸ“₯ Checkout repository" uses: actions/checkout@v4 with: token: ${{ secrets.GH_TOKEN }} - - name: Set up JDK + - name: "β˜•οΈ Setup JDK" uses: actions/setup-java@v4 with: - distribution: 'temurin' - java-version: '17' + distribution: liberica + java-version: 17 + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - name: Set the current release version id: release_version run: echo "value=${GITHUB_REF:11}" >> $GITHUB_OUTPUT @@ -30,9 +34,7 @@ jobs: - name: Run Assemble if: success() id: assemble - uses: gradle/gradle-build-action@v2 - with: - arguments: assemble + run: ./gradlew assemble env: GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - name: Upload Distribution @@ -47,18 +49,17 @@ jobs: run: echo $SECRING_FILE | base64 -d > ${{ github.workspace }}/secring.gpg - name: Publish to Sonatype OSSRH id: publish - uses: gradle/gradle-build-action@v2 env: GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} - SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} - SONATYPE_NEXUS_URL: ${{ secrets.SONATYPE_NEXUS_URL }} - SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} + NEXUS_PUBLISH_USERNAME: ${{ secrets.NEXUS_PUBLISH_USERNAME }} + NEXUS_PUBLISH_PASSWORD: ${{ secrets.NEXUS_PUBLISH_PASSWORD }} + NEXUS_PUBLISH_NEXUS_URL: ${{ secrets.NEXUS_PUBLISH_RELEASE_URL }} + NEXUS_PUBLISH_STAGING_PROFILE_ID: ${{ secrets.NEXUS_PUBLISH_STAGING_PROFILE_ID }} SIGNING_KEY: ${{ secrets.SIGNING_KEY }} SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} SECRING_FILE: ${{ secrets.SECRING_FILE }} - with: - arguments: | + run: > + ./gradlew -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg publishToSonatype closeSonatypeStagingRepository @@ -68,26 +69,32 @@ jobs: permissions: contents: read steps: - - uses: actions/checkout@v4 - - name: Set up JDK + - name: "πŸ“₯ Checkout repository" + uses: actions/checkout@v4 + with: + token: ${{ secrets.GH_TOKEN }} + - name: "β˜•οΈ Setup JDK" uses: actions/setup-java@v4 with: - distribution: 'temurin' - java-version: '17' + distribution: liberica + java-version: 17 - name: Checkout repository uses: actions/checkout@v4 with: token: ${{ secrets.GH_TOKEN }} ref: v${{ needs.publish.outputs.release_version }} + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - name: Nexus Staging Close And Release - uses: gradle/gradle-build-action@v2 env: GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} - SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} - SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} - with: - arguments: | + NEXUS_PUBLISH_USERNAME: ${{ secrets.NEXUS_PUBLISH_USERNAME }} + NEXUS_PUBLISH_PASSWORD: ${{ secrets.NEXUS_PUBLISH_PASSWORD }} + NEXUS_PUBLISH_NEXUS_URL: ${{ secrets.NEXUS_PUBLISH_RELEASE_URL }} + NEXUS_PUBLISH_STAGING_PROFILE_ID: ${{ secrets.NEXUS_PUBLISH_STAGING_PROFILE_ID }} + run: > findSonatypeStagingRepository releaseSonatypeStagingRepository - name: Run post-release @@ -106,18 +113,20 @@ jobs: - name: Set up JDK uses: actions/setup-java@v4 with: - distribution: 'temurin' + distribution: 'liberica' java-version: '17' - name: Checkout repository uses: actions/checkout@v4 with: token: ${{ secrets.GH_TOKEN }} ref: v${{ needs.publish.outputs.release_version }} + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - name: Build Documentation id: docs - uses: gradle/gradle-build-action@v2 - with: - arguments: docs:docs + run: ./gradlew docs:docs - name: Publish to Github Pages if: success() uses: grails/github-pages-deploy-action@v2 @@ -126,8 +135,8 @@ jobs: TARGET_REPOSITORY: ${{ github.repository }} GH_TOKEN: ${{ secrets.GH_TOKEN }} BRANCH: gh-pages - FOLDER: build/docs + FOLDER: docs/build/docs DOC_FOLDER: gh-pages - COMMIT_EMAIL: behlp@unityfoundation.io - COMMIT_NAME: Puneet Behl + COMMIT_EMAIL: ${{ env.GIT_USER_EMAIL }} + COMMIT_NAME: ${{ env.GIT_USER_NAME }} VERSION: ${{ needs.publish.outputs.release_version }} diff --git a/build.gradle b/build.gradle index c91d9cc..9e423c5 100644 --- a/build.gradle +++ b/build.gradle @@ -1,19 +1,15 @@ -plugins { - id 'groovy' -} - -java { - toolchain { - languageVersion = JavaLanguageVersion.of(17) +buildscript { + repositories { + maven { url "https://plugins.gradle.org/m2/" } + maven { url "https://repo.grails.org/grails/core" } + } + dependencies { + classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion" } } -subprojects { - configurations.configureEach { - resolutionStrategy.eachDependency { DependencyResolveDetails details -> - if (details.requested.group == 'org.seleniumhq.selenium') { - details.useVersion(seleniumVersion) - } - } - } +plugins { + id 'groovy' } + +compileJava.options.release = 17 diff --git a/docs/src/docs/code/build.gradle b/docs/src/docs/code/build.gradle index 92b2ed8..2ed616a 100644 --- a/docs/src/docs/code/build.gradle +++ b/docs/src/docs/code/build.gradle @@ -42,9 +42,6 @@ dependencies { profile "org.grails.profiles:web" runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.14.1" runtime "com.h2database:h2" - testCompile "org.grails.plugins:geb" - testRuntime "org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1" - testRuntime "net.sourceforge.htmlunit:htmlunit:2.18" compile "org.grails.plugins:spring-security-acl:${file('../../../version.txt').text.trim()}" } diff --git a/functional-test-app/build.gradle b/functional-test-app/build.gradle index fc3fc0b..18f419c 100644 --- a/functional-test-app/build.gradle +++ b/functional-test-app/build.gradle @@ -5,8 +5,6 @@ buildscript { } dependencies { classpath "org.grails:grails-gradle-plugin:$grailsVersion" - classpath "org.grails.plugins:hibernate5:$gormVersion" - classpath "com.github.erdi:webdriver-binaries-gradle-plugin:3.2" } } @@ -17,7 +15,6 @@ apply plugin:"eclipse" apply plugin:"idea" apply plugin:"war" apply plugin:"org.grails.grails-web" -apply plugin:"com.github.erdi.webdriver-binaries" apply plugin:"org.grails.grails-gsp" repositories { @@ -52,25 +49,11 @@ dependencies { testImplementation "org.grails:grails-gorm-testing-support" testImplementation "org.grails:grails-web-testing-support" integrationTestImplementation testFixtures('org.grails.plugins:geb') - - testRuntimeOnly "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion" - testRuntimeOnly "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion" - testRuntimeOnly "org.seleniumhq.selenium:selenium-safari-driver:$seleniumVersion" - testImplementation "org.seleniumhq.selenium:selenium-remote-driver:$seleniumVersion" - testImplementation "org.seleniumhq.selenium:selenium-api:$seleniumVersion" implementation project(':spring-security-acl') } tasks.withType(Test) { useJUnitPlatform() - systemProperty "geb.env", System.getProperty('geb.env') - systemProperty "geb.build.reportsDir", reporting.file("geb/integrationTest") - if (System.getenv('CHROMEWEBDRIVER')) { - systemProperty 'webdriver.chrome.driver', "${System.getenv('CHROMEWEBDRIVER')}/chromedriver" - } - if (System.getenv('GECKOWEBDRIVER')) { - systemProperty 'webdriver.gecko.driver', "${System.getenv('GECKOWEBDRIVER')}/geckodriver" - } beforeTest { descriptor -> logger.quiet " -- $descriptor" } testLogging { diff --git a/functional-test-app/src/integration-test/resources/GebConfig.groovy b/functional-test-app/src/integration-test/resources/GebConfig.groovy deleted file mode 100644 index adb480e..0000000 --- a/functional-test-app/src/integration-test/resources/GebConfig.groovy +++ /dev/null @@ -1,41 +0,0 @@ -import org.openqa.selenium.chrome.ChromeDriver -import org.openqa.selenium.chrome.ChromeOptions -import org.openqa.selenium.firefox.FirefoxDriver -import org.openqa.selenium.firefox.FirefoxOptions -import org.openqa.selenium.safari.SafariDriver - -environments { - - // You need to configure in Safari -> Develop -> Allowed Remote Automation - safari { - driver = { new SafariDriver() } - } - - // run via β€œ./gradlew -Dgeb.env=chrome iT” - chrome { - driver = { new ChromeDriver() } - } - - // run via β€œ./gradlew -Dgeb.env=chromeHeadless iT” - chromeHeadless { - driver = { - ChromeOptions o = new ChromeOptions() - o.addArguments('headless') - new ChromeDriver(o) - } - } - - // run via β€œ./gradlew -Dgeb.env=firefoxHeadless iT” - firefoxHeadless { - driver = { - FirefoxOptions o = new FirefoxOptions() - o.addArguments('-headless') - new FirefoxDriver(o) - } - } - - // run via β€œ./gradlew -Dgeb.env=firefox iT” - firefox { - driver = { new FirefoxDriver() } - } -} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 3e08fcd..976bfd2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,15 +1,10 @@ projectVersion=5.0.0-SNAPSHOT grailsVersion=7.0.0-SNAPSHOT +grailsGradlePluginVersion=7.0.0-SNAPSHOT gormVersion=9.0.0-SNAPSHOT springSecurityVersion=6.3.4 springSecurityCoreVersion=7.0.0-SNAPSHOT jakartaServletApiVersion=6.0.0 hibernateCoreVersion=5.6.15.Final ehcacheVersion=3.10.8 -seleniumVersion=4.26.0 projectDesc=Adds Spring Security ACL support to a Grails application. -developers=Burt Beckwith -websiteUrl=http://grails-plugins.github.io/grails-spring-security-acl/ -issueTrackerUrl=https://github.com/grails-plugins/grails-spring-security-acl/issues -vcsUrl=https://github.com/grails-plugins/grails-spring-security-acl -githubSlug=grails-plugins/grails-spring-security-acl diff --git a/plugin/build.gradle b/plugin/build.gradle index c9ff470..2dc97da 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -1,51 +1,25 @@ buildscript { repositories { - mavenLocal() mavenCentral() maven { url "https://repo.grails.org/grails/core" } gradlePluginPortal() } dependencies { - classpath "org.grails:grails-gradle-plugin:$grailsVersion" - classpath "io.github.gradle-nexus:publish-plugin:1.3.0" + classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion" } } plugins { - id 'maven-publish' id 'groovy' id 'java-library' - id 'signing' } version projectVersion group "org.grails.plugins" -ext { - isSnapshot = project.projectVersion.endsWith('-SNAPSHOT') - isReleaseVersion = !isSnapshot -} - apply plugin: 'org.grails.grails-plugin' apply plugin: 'org.grails.grails-gsp' - -if (isReleaseVersion) { - apply plugin: 'io.github.gradle-nexus.publish-plugin' - - nexusPublishing { - repositories { - sonatype { - def ossUser = System.getenv("SONATYPE_USERNAME") ?: project.hasProperty("sonatypeOssUsername") ? project.sonatypeOssUsername : '' - def ossPass = System.getenv("SONATYPE_PASSWORD") ?: project.hasProperty("sonatypeOssPassword") ? project.sonatypeOssPassword : '' - def ossStagingProfileId = System.getenv("SONATYPE_STAGING_PROFILE_ID") ?: project.hasProperty("sonatypeOssStagingProfileId") ? project.sonatypeOssStagingProfileId : '' - nexusUrl = uri("https://s01.oss.sonatype.org/service/local/") - username = ossUser - password = ossPass - stagingProfileId = ossStagingProfileId - } - } - } -} +apply plugin: 'org.grails.grails-publish' repositories { mavenLocal() @@ -86,89 +60,12 @@ dependencies { api "org.springframework.security:spring-security-acl:$springSecurityVersion" } -ext."signing.keyId" = project.hasProperty("signing.keyId") ? project.getProperty('signing.keyId') : System.getenv('SIGNING_KEY') -ext."signing.secretKeyRingFile" = project.hasProperty("signing.secretKeyRingFile") ? project.getProperty('signing.secretKeyRingFile') : "${System.properties['user.home']}${File.separator}.gnupg${File.separator}secring.gpg" -ext."signing.password" = project.hasProperty("signing.password") ? project.getProperty('signing.password') : System.getenv('SIGNING_PASSPHRASE') -ext.pomInfo = { - delegate.name "Grails Spring Security ACL Plugin" - delegate.description project.projectDesc - delegate.url project.hasProperty('websiteUrl') ? project.websiteUrl : "http://grails-plugins.github.io/grails-spring-security-acl/" - - delegate.licenses { - delegate.license { - delegate.name 'The Apache Software License, Version 2.0' - delegate.url 'https://www.apache.org/licenses/LICENSE-2.0.txt' - delegate.distribution 'repo' - } - } - - delegate.scm { - delegate.url project.hasProperty('vcsUrl') ? project.vcsUrl : "https://github.com/grails-plugins/grails-spring-security-acl" - delegate.connection "scm:git@github.com:${githubSlug}.git" - delegate.developerConnection "scm:git@github.com:${githubSlug}.git" - } - - delegate.issueManagement { - delegate.url project.issueTrackerUrl - delegate.system 'GitHub' - } - - if (developers) { - delegate.developers { - for (dev in developers.split(',')) { - delegate.developer { - delegate.id dev.toLowerCase().replace(' ', '') - delegate.name dev - } - } - } - } -} - -publishing { - if (isSnapshot) { - repositories { - maven { - credentials { - username = System.getenv("ARTIFACTORY_USERNAME") ?: project.hasProperty("artifactoryPublishUsername") ? project.artifactoryPublishUsername : '' - password = System.getenv("ARTIFACTORY_PASSWORD") ?: project.hasProperty("artifactoryPublishPassword") ? project.artifactoryPublishPassword : '' - } - url "https://repo.grails.org/grails/plugins3-snapshots-local" - } - } +grailsPublish { + license { + name = 'Apache-2.0' } - - publications { - maven(MavenPublication) { - groupId = project.group - artifactId project.name - version = project.version - - from components.java - - artifact sourcesJar - artifact javadocJar - artifact source: "${buildDir}/classes/groovy/main/META-INF/grails-plugin.xml", - classifier: "plugin", - extension: 'xml' - - pom.withXml { - def xml = asNode() - - xml.children().last() + pomInfo - // dependency management shouldn't be included - def n = xml.get("dependencyManagement") - if (n) - xml.remove(n) - } - } - } -} - -signing { - sign publishing.publications.maven -} - -tasks.withType(Sign) { - onlyIf { isReleaseVersion } + githubSlug = 'grails/grails-spring-security-acl' + title = 'Grails Spring Security ACL Plugin' + desc = project.projectDesc + developers = ['burtbeckwith': 'Burt Beckwith'] }