-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pipeline for CLI + NA integration tests
- Loading branch information
1 parent
9693c6f
commit 86f3d9d
Showing
12 changed files
with
148 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: 'Modified Apps' | ||
description: 'Gets the modified apps root folder' | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Get changed files | ||
id: changed-files-step | ||
run: $GITHUB_ACTION_PATH/modified_files.sh | ||
shell: bash | ||
env: | ||
GITHUB_ACTION_PATH: ${{ github.action_path }} | ||
GITHUB_EVENT_NAME: ${{ github.event_name }} | ||
GITHUB_EVENT_BEFORE: ${{ github.event.before }} | ||
GITHUB_EVENT_AFTER: ${{ github.event.after }} | ||
- name: Get changed apps | ||
uses: actions/github-script@v7 | ||
id: changed-apps-step | ||
env: | ||
CHANGED_FILES: ${{ steps.changed-files-step.outputs.changed_files }} | ||
with: | ||
script: | | ||
const { CHANGED_FILES } = process.env; | ||
const paths = new Set(CHANGED_FILES.split(" ") | ||
.map(x => x.substring(0, x.indexOf("/") + 1)) | ||
.filter(x => x.length > 0 && !x.startsWith('.'))); | ||
core.setOutput('changedApps', [...paths].join(',')); | ||
outputs: | ||
modified_apps: | ||
description: 'The modified apps folders.' | ||
value: ${{ steps.changed-apps-step.outputs.changedApps }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
if [ $GITHUB_EVENT_NAME == 'pull_request' ]; then | ||
echo "changed_files=$(git diff --name-only -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT | ||
else | ||
echo "changed_files=$(git diff --name-only $GITHUB_EVENT_BEFORE $GITHUB_EVENT_AFTER | xargs)" >> $GITHUB_OUTPUT | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: native-app-examples-integration | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- edited | ||
- labeled | ||
- unlabeled | ||
- synchronize | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
SNOWFLAKE_CONNECTIONS_DEFAULT_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }} | ||
SNOWFLAKE_CONNECTIONS_DEFAULT_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }} | ||
SNOWFLAKE_CONNECTIONS_DEFAULT_USER: ${{ secrets.SNOWFLAKE_USER }} | ||
SNOWFLAKE_CONNECTIONS_DEFAULT_ROLE: ${{ secrets.SNOWFLAKE_ROLE }} | ||
SNOWFLAKE_CONNECTIONS_DEFAULT_WAREHOSE: ${{ secrets.SNOWFLAKE_WAREHOUSE }} | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }} | ||
- name: Set PIPX_BIN_DIR # This step will be removed after fixing a bug in snowflake-cli-action@v1 | ||
run: echo "PIPX_BIN_DIR=$HOME/.local/bin" >> $GITHUB_ENV | ||
- name: Get modified apps | ||
id: modified-apps-step | ||
uses: ./.github/actions/modified_apps | ||
- name: Set up Snowflake CLI | ||
uses: Snowflake-Labs/[email protected] | ||
with: | ||
cli-version: "latest" | ||
default-config-file-path: "config.toml" | ||
- name: Verify Snowflake Connection | ||
run: | | ||
snow --version | ||
snow connection test | ||
- name: Run Integration | ||
run: | | ||
set -e | ||
modified_apps=${{ steps.modified-apps-step.outputs.modified_apps }} | ||
IFS=',' read -ra modified_apps_array <<< "$modified_apps" | ||
for app in "${modified_apps_array[@]}"; do | ||
cd $app | ||
if [ -f ci.sh ]; then | ||
sh ci.sh | ||
else | ||
snow app run | ||
snow app teardown | ||
fi | ||
cd .. | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
snow sql -f 'prepare/references.sql' | ||
snow app run | ||
snow app teardown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
default_connection_name = "default" | ||
|
||
[connections] | ||
[connections.default] | ||
account = "" | ||
user = "" | ||
password = "" | ||
role = "" | ||
warehouse = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
sh prepare_data.sh | ||
snow app run | ||
snow app teardown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
snow sql -f 'prepare/provider.sql' | ||
snow app run | ||
snow app teardown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
sh setup.sh | ||
sh deploy.sh | ||
sh cleanup.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters