-
Notifications
You must be signed in to change notification settings - Fork 57
docs: CI test scripts and user offboarding #1349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hugocasa
wants to merge
2
commits into
main
Choose a base branch
from
docs/ci-tests-and-offboarding
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| --- | ||
| slug: ci-test-scripts | ||
| title: Automatically test scripts and flows on deploy | ||
| tags: ['Scripts', 'Flows'] | ||
| description: Write test scripts that run automatically every time the script or flow they cover is deployed. | ||
| version: v1.681.0 | ||
| features: | ||
| [ | ||
| 'Add a "// test: script/path" annotation to turn any script into a test for another script or flow', | ||
| 'Tests run automatically every time the target is deployed', | ||
| 'Results (pass/fail/running) shown on script and flow detail pages', | ||
| 'CI badges and summary on workspace fork comparison page', | ||
| 'Built-in test templates for TypeScript and Python' | ||
| ] | ||
| docs: /docs/advanced/ci_tests | ||
| --- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| --- | ||
| slug: user-offboarding | ||
| title: Reassign a user's items when removing them | ||
| tags: ['User management'] | ||
| description: When removing a user, reassign all their scripts, flows, apps, resources, schedules, and triggers to another user or folder so nothing breaks. | ||
| version: v1.681.0 | ||
| features: | ||
| [ | ||
| 'Preview everything owned by the user before taking action', | ||
| 'Reassign all items to another user or folder in one step', | ||
| 'Reassign-only mode to transfer ownership without removing the user', | ||
| 'Conflicts are detected and blocked before anything is moved', | ||
| 'Instance-level offboarding across all workspaces from superadmin settings' | ||
| ] | ||
| docs: /docs/core_concepts/roles_and_permissions#user-offboarding | ||
| --- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| --- | ||
| description: How do I set up CI tests in Windmill? Write test scripts that automatically run when the tested script or flow is deployed. | ||
| --- | ||
|
|
||
| import DocCard from '@site/src/components/DocCard'; | ||
|
|
||
| # CI test scripts | ||
|
|
||
| Add a `test:` annotation at the top of any script to turn it into a CI test. When the tested [script](../../getting_started/0_scripts_quickstart/index.mdx) or [flow](../../getting_started/6_flows_quickstart/index.mdx) is deployed, the test runs automatically. | ||
|
|
||
| ## Writing a test script | ||
|
|
||
| ### Single target | ||
|
|
||
| ```typescript | ||
| // test: script/u/admin/my_script | ||
| import * as wmill from "windmill-client"; | ||
|
|
||
| export async function main() { | ||
| const result = await wmill.runScript("u/admin/my_script", {}); | ||
|
|
||
| if (result !== 42) { | ||
| throw new Error(`Expected 42, got ${JSON.stringify(result)}`); | ||
| } | ||
|
|
||
| return result; | ||
| } | ||
| ``` | ||
|
|
||
| ### Multiple targets | ||
|
|
||
| ```typescript | ||
| // test: | ||
| // script/u/admin/script_a | ||
| // script/u/admin/script_b | ||
| // flow/u/admin/my_flow | ||
| import * as wmill from "windmill-client"; | ||
|
|
||
| export async function main() { | ||
| // test all items | ||
| } | ||
| ``` | ||
|
|
||
| ### Python | ||
|
|
||
| ```python | ||
| # test: script/u/admin/my_script | ||
| import wmill | ||
|
|
||
| def main(): | ||
| result = wmill.run_script("u/admin/my_script", {}) | ||
| assert result == 42 | ||
| return result | ||
| ``` | ||
|
|
||
| The annotation uses the comment syntax of each language (`//` for TypeScript, `#` for Python, etc.). | ||
|
|
||
| The script creation page also provides ready-made CI test templates for TypeScript and Python. | ||
|
|
||
| ## Where results appear | ||
|
|
||
| Test scripts show a yellow **CI test** badge in the script list and detail page. | ||
|
|
||
| On the detail page of the tested script or flow, each test is listed with its status (pass, fail, or running) and a link to the job run. Results auto-refresh while tests are running. | ||
|
|
||
| In [workspace forks](../20_workspace_forks/index.mdx), CI results are also visible: | ||
|
|
||
| - The fork banner shows a summary of passing, failing, and running tests across all changed items. | ||
| - On the [comparison page](../20_workspace_forks/index.mdx#merge-workspaces-from-the-ui-merge-ui), each changed item displays a CI badge, and a test summary lists all test scripts with their latest results. | ||
|
|
||
| <div className="grid grid-cols-2 gap-6 mb-4"> | ||
| <DocCard | ||
| title="Deploy to prod" | ||
| description="Set up staging/prod environments with Git-based deployment and workspace forks." | ||
| href="/docs/advanced/deploy_to_prod" | ||
| /> | ||
| <DocCard | ||
| title="Workspace forks" | ||
| description="Create independent copies of a workspace for parallel development workflows." | ||
| href="/docs/advanced/workspace_forks" | ||
| /> | ||
| </div> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add a bit of text