Skip to content

Commit

Permalink
Merge pull request #17 from noumenalio/develop
Browse files Browse the repository at this point in the history
Enhancements.
  • Loading branch information
stewartbryson authored Sep 7, 2022
2 parents 3aa99d4 + 39ad74e commit 90bb814
Show file tree
Hide file tree
Showing 16 changed files with 582 additions and 400 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/gradle-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ name: Run Gradle on PRs
on:
pull_request

env:
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -23,9 +19,12 @@ jobs:
uses: gradle/gradle-build-action@v2
with:
arguments: build validatePlugin functionalTest buildDashboard
env:
AWS_ACCESS_KEY_ID: ${{secrets.CIO_AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.CIO_AWS_SECRET_ACCESS_KEY}}

- name: Publish tests
uses: mikepenz/action-junit-report@v3
if: always()
with:
report_paths: '**/build/test-results/**/TEST-*.xml'
report_paths: '**/build/test-results/**/TEST-*.xml'
17 changes: 12 additions & 5 deletions .github/workflows/gradle-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ on:
- main
types: [ closed ]

env:
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}

jobs:
build:
if: ${{ github.event.pull_request.merged }}
Expand All @@ -30,10 +26,21 @@ jobs:
with:
arguments: release -Prelease.disableChecks -Prelease.localOnly

- name: Gradle build and test
uses: gradle/gradle-build-action@v2
with:
arguments: build buildDashboard
env:
AWS_ACCESS_KEY_ID: ${{secrets.CIO_AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.CIO_AWS_SECRET_ACCESS_KEY}}

- name: Gradle publish
uses: gradle/gradle-build-action@v2
with:
arguments: build publish githubRelease publishDocs buildDashboard -PgithubToken=${{secrets.GITHUB_TOKEN}}
arguments: publish githubRelease publishDocs buildDashboard -PgithubToken=${{secrets.GITHUB_TOKEN}}
env:
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}

- name: Publish tests
uses: mikepenz/action-junit-report@v3
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ bin/
.settings
.classpath
.factorypath
.vscode/
20 changes: 20 additions & 0 deletions examples/internal-stage/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
plugins {
id 'java'
}

repositories {
mavenCentral()
}

dependencies {
implementation 'org.apache.logging.log4j:log4j-api:2.18.0'
implementation 'org.apache.logging.log4j:log4j-core:2.18.0'
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}

version='0.1.0'
12 changes: 12 additions & 0 deletions examples/internal-stage/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
pluginManagement {
repositories {
maven {
url "s3://nio-maven"
authentication {
awsIm(AwsImAuthentication)
}
}
gradlePluginPortal()
}
}
rootProject.name = 'internal-stage'
21 changes: 21 additions & 0 deletions examples/internal-stage/src/main/java/AddNumbers.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class AddNumbers {

private static final Logger logger = LogManager.getLogger();

public String addNum(int num1, int num2) {
try {
int sum = num1 + num2;
return ("Sum is: " + sum);
} catch (Exception e) {
logger.warn("Error: " + e.toString());
return null;
}
}

public static void main(String[] args) {
System.out.println("Hello World");
}
}
36 changes: 36 additions & 0 deletions examples/simple-jar/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
plugins {
id 'io.noumenal.gradle.snowflake' version '0.1.9'
id 'java'
}

repositories {
mavenCentral()
}

dependencies {
implementation 'org.apache.logging.log4j:log4j-api:2.18.0'
implementation 'org.apache.logging.log4j:log4j-core:2.18.0'
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}

snowflake {
// groupId = 'io.noumenal'
// artifactId = 'test-gradle-snowflake'
role = 'devops'
database = 'devops'
schema = 'gradle'
applications {
add_numbers {
inputs = ["a integer", "b integer"]
returns = "string"
handler = "AddNumbers.addNum"
}
}
}

version='0.1.0'
12 changes: 12 additions & 0 deletions examples/simple-jar/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
pluginManagement {
repositories {
maven {
url "s3://nio-maven"
authentication {
awsIm(AwsImAuthentication)
}
}
gradlePluginPortal()
}
}
rootProject.name = 'internal-stage'
21 changes: 21 additions & 0 deletions examples/simple-jar/src/main/java/AddNumbers.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class AddNumbers {

private static final Logger logger = LogManager.getLogger();

public String addNum(int num1, int num2) {
try {
int sum = num1 + num2;
return ("Sum is: " + sum);
} catch (Exception e) {
logger.warn("Error: " + e.toString());
return null;
}
}

public static void main(String[] args) {
System.out.println("Hello World");
}
}
144 changes: 73 additions & 71 deletions plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,46 +1,59 @@
plugins {
id 'java-gradle-plugin'
id 'groovy'
id 'maven-publish'
id 'com.adarshr.test-logger' version '3.2.0'
id "com.redpillanalytics.gradle-properties" version "1.0.7"
id 'com.fuseanalytics.gradle.s3' version '1.2.0'
id 'java-gradle-plugin'
id 'groovy'
id 'maven-publish'
id 'com.adarshr.test-logger' version '3.2.0'
id "com.redpillanalytics.gradle-properties" version "1.0.7"
id 'com.fuseanalytics.gradle.s3' version '1.2.0'
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}

