Skip to content

Commit 29c6ccc

Browse files
Merge pull request #87 from stewartbryson/stewart
Testing matrixStrategy.
2 parents ec54bee + b1c1a07 commit 29c6ccc

File tree

4 files changed

+57
-12
lines changed

4 files changed

+57
-12
lines changed

.github/workflows/gradle-pr.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
name: Gradle build and test
4848
uses: gradle/gradle-build-action@v2
4949
with:
50-
arguments: build validatePlugin functionalTest integrationTest buildDashboard --scan
50+
arguments: build validatePlugin functionalTest integrationTest buildDashboard --scan -S
5151
cache-read-only: ${{ github.base_ref == 'main' }}
5252

5353
- id: publish_tests
@@ -58,14 +58,13 @@ jobs:
5858
report_paths: '**/build/test-results/**/TEST-*.xml'
5959

6060
run_example:
61-
if: ${{ false }} # disable for now
61+
#if: ${{ false }} # disable for now
6262
runs-on: ubuntu-latest
6363

6464
strategy:
6565
matrix:
66-
directory: [java, java-manual, java-external-stage, java-testing, groovy, scala, kotlin]
67-
fail-fast: true
68-
max-parallel: 1
66+
directory: [java, java-manual, java-testing, groovy, scala, kotlin]
67+
#directory: [java]
6968

7069
steps:
7170
# Should really make these reusable
@@ -92,5 +91,5 @@ jobs:
9291
- name: ${{ matrix.directory }}
9392
uses: gradle/gradle-build-action@v2
9493
with:
95-
arguments: matrixStrategy
94+
arguments: matrixStrategy -Psnowflake.useEphemeral=true -Psnowflake.keepEphemeral=true -S
9695
build-root-directory: examples/${{ matrix.directory }}

.github/workflows/gradle-publish.yml

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ env:
1111
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}
1212

1313
jobs:
14-
build:
14+
gradle_build:
1515
if: ${{ github.event.pull_request.merged }}
1616
runs-on: ubuntu-latest
1717

@@ -55,7 +55,7 @@ jobs:
5555
- name: Gradle publish
5656
uses: gradle/gradle-build-action@v2
5757
with:
58-
arguments: publish githubRelease publishDocs examples --scan -PgithubToken=${{secrets.GITHUB_TOKEN}}
58+
arguments: publish githubRelease publishDocs examples --scan -PgithubToken=${{secrets.GITHUB_TOKEN}} -S
5959

6060
- name: Publish tests
6161
uses: mikepenz/action-junit-report@v3
@@ -70,3 +70,40 @@ jobs:
7070
branch: main
7171
file_pattern: 'README.md examples/*.gradle'
7272
status_options: '--untracked-files=no'
73+
74+
run_example:
75+
#if: ${{ false }} # disable for now
76+
runs-on: ubuntu-latest
77+
78+
strategy:
79+
matrix:
80+
directory: [java, java-manual, java-testing, groovy, scala, kotlin]
81+
#directory: [java]
82+
83+
steps:
84+
# Should really make these reusable
85+
- uses: actions/checkout@v3
86+
87+
- id: gradle_properties
88+
run: |
89+
mkdir -p $HOME/.gradle
90+
echo "$GRADLE_PROPERTIES" > $HOME/.gradle/gradle.properties
91+
name: 'Write gradle.properties file'
92+
shell: bash
93+
env:
94+
GRADLE_PROPERTIES: ${{secrets.GRADLE_PROPERTIES}}
95+
96+
- id: snowsql_config
97+
run: |
98+
mkdir -p $HOME/.snowsql
99+
echo "$SNOW_CONFIG" > $HOME/.snowsql/config
100+
name: 'Write .snowsql/config file'
101+
shell: bash
102+
env:
103+
SNOW_CONFIG: ${{secrets.SNOW_CONFIG}}
104+
105+
- name: ${{ matrix.directory }}
106+
uses: gradle/gradle-build-action@v2
107+
with:
108+
arguments: matrixStrategy -Psnowflake.useEphemeral=true -S
109+
build-root-directory: examples/${{ matrix.directory }}

plugin/src/main/groovy/io/github/stewartbryson/CreateCloneTask.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ abstract class CreateCloneTask extends SnowflakeTask {
3333
} catch (Exception e) {
3434
throw new Exception("Creating ephemeral clone failed.", e)
3535
}
36-
log.warn "Ephemeral clone ${snowflake.ephemeral} created."
36+
log.warn "Ephemeral clone ${snowflake.ephemeral} created if not exists."
3737

3838
// Until we build a better testing spec, let downstream dependencies set this
3939
//snowflake.setEphemeralContext()

plugin/src/main/groovy/io/github/stewartbryson/SnowflakeJvm.groovy

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package io.github.stewartbryson
22

33
import com.snowflake.snowpark_java.PutResult
44
import groovy.util.logging.Slf4j
5+
import net.snowflake.client.jdbc.SnowflakeSQLException
56
import net.snowflake.client.jdbc.SnowflakeStatement
67
import org.gradle.api.tasks.CacheableTask
78
import org.gradle.api.tasks.Input
@@ -112,9 +113,17 @@ abstract class SnowflakeJvm extends SnowflakeTask {
112113
PARALLEL : '4',
113114
OVERWRITE : 'TRUE'
114115
]
115-
PutResult[] pr = snowflake.session.file().put(jar, "$stage/libs", options)
116-
pr.each {
117-
log.warn "File ${it.sourceFileName}: ${it.status}"
116+
try {
117+
PutResult[] pr = snowflake.session.file().put(jar, "$stage/libs", options)
118+
pr.each {
119+
log.warn "File ${it.sourceFileName}: ${it.status}"
120+
}
121+
} catch (SnowflakeSQLException e) {
122+
// this tells us there's misconfiguration
123+
// we are using an external stage without setting publishUrl
124+
if (e.message.contains("GET and PUT commands are not supported with external stage")) {
125+
throw new Exception("Using an external stage requires setting the 'publishUrl' property.")
126+
}
118127
}
119128
} else if (extension.publishUrl) {
120129
// ensure that the stage and the publishUrl are aligned

0 commit comments

Comments
 (0)