Skip to content

Commit

Permalink
docs: clarify integration test seup
Browse files Browse the repository at this point in the history
  • Loading branch information
Zane Clark committed Nov 18, 2024
1 parent c07f97c commit 53efca1
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 19 deletions.
27 changes: 17 additions & 10 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/master-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 13 additions & 8 deletions demo/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 53efca1

Please sign in to comment.