Skip to content

Commit

Permalink
Merge pull request #79 from stewartbryson/stewart
Browse files Browse the repository at this point in the history
Release 2.0.0
  • Loading branch information
stewartbryson authored Apr 7, 2023
2 parents 9a27873 + 5e1f152 commit 0459788
Show file tree
Hide file tree
Showing 92 changed files with 2,236 additions and 1,563 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/gradle-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,26 @@ jobs:
steps:
- uses: actions/checkout@v3

- run: 'echo "$GRADLE_PROPERTIES" >> gradle.properties'
# - run: ./echo-environment.sh
# name: "Echo environment"
# shell: bash

- run: |
mkdir -p $HOME/.gradle
echo "$GRADLE_PROPERTIES" > $HOME/.gradle/gradle.properties
name: 'Write gradle.properties file'
shell: bash
env:
GRADLE_PROPERTIES: ${{secrets.GRADLE_PROPERTIES}}
- run: |
mkdir -p $HOME/.snowsql
echo "$SNOW_CONFIG" > $HOME/.snowsql/config
name: 'Write .snowsql/config file'
shell: bash
env:
SNOW_CONFIG: ${{secrets.SNOW_CONFIG}}
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v0'
Expand All @@ -28,7 +43,7 @@ jobs:
- name: Gradle build and test
uses: gradle/gradle-build-action@v2
with:
arguments: build validatePlugin functionalTest integrationTest buildDashboard
arguments: build validatePlugin functionalTest integrationTest buildDashboard --scan

- name: Publish tests
uses: mikepenz/action-junit-report@v3
Expand Down
19 changes: 15 additions & 4 deletions .github/workflows/gradle-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,22 @@ jobs:
with:
fetch-depth: 0

- run: 'echo "$GRADLE_PROPERTIES" >> gradle.properties'
- run: |
mkdir -p $HOME/.gradle
echo "$GRADLE_PROPERTIES" > $HOME/.gradle/gradle.properties
name: 'Write gradle.properties file'
shell: bash
env:
GRADLE_PROPERTIES: ${{secrets.GRADLE_PROPERTIES}}
- run: |
mkdir -p $HOME/.snowsql
echo "$SNOW_CONFIG" > $HOME/.snowsql/config
name: 'Write .snowsql/config file'
shell: bash
env:
SNOW_CONFIG: ${{secrets.SNOW_CONFIG}}
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v0'
Expand All @@ -34,17 +45,17 @@ jobs:
- name: Gradle release
uses: gradle/gradle-build-action@v2
with:
arguments: release -Prelease.disableChecks -Prelease.localOnly
arguments: release -Prelease.disableChecks -Prelease.localOnly --scan

- name: Gradle build and test
uses: gradle/gradle-build-action@v2
with:
arguments: build validatePlugin functionalTest integrationTest buildDashboard
arguments: build validatePlugin functionalTest integrationTest buildDashboard --scan

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

- name: Publish tests
uses: mikepenz/action-junit-report@v3
Expand Down
7 changes: 7 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ allprojects {
project.version = scmVersion.version
}

if (hasProperty('buildScan')) {
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
}
}

