Skip to content

Commit 99ff357

Browse files
Merge pull request #303 from Snowflake-Labs/dev
fix: incorporating forked changes along with github actions updates
2 parents 871d7c7 + 02e101e commit 99ff357

File tree

71 files changed

+1950
-1543
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1950
-1543
lines changed

.github/CONTRIBUTING.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ operating environment, schemachange version and python version. Whenever possibl
77
also include a brief, self-contained code example that demonstrates the problem.
88

99
We have
10-
included [issue templates](https://github.com/Snowflake-Labs/schemachange/issues/new/choose) for reporting bugs, requesting features and seeking clarifications. Choose the appropriate issue template to contribute to the repository.
10+
included [issue templates](https://github.com/Snowflake-Labs/schemachange/issues/new/choose) for reporting bugs,
11+
requesting features and seeking clarifications. Choose the appropriate issue template to contribute to the repository.
1112

1213
## Contributing code
1314

@@ -22,8 +23,6 @@ Thank you for your interest in contributing code to schemachange!
2223

2324
### Guide to contributing to schemachange
2425

25-
> **IMPORTANT** : You will need to follow the [provisioning and schemachange setup instructions](../demo/README.MD) to ensure you can run GitHub actions against your Snowflake account before placing a PR with main schemachange repository so that your PR can be merged into schemachange master branch.
26-
2726
1. If you are a first-time contributor
2827
+ Go to [Snowflake-Labs/Schemachange](https://github.com/Snowflake-Labs/schemachange) and click the "fork" button to
2928
create your own copy of the project.
@@ -53,8 +52,8 @@ Thank you for your interest in contributing code to schemachange!
5352
+ [Pull](https://github.com/git-guides/git-pull) the latest changes from upstream, including tags:
5453

5554
```shell
56-
git checkout main
57-
git pull upstream main --tags
55+
git checkout master
56+
git pull upstream master --tags
5857
```
5958

6059
2. Create and Activate a Virtual Environment
@@ -98,24 +97,32 @@ Thank you for your interest in contributing code to schemachange!
9897

9998
+ Commit locally as you progress ( [git add](https://github.com/git-guides/git-add)
10099
and [git commit](https://github.com/git-guides/git-commit) ). Use a properly formatted commit message. Be sure to
101-
document any changed behavior in the [CHANGELOG.md](../CHANGELOG.md) file to help us collate the changes for a specific release.
100+
document any changed behavior in the [CHANGELOG.md](../CHANGELOG.md) file to help us collate the changes for a
101+
specific release.
102102

103103
4. Test your contribution locally
104104

105105
```bash
106106
python -m pytest
107107
```
108-
PS: Please add test cases to the features you are developing so that over time, we can capture any lapse in functionality changes.
108+
PS: Please add test cases to the features you are developing so that over time, we can capture any lapse in
109+
functionality changes.
110+
111+
5. Perform integration tests on your branch from your fork
112+
- Follow the [provisioning and schemachange setup instructions](../demo/README.MD) to configure your Snowflake
113+
account for testing.
114+
- Follow [these](https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-workflow-runs/manually-running-a-workflow)
115+
instructions to manually run the `master-pytest` workflow on your fork of the repo, targeting your feature branch.
109116

110-
5. Push your contribution to GitHub
117+
6. Push your contribution to GitHub
111118

112-
[Push](https://github.com/git-guides/git-push) your changes back to your fork on GitHub
119+
[Push](https://github.com/git-guides/git-push) your changes back to your fork on GitHub
113120

114121
```shell
115122
git push origin update-build-library-dependencies
116123
```
117124

118-
6. Raise a Pull Request to merge your contribution into the a Schemachange Release
125+
7. Raise a Pull Request to merge your contribution into the a Schemachange Release
119126
+ Go to GitHub. The new branch will show up with a
120127
green [Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests#initiating-the-pull-request)
121128
button. Make sure the title and message are clear, concise and self-explanatory. Then click the button to submit

.github/workflows/dev-pytest.yml

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -54,35 +54,22 @@ jobs:
5454
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
5555
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
5656
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
57+
- name: Create and populate connections.toml
58+
run: |
59+
echo "Current Directory: ${PWD}"
60+
echo "GITHUB WORKSPACE: ${GITHUB_WORKSPACE}"
61+
chmod +x populateConnection.sh
62+
bash populateConnection.sh
63+
working-directory: .
5764
- name: Test with pytest
5865
id: pytest
5966
run: |
6067
pytest
6168
# Testing Schemachange demo projects
6269
- name: Test Schemachange on ${{ matrix.os }} targeting ${{ env.SNOWFLAKE_DATABASE }}.${{ env.MY_TARGET_SCHEMA }} schema
6370
run: |
64-
echo "::group::Setting up ${MY_TARGET_SCHEMA}"
65-
schemachange deploy --config-folder ./demo/setup/${SCENARIO_NAME}
66-
echo "::endgroup::"
67-
echo "::group::Testing Rendering to ${MY_TARGET_SCHEMA}"
68-
schemachange render --config-folder ./demo/${SCENARIO_NAME} ./demo/${SCENARIO_NAME}/A__render.sql
69-
schemachange render --config-folder ./demo/${SCENARIO_NAME} ./demo/${SCENARIO_NAME}/R__render.sql
70-
schemachange render --config-folder ./demo/${SCENARIO_NAME} ./demo/${SCENARIO_NAME}/V1.0.0__render.sql
71-
echo "::endgroup::"
72-
echo "::group::Testing Deployment using ${MY_TARGET_SCHEMA}"
73-
set +e
74-
schemachange deploy --config-folder ./demo/${SCENARIO_NAME}
75-
RESULT=$?
76-
if [ $RESULT -eq 0 ]; then
77-
echo "Deployment Completed!"
78-
else
79-
echo "Deployment Failed. Proceeding to Teardown."
80-
fi
81-
echo "::endgroup::"
82-
set -e
83-
echo "::group::Tearing down up ${MY_TARGET_SCHEMA}"
84-
schemachange deploy --config-folder ./demo/teardown/${SCENARIO_NAME}
85-
echo "::endgroup::"
86-
if [ $RESULT -ne 0 ]; then
87-
exit 1
88-
fi
71+
echo "Current Directory: ${PWD}"
72+
echo "GITHUB WORKSPACE: ${GITHUB_WORKSPACE}"
73+
chmod +x testSchemachange.sh
74+
bash testSchemachange.sh
75+
working-directory: .

.github/workflows/master-pytest.yml

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ jobs:
2929
runs-on: ${{ matrix.os }}
3030
if: ${{ github.event.label.name == 'ci-run-tests' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
3131
env:
32-
SNOWFLAKE_PASSWORD: ${{ secrets.SCHEMACHANGE_SNOWFLAKE_PASSWORD }}
33-
SNOWFLAKE_USER: ${{ secrets.SCHEMACHANGE_SNOWFLAKE_USER }}
3432
SNOWFLAKE_ACCOUNT: ${{ secrets.SCHEMACHANGE_SNOWFLAKE_ACCOUNT }}
35-
SNOWFLAKE_DATABASE: SCHEMACHANGE_DEMO
36-
SNOWFLAKE_WAREHOUSE: SCHEMACHANGE_DEMO_WH
33+
SNOWFLAKE_USER: ${{ secrets.SCHEMACHANGE_SNOWFLAKE_USER }}
3734
SNOWFLAKE_ROLE: SCHEMACHANGE_DEMO-DEPLOY
35+
SNOWFLAKE_WAREHOUSE: SCHEMACHANGE_DEMO_WH
36+
SNOWFLAKE_DATABASE: SCHEMACHANGE_DEMO
3837
MY_TARGET_SCHEMA: ${{ matrix.scenario-name }}_${{ github.run_number }}_${{ strategy.job-index }}
38+
SNOWFLAKE_PASSWORD: ${{ secrets.SCHEMACHANGE_SNOWFLAKE_PASSWORD }}
3939
SCENARIO_NAME: ${{ matrix.scenario-name }}
4040
steps:
4141
- uses: actions/checkout@v4
@@ -58,35 +58,22 @@ jobs:
5858
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
5959
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
6060
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
61+
- name: Create and populate connections.toml
62+
run: |
63+
echo "Current Directory: ${PWD}"
64+
echo "GITHUB WORKSPACE: ${GITHUB_WORKSPACE}"
65+
chmod +x populateConnection.sh
66+
bash populateConnection.sh
67+
working-directory: .
6168
- name: Test with pytest
6269
id: pytest
6370
run: |
6471
pytest
6572
# Testing Schemachange demo projects
6673
- name: Test Schemachange on ${{ matrix.os }} targeting ${{ env.SNOWFLAKE_DATABASE }}.${{ env.MY_TARGET_SCHEMA }} schema
6774
run: |
68-
echo "::group::Setting up ${MY_TARGET_SCHEMA}"
69-
schemachange deploy --config-folder ./demo/setup/${SCENARIO_NAME}
70-
echo "::endgroup::"
71-
echo "::group::Testing Rendering to ${MY_TARGET_SCHEMA}"
72-
schemachange render --config-folder ./demo/${SCENARIO_NAME} ./demo/${SCENARIO_NAME}/A__render.sql
73-
schemachange render --config-folder ./demo/${SCENARIO_NAME} ./demo/${SCENARIO_NAME}/R__render.sql
74-
schemachange render --config-folder ./demo/${SCENARIO_NAME} ./demo/${SCENARIO_NAME}/V1.0.0__render.sql
75-
echo "::endgroup::"
76-
echo "::group::Testing Deployment using ${MY_TARGET_SCHEMA}"
77-
set +e
78-
schemachange deploy --config-folder ./demo/${SCENARIO_NAME}
79-
RESULT=$?
80-
if [ $RESULT -eq 0 ]; then
81-
echo "Deployment Completed!"
82-
else
83-
echo "Deployment Failed. Proceeding to Teardown."
84-
fi
85-
echo "::endgroup::"
86-
set -e
87-
echo "::group::Tearing down up ${MY_TARGET_SCHEMA}"
88-
schemachange deploy --config-folder ./demo/teardown/${SCENARIO_NAME}
89-
echo "::endgroup::"
90-
if [ $RESULT -ne 0 ]; then
91-
exit 1
92-
fi
75+
echo "Current Directory: ${PWD}"
76+
echo "GITHUB WORKSPACE: ${GITHUB_WORKSPACE}"
77+
chmod +x testSchemachange.sh
78+
bash testSchemachange.sh
79+
working-directory: .

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ All notable changes to this project will be documented in this file.
77
### Added
88
- Use of `structlog~=24.1.0` for standard log outputs
99
- Verified Schemachange against Python 3.12
10+
- Support for connections.toml configurations
11+
- Support for supplying the authenticator, private key path, token path, connections file path, and connection name via the YAML and command-line configurations.
1012

1113
### Changed
1214
- Refactored the main cli.py into multiple modules - config, session.
1315
- Updated contributing guidelines and demo readme content to help contributors setup local snowflake account to run the github actions in their fork before pushing the PR to upstream repository.
1416
- Removed tests against Python 3.8 [End of Life on 2024-10-07](https://devguide.python.org/versions/#supported-versions)
15-
17+
- Command-line vars are now merged into YAML vars instead of overwriting them entirely
1618

1719
## [3.7.0] - 2024-07-22
1820
### Added

0 commit comments

Comments
 (0)