Skip to content

Pushing final changes for github actions changes #37

Pushing final changes for github actions changes

Pushing final changes for github actions changes #37

Workflow file for this run

name: dev-pytest
on:
push:
branches:
- dev
- release/**
workflow_dispatch:
pull_request:
types: [opened, reopened]
jobs:
build:
strategy:
fail-fast: false
matrix:
scenario-name: [ 'basics_demo', 'citibike_demo', 'citibike_demo_jinja']
os: ["ubuntu-latest", "windows-latest"]
python-version: ["3.11"]
runs-on: ${{ matrix.os }}
env:
SNOWFLAKE_PASSWORD: ${{ secrets.SCHEMACHANGE_SNOWFLAKE_PASSWORD }}
SNOWFLAKE_USER: ${{ secrets.SCHEMACHANGE_SNOWFLAKE_USER }}
SNOWFLAKE_ACCOUNT: ${{ secrets.SCHEMACHANGE_SNOWFLAKE_ACCOUNT }}
SNOWFLAKE_DATABASE: SCHEMACHANGE_DEMO
SNOWFLAKE_WAREHOUSE: SCHEMACHANGE_DEMO_WH
SNOWFLAKE_ROLE: SCHEMACHANGE_DEMO_DEPLOY
MY_TARGET_SCHEMA: ${{ matrix.scenario-name }}_${{ github.run_number }}_${{ strategy.job-index }}
SCENARIO_NAME: ${{ matrix.scenario-name }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Update pip
run: |
python -m pip install --upgrade pip
- name: Install dependencies
run: |
python -m pip install -e .[dev]
- name: Test with pytest
run: |
pytest
- name: Test Schemachange on ${{ matrix.os }} targeting ${{ env.SNOWFLAKE_DATABASE }}.${{ env.MY_TARGET_SCHEMA }} schema
if: ${{ matrix.os != 'windows-latest' }}
run: |
echo "::group::Setting up ${MY_TARGET_SCHEMA}"
schemachange deploy --config-folder ./demo/setup/${SCENARIO_NAME}
echo "::endgroup::"
echo "::group::Testing Rendering to ${MY_TARGET_SCHEMA}"
schemachange render --config-folder ./demo/${SCENARIO_NAME} ./demo/${SCENARIO_NAME}/A__render.sql
schemachange render --config-folder ./demo/${SCENARIO_NAME} ./demo/${SCENARIO_NAME}/R__render.sql
schemachange render --config-folder ./demo/${SCENARIO_NAME} ./demo/${SCENARIO_NAME}/V1.0.0__render.sql
echo "::endgroup::"
echo "::group::Testing Deployment using ${MY_TARGET_SCHEMA}"
schemachange deploy --config-folder ./demo/${SCENARIO_NAME}
echo "::endgroup::"
echo "::group::Tearing down up ${MY_TARGET_SCHEMA}"
schemachange deploy --config-folder ./demo/teardown/${SCENARIO_NAME}
echo "::endgroup::"
- name: Test Schemachange on ${{ matrix.os }} targeting ${{ env.SNOWFLAKE_DATABASE }}.${{ env.MY_TARGET_SCHEMA }} schema
if: ${{ matrix.os == 'windows-latest' }}
run: |
echo "::group::Setting up $Env:MY_TARGET_SCHEMA"
schemachange --config-folder "./demo/setup/$Env:SCENARIO_NAME"
echo "::endgroup::"
echo "::group::Testing Rendering to $Env:MY_TARGET_SCHEMA"
schemachange render --config-folder ./demo/$Env:SCENARIO_NAME ./demo/$Env:SCENARIO_NAME/A__render.sql
schemachange render --config-folder ./demo/$Env:SCENARIO_NAME ./demo/$Env:SCENARIO_NAME/R__render.sql
schemachange render --config-folder ./demo/$Env:SCENARIO_NAME ./demo/$Env:SCENARIO_NAME/V1.0.0__render.sql
echo "::endgroup::"
echo "::group::Testing Deployment using $Env:MY_TARGET_SCHEMA"
schemachange --config-folder "./demo/$Env:SCENARIO_NAME"
echo "::endgroup::"
echo "::group::Tearing down up $Env:MY_TARGET_SCHEMA"
schemachange --config-folder "./demo/teardown/$Env:SCENARIO_NAME"
echo "::endgroup::"