scmVersion {
tag {
prefix = 'v'
Expand Down
9 changes: 9 additions & 0 deletions echo-environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

echo "GITHUB_RUN_ID $GITHUB_RUN_ID"
echo "GITHUB_EVENT_NAME $GITHUB_EVENT_NAME"
echo "GITHUB_SHA $GITHUB_SHA"
echo "GITHUB_REF $GITHUB_REF"
echo "GITHUB_HEAD_REF $GITHUB_HEAD_REF"
echo "GITHUB_BASE_REF $GITHUB_BASE_REF"
echo "GITHUB_REPOSITORY $GITHUB_REPOSITORY"
1 change: 0 additions & 1 deletion examples/external-stage/settings.gradle

This file was deleted.

1 change: 0 additions & 1 deletion examples/groovy-jar/settings.gradle

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repositories {
}

dependencies {
implementation 'org.codehaus.groovy:groovy:3.0.16'
implementation 'org.codehaus.groovy:groovy:3.0.17'
}

java {
Expand All @@ -19,13 +19,7 @@ java {
}

snowflake {
// All the following options are provided in my local gradle.properties file
// url = <snowflake account url>
// user = <snowflake user>
// password = <snowflake password>
role = 'stewart_role'
database = 'stewart_db'
schema = 'developer'
connection = 'gradle_plugin'
stage = 'upload'
applications {
add_numbers {
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions examples/kotlin-jar/gradlew → examples/groovy/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions examples/groovy/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rootProject.name = 'groovy'
// ignore this: used for testing examples during releases
includeBuild('../../')
1 change: 0 additions & 1 deletion examples/internal-stage/settings.gradle

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,8 @@ java {
}

snowflake {
// All the following options are provided in my local gradle.properties file
// url = <snowflake account url>
// user = <snowflake user>
// password = <snowflake password>
// publishUrl = <S3 bucket and path>
role = 'stewart_role'
database = 'stewart_db'
schema = 'developer'
stage = 'maven'
connection = 'gradle_plugin'
stage = 's3_maven'
groupId = 'io.github.stewartbryson'
artifactId = 'sample-udfs'
applications {
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions examples/java-external-stage/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rootProject.name = 'java-external-stage'
// ignore this: used for testing examples during releases
includeBuild('../../')
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ 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)
Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions examples/java-manual/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'java-manual'
63 changes: 63 additions & 0 deletions examples/java-testing/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
plugins {
id 'java'
id 'groovy' // needed for Spock testing framework
id 'io.github.stewartbryson.snowflake' version '1.1.4'
id 'com.adarshr.test-logger' version '3.2.0' // added for testing
id 'com.github.ben-manes.versions' version '0.46.0'
}

repositories {
mavenCentral()
gradlePluginPortal() // added for functionalTest dependency
}

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

snowflake {
connection = 'gradle_plugin'
stage = 'upload'
// Explained in the Ephemeral Cloning section
useEphemeral = project.snowflake.isCI() // use ephemeral with CICD workflows
keepEphemeral = project.snowflake.isPR() // keep ephemeral for PRs
applications {
add_numbers {
inputs = ["a integer", "b integer"]
returns = "string"
handler = "Sample.addNum"
}
}
}

// Explained in the Testing section
testing {
suites {
test {
useSpock('2.3-groovy-3.0')
}
functionalTest(JvmTestSuite) {
targets {
all {
useSpock('2.3-groovy-3.0')
dependencies {
implementation "io.github.stewartbryson:gradle-snowflake-plugin:1.1.4"
}
testTask.configure {
failFast true
// which SnowSQL connection to use
systemProperty 'connection', project.snowflake.connection
// if this is ephemeral, the test spec needs the name to connect to
if (project.snowflake.useEphemeral) {
systemProperty 'ephemeralName', snowflake.ephemeralName
}
}
}
}
}
}
}

version='0.1.0'
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions examples/simple-jar/gradlew → examples/java-testing/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions examples/java-testing/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rootProject.name = 'java-testing'
// ignore this: used for testing examples during releases
includeBuild('../../')
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import groovy.util.logging.Slf4j
import io.github.stewartbryson.SnowflakeSpec

/**
* The SnowflakeSpec used for testing functions.
*/
@Slf4j
class SnowflakeSampleTest extends SnowflakeSpec {

def 'ADD_NUMBERS() function with 1 and 2'() {
when: "Two numbers exist"
def one = 1
def two = 2

then: 'Add two numbers using ADD_NUMBERS()'
selectSingleValue("select add_numbers($one,$two);") == 'Sum is: 3'
}

def 'ADD_NUMBERS() function with 3 and 4'() {
when: "Two numbers exist"
def three = 3
def four = 4

then: 'Add two numbers using ADD_NUMBERS()'
selectSingleValue("select add_numbers($three,$four);") == 'Sum is: 7'
}

}
25 changes: 25 additions & 0 deletions examples/java-testing/src/test/groovy/SampleTest.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import spock.lang.Shared
import spock.lang.Specification
import spock.lang.Subject

class SampleTest extends Specification {
@Shared
@Subject
def sample = new Sample()

def "adding 1 and 2"() {
when: "Two numbers"
def one = 1
def two = 2
then: "Add numbers"
sample.addNum(one, two) == "Sum is: 3"
}

def "adding 3 and 4"() {
when: "Two numbers"
def one = 3
def two = 4
then: "Add numbers"
sample.addNum(one, two) == "Sum is: 7"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@ java {
}

snowflake {
// All the following options are provided in my local gradle.properties file
// url = <snowflake account url>
// user = <snowflake user>
// password = <snowflake password>
role = 'stewart_role'
database = 'stewart_db'
schema = 'developer'
connection = 'gradle_plugin'
stage = 'upload'
applications {
add_numbers {
Expand Down
Binary file added examples/java/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions examples/java/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 0459788

Please sign in to comment.