Skip to content

Commit

Permalink
Merge pull request #95 from stewartbryson/stewart
Browse files Browse the repository at this point in the history
Actions.
  • Loading branch information
stewartbryson authored May 22, 2023
2 parents fe8c7ca + a58fab9 commit 2d6e46e
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,5 @@ jobs:
- name: ${{ matrix.directory }}
uses: gradle/[email protected]
with:
arguments: matrixStrategy -Psnowflake.useEphemeral=true -Psnowflake.keepEphemeral=true -S
arguments: matrixStrategy -Psnowflake.useEphemeral=true -S
build-root-directory: examples/${{ matrix.directory }}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "com.github.ben-manes.versions" version "0.46.0"
id "pl.allegro.tech.build.axion-release" version "1.15.0"
id "pl.allegro.tech.build.axion-release" version "1.15.1"
id "com.github.breadmoirai.github-release" version "2.4.1"
id "build-dashboard"
id 'idea'
Expand Down
48 changes: 24 additions & 24 deletions examples/java-testing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,29 @@ plugins {
}

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

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

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

// Explained in the Testing section
Expand All @@ -43,14 +43,14 @@ testing {
all {
useSpock('2.3-groovy-3.0')
dependencies {
implementation "io.github.stewartbryson:gradle-snowflake-plugin:2.0.14"
implementation "io.github.stewartbryson:gradle-snowflake-plugin:2.0.13"
}
testTask.configure {
failFast true
// which SnowSQL connection to use
systemProperty 'connection', snowflake.connection
// if this is ephemeral, the test spec needs the name to connect to
if (snowflake.useEphemeral) {
if (project.snowflake.useEphemeral) {
systemProperty 'ephemeralName', snowflake.ephemeralName
}
}
Expand All @@ -60,13 +60,13 @@ testing {
}
}

version='0.1.0'
version = '0.1.0'

// empty task for matrix strategy execution in GitHub Actions
// please ignore
afterEvaluate {
tasks.register('matrixStrategy') {
description 'Empty task for matrix strategy execution in GitHub Actions.'
dependsOn functionalTest
}
tasks.register('matrixStrategy') {
description 'Empty task for matrix strategy execution in GitHub Actions.'
dependsOn functionalTest, dropEphemeral
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ class SnowflakePlugin implements Plugin<Project> {
// if there is a functionalTest defined, it depends on snowflakeJvm
if (project.tasks.findByName(extension.testSuite)) {
project.tasks."${extension.testSuite}".dependsOn project.tasks.snowflakeJvm
// in case the tasks are called directly
project.tasks."${extension.testSuite}".mustRunAfter project.tasks.createEphemeral
project.tasks.dropEphemeral.mustRunAfter project.tasks."${extension.testSuite}"
}

// if an ephemeral environment is being used, then some tasks need dependencies
Expand All @@ -115,7 +118,7 @@ class SnowflakePlugin implements Plugin<Project> {
// snowflakeJvm should always run when using ephemeral clones
// that's because the clone may be dropped at the end of the last run
//TODO #88
outputs.upToDateWhen {false}
outputs.upToDateWhen { false }
// clone should be created before publishing
dependsOn project.tasks.createEphemeral
}
Expand Down
4 changes: 2 additions & 2 deletions src/examples/java-testing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ snowflake {
connection = 'gradle_plugin'
stage = 'upload'
// Explained in the Ephemeral Cloning section
useEphemeral = snowflake.isCI() // use ephemeral with CICD workflows
useEphemeral = snowflake.isCI() // use ephemeral with CI/CD workflows
keepEphemeral = snowflake.isPR() // keep ephemeral for PRs
applications {
add_numbers {
Expand Down Expand Up @@ -67,6 +67,6 @@ version='0.1.0'
afterEvaluate {
tasks.register('matrixStrategy') {
description 'Empty task for matrix strategy execution in GitHub Actions.'
dependsOn functionalTest
dependsOn functionalTest, dropEphemeral
}
}

0 comments on commit 2d6e46e

Please sign in to comment.