dependencies {
implementation 'org.codehaus.groovy:groovy:3.0.12'
implementation 'org.slf4j:slf4j-simple:1.7.36'
implementation 'com.snowflake:snowpark:1.5.0'
implementation 'gradle.plugin.com.redpillanalytics:gradle-properties:1.0.7'
implementation 'gradle.plugin.com.github.johnrengelman:shadow:7.1.2'
implementation 'org.codehaus.groovy:groovy:3.0.12'
implementation 'org.slf4j:slf4j-simple:2.0.0'
implementation 'com.snowflake:snowpark:1.6.0'
implementation 'gradle.plugin.com.redpillanalytics:gradle-properties:1.0.7'
implementation 'gradle.plugin.com.github.johnrengelman:shadow:7.1.2'
}

testing {
suites {
// Configure the built-in test suite
test {
// Use Spock test framework
useSpock('2.1-groovy-3.0')
}
suites {
// Configure the built-in test suite
test {
// Use Spock test framework
useSpock('2.1-groovy-3.0')
}

// Create a new test suite
functionalTest(JvmTestSuite) {
// Use Spock test framework
useSpock('2.1-groovy-3.0')
// Create a new test suite
functionalTest(JvmTestSuite) {
// Use Spock test framework
useSpock('2.1-groovy-3.0')

dependencies {
// functionalTest test suite depends on the production code in tests
implementation project
}
dependencies {
// functionalTest test suite depends on the production code in tests
implementation project
}

targets {
all {
// This test suite should run after the built-in test suite has run its tests
testTask.configure { shouldRunAfter(test) }
targets {
all {
// This test suite should run after the built-in test suite has run its tests
testTask.configure {
shouldRunAfter(test)
systemProperties project.properties.findAll { it.key.startsWith "snowflake." }
systemProperty 'internalStage', findProperty('internalStage')
systemProperty 'externalStage', findProperty('externalStage')
failFast true
testLogging.showStandardStreams true
}
}
}
}
}
}
}
}
}

//pluginBundle {
Expand All @@ -50,61 +63,50 @@ testing {
//}

gradlePlugin {
// Define the plugin
plugins {
snowflake {
id = 'io.noumenal.gradle.snowflake'
implementationClass = 'io.noumenal.SnowflakePlugin'
}
}
// Define the plugin
plugins {
snowflake {
id = 'io.noumenal.gradle.snowflake'
implementationClass = 'io.noumenal.SnowflakePlugin'
}
}
}

gradlePlugin.testSourceSets(sourceSets.functionalTest)

build.dependsOn validatePlugins

tasks.withType(Test) {
failFast true
testLogging.showStandardStreams true
systemProperty "account", findProperty("snowflake.account")
systemProperty "user", findProperty("snowflake.user")
systemProperty "password", findProperty("snowflake.password")
systemProperty "schema", findProperty("snowflake.schema")
systemProperty "publishUrl", findProperty("snowflake.publishUrl")
}

publishing {
repositories {
maven {
name 's3'
url 's3://nio-maven'
authentication {
awsIm(AwsImAuthentication)
}
}
}
repositories {
maven {
name 's3'
url 's3://nio-maven'
authentication {
awsIm(AwsImAuthentication)
}
}
}
}

s3 {
bucket = 'docs.noumenal.io'
region = 'us-east-1'
bucket = 'docs.noumenal.io'
region = 'us-east-1'
}

tasks.register("publishLatestDocs", com.fuseanalytics.gradle.s3.S3Upload) {
description = "Publish the latest docs to S3."
keyPrefix = "${rootProject.name}/latest"
sourceDir = tasks.groovydoc.destinationDir
dependsOn groovydoc
description = "Publish the latest docs to S3."
keyPrefix = "${rootProject.name}/latest"
sourceDir = tasks.groovydoc.destinationDir
dependsOn groovydoc
}

tasks.register("publishVersionDocs", com.fuseanalytics.gradle.s3.S3Upload) {
description = "Publish the version docs to S3."
keyPrefix = "${rootProject.name}/$version"
sourceDir = tasks.groovydoc.destinationDir
dependsOn groovydoc
description = "Publish the version docs to S3."
keyPrefix = "${rootProject.name}/$version"
sourceDir = tasks.groovydoc.destinationDir
dependsOn groovydoc
}

tasks.register("publishDocs") {
dependsOn tasks.publishLatestDocs, tasks.publishVersionDocs
mustRunAfter tasks.publish
dependsOn tasks.publishLatestDocs, tasks.publishVersionDocs
mustRunAfter tasks.publish
}
2 changes: 2 additions & 0 deletions plugin/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
internalStage=upload
externalStage=maven_snapshot
Loading

0 comments on commit 90bb814

Please sign in to comment.