forked from Snowflake-Labs/snowpark-python-template
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (57 loc) · 1.89 KB
/
build-and-deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Deploy Snowpark UDFs and Stored Procs
on:
push:
branches:
- main
release:
types: [published]
workflow_dispatch:
env:
SNOWSQL_ACCOUNT: ${{ secrets.SNOWSQL_ACCOUNT }}
SNOWSQL_USER: ${{ secrets.SNOWSQL_USER }}
SNOWSQL_PWD: ${{ secrets.SNOWSQL_PWD }}
SNOWSQL_DATABASE: ${{ secrets.SNOWSQL_DATABASE }}
SNOWSQL_SCHEMA: ${{ secrets.SNOWSQL_SCHEMA }}
SNOWSQL_WAREHOUSE: ${{ secrets.SNOWSQL_WAREHOUSE }}
ARTIFACT_NAME: python-sources-${{ github.ref_name }}.zip
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v3
- name: Setup Conda
uses: conda-incubator/setup-miniconda@v2.2.0
with:
activate-environment: snowpark
environment-file: environment.yml
- name: Run tests
run: python -m pytest
- name: Create deployment artifact
run: zip -r ${{ env.ARTIFACT_NAME }} . -x .git/\*
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v2
with:
name: python-sources-${{ github.ref_name }}
path: ${{ env.ARTIFACT_NAME }}
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- name: Download artifact from build job
uses: actions/download-artifact@v2
with:
name: python-sources-${{ github.ref_name }}
- name: Install SnowSQL
run: |
curl -O https://sfc-repo.snowflakecomputing.com/snowsql/bootstrap/1.2/linux_x86_64/snowsql-1.2.24-linux_x86_64.bash
SNOWSQL_DEST=~/snowflake SNOWSQL_LOGIN_SHELL=~/.profile bash snowsql-1.2.24-linux_x86_64.bash
- name: Deploy jobs
run: |
~/snowflake/snowsql \
-f resources.sql \
-o variable_substitution=true \
--variable artifact_name=${{ env.ARTIFACT_NAME }}