Skip to content

Commit b1c1a07

Browse files
committed
Testing matrixStrategy.
1 parent 9679a54 commit b1c1a07

File tree

3 files changed

+52
-47
lines changed

3 files changed

+52
-47
lines changed

.github/workflows/gradle-pr.yml

Lines changed: 3 additions & 5 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
@@ -63,10 +63,8 @@ jobs:
6363

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

7169
steps:
7270
# Should really make these reusable
@@ -93,5 +91,5 @@ jobs:
9391
- name: ${{ matrix.directory }}
9492
uses: gradle/gradle-build-action@v2
9593
with:
96-
arguments: matrixStrategy -Psnowflake.useEphemeral=true -Psnowfalke.keepEphemeral=true
94+
arguments: matrixStrategy -Psnowflake.useEphemeral=true -Psnowflake.keepEphemeral=true -S
9795
build-root-directory: examples/${{ matrix.directory }}

.github/workflows/gradle-publish.yml

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -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
@@ -71,41 +71,39 @@ jobs:
7171
file_pattern: 'README.md examples/*.gradle'
7272
status_options: '--untracked-files=no'
7373

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-external-stage, java-testing, groovy, scala, kotlin]
81-
#directory: [ java ]
82-
fail-fast: true
83-
max-parallel: 1
84-
85-
steps:
86-
# Should really make these reusable
87-
- uses: actions/checkout@v3
88-
89-
- id: gradle_properties
90-
run: |
91-
mkdir -p $HOME/.gradle
92-
echo "$GRADLE_PROPERTIES" > $HOME/.gradle/gradle.properties
93-
name: 'Write gradle.properties file'
94-
shell: bash
95-
env:
96-
GRADLE_PROPERTIES: ${{secrets.GRADLE_PROPERTIES}}
97-
98-
- id: snowsql_config
99-
run: |
100-
mkdir -p $HOME/.snowsql
101-
echo "$SNOW_CONFIG" > $HOME/.snowsql/config
102-
name: 'Write .snowsql/config file'
103-
shell: bash
104-
env:
105-
SNOW_CONFIG: ${{secrets.SNOW_CONFIG}}
106-
107-
- name: ${{ matrix.directory }}
108-
uses: gradle/gradle-build-action@v2
109-
with:
110-
arguments: matrixStrategy -Psnowflake.useEphemeral=true
111-
build-root-directory: examples/${{ matrix.directory }}
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/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)