From 53efca1fb11ff073f6017eb358a5b3c6ad8e6264 Mon Sep 17 00:00:00 2001 From: Zane Clark Date: Mon, 18 Nov 2024 14:03:00 -0800 Subject: [PATCH] docs: clarify integration test seup --- .github/CONTRIBUTING.md | 27 +++++++++++++++++---------- .github/workflows/master-pytest.yml | 2 +- demo/README.MD | 21 +++++++++++++-------- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index a7bd6ad..d4d275b 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -7,7 +7,8 @@ operating environment, schemachange version and python version. Whenever possibl also include a brief, self-contained code example that demonstrates the problem. We have -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. +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. ## Contributing code @@ -22,8 +23,6 @@ Thank you for your interest in contributing code to schemachange! ### Guide to contributing to schemachange -> **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. - 1. If you are a first-time contributor + Go to [Snowflake-Labs/Schemachange](https://github.com/Snowflake-Labs/schemachange) and click the "fork" button to create your own copy of the project. @@ -53,8 +52,8 @@ Thank you for your interest in contributing code to schemachange! + [Pull](https://github.com/git-guides/git-pull) the latest changes from upstream, including tags: ```shell - git checkout main - git pull upstream main --tags + git checkout master + git pull upstream master --tags ``` 2. Create and Activate a Virtual Environment @@ -98,24 +97,32 @@ Thank you for your interest in contributing code to schemachange! + Commit locally as you progress ( [git add](https://github.com/git-guides/git-add) and [git commit](https://github.com/git-guides/git-commit) ). Use a properly formatted commit message. Be sure to - document any changed behavior in the [CHANGELOG.md](../CHANGELOG.md) file to help us collate the changes for a specific release. + document any changed behavior in the [CHANGELOG.md](../CHANGELOG.md) file to help us collate the changes for a + specific release. 4. Test your contribution locally ```bash python -m pytest ``` - PS: Please add test cases to the features you are developing so that over time, we can capture any lapse in functionality changes. + PS: Please add test cases to the features you are developing so that over time, we can capture any lapse in + functionality changes. + +5. Perform integration tests on your branch from your fork + - Follow the [provisioning and schemachange setup instructions](../demo/README.MD) to configure your Snowflake + account for testing. + - Follow [these](https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-workflow-runs/manually-running-a-workflow) + instructions to manually run the `master-pytest` workflow on your fork of the repo, targeting your feature branch. -5. Push your contribution to GitHub +6. Push your contribution to GitHub - [Push](https://github.com/git-guides/git-push) your changes back to your fork on GitHub + [Push](https://github.com/git-guides/git-push) your changes back to your fork on GitHub ```shell git push origin update-build-library-dependencies ``` -6. Raise a Pull Request to merge your contribution into the a Schemachange Release +7. Raise a Pull Request to merge your contribution into the a Schemachange Release + Go to GitHub. The new branch will show up with a 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) button. Make sure the title and message are clear, concise and self-explanatory. Then click the button to submit diff --git a/.github/workflows/master-pytest.yml b/.github/workflows/master-pytest.yml index 385403e..027a09e 100644 --- a/.github/workflows/master-pytest.yml +++ b/.github/workflows/master-pytest.yml @@ -88,7 +88,7 @@ jobs: echo "::endgroup::" echo "::group::Testing Rendering to ${MY_TARGET_SCHEMA}" - + schemachange render \ --config-folder ./demo/${SCENARIO_NAME} \ ./demo/${SCENARIO_NAME}/2_test/A__render.sql diff --git a/demo/README.MD b/demo/README.MD index a36dadf..f67b2f3 100644 --- a/demo/README.MD +++ b/demo/README.MD @@ -5,7 +5,7 @@ to see how schemachange works with the main feature set. For the contributor, wh codebase, this will serve as a basis to test the PR against your own snowflake account to ensure your code change does not break any existing functionality. -## Prerequisite +## Prerequisites - You will need your own snowflake Account to test the Demo - Both as a contributor and consumer. - You will need to review and run statements in the provision folder or set up your own database and schema. @@ -43,14 +43,19 @@ the demo DDL scripts. ### Contributors -As a contributor, you will have to set up schemachange demo database and schemachange schema (See Initialize and Setup -scripts below). Along with that you will also set up the following Secrets in your forked repository so that the GitHub -actions can set up, test and teardown the temporary schema it creates to test the changes to your code in the master and -dev branches respectively. +1. Execute the [initialize.sql](provision/initialize.sql) + and [setup_schemachange_schema.sql](provision/setup_schemachange_schema.sql) scripts to create up a + `SCHEMACHANGE_DEMO` + database and `SCHEMACHANGE` schema (See [Prerequisites](#prerequisites)). -- SCHEMACHANGE_SNOWFLAKE_PASSWORD -- SCHEMACHANGE_SNOWFLAKE_USER -- SCHEMACHANGE_SNOWFLAKE_ACCOUNT +2. Create the + following [GitHub Action Secrets](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions) + in your forked repository. GitHub will use these actions to set up and teardown the temporary schema(s) it creates to + test your code. + + - `SCHEMACHANGE_SNOWFLAKE_PASSWORD` + - `SCHEMACHANGE_SNOWFLAKE_USER` + - `SCHEMACHANGE_SNOWFLAKE_ACCOUNT` # Setup