Tool for Simulating Demo's, delivering Tutorials and using documentation as tests.
Перейти к файлу
jasonmesser7 a954e7f2f9
Update README.md
2022-12-12 14:53:59 -08:00
.devcontainer Add GitHub Actions + DevContainer, copy Dockerfile 2022-08-31 13:06:11 -07:00
.github/workflows Update 00-azure.yaml 2022-08-31 13:30:29 -07:00
demo_scripts Update README.md 2022-12-12 14:53:59 -08:00
js add the ability to intercept some commands. This allows, for example, xdg-open - opens a file or URL in the user's preferred application 2017-08-15 01:55:40 +00:00
novnc Start XTerm automatically 2017-07-19 06:35:04 +00:00
scripts don't build within a run, slows things down 2017-08-23 02:54:18 +00:00
style Add a broswer 'audience view' showing just the console' 2017-08-13 01:38:40 +00:00
templates Add a broswer 'audience view' showing just the console' 2017-08-13 01:38:40 +00:00
.gitignore ignore log files 2018-02-23 00:39:32 +00:00
Dockerfile Add GitHub Actions + DevContainer, copy Dockerfile 2022-08-31 13:06:11 -07:00
Dockerfile_cli explicitly set TERM as it is getting lost in CircleCI for some reason Fixes #77 2017-08-23 02:54:18 +00:00
Dockerfile_novnc standardize the pasword with NoVNC parent project to avoid confusion 2017-08-04 15:17:27 +00:00
GETTING_STARTED.md add a GETTING_STARTED doc for the impatient 2017-08-04 19:08:36 +00:00
LICENSE move to MIT in prep for a move of the code to an Azure repo 2017-08-07 19:13:49 +00:00
README.md Created a new tutorial which only has relevant information to those who want to get started with executable docs (#140) 2022-10-03 11:38:40 -07:00
SECURITY.md Microsoft mandatory file 2022-07-28 16:57:57 +00:00
cli.py More efficient and reliable tracking of prerequisites. (#67) 2017-09-10 22:51:34 -07:00
config.py turn off debug in the config file 2022-08-17 16:25:38 -07:00
demo.py More robust handling of language prompts. Fixes #123 2022-08-17 16:18:43 -07:00
env.json Improve handling of variables. Can now define them in parent of script, script directory or the directory the simdem command was run from 2017-06-23 06:47:19 +00:00
env.local.json Improve handling of variables. Can now define them in parent of script, script directory or the directory the simdem command was run from 2017-06-23 06:47:19 +00:00
environment.py More efficient and reliable tracking of prerequisites. (#67) 2017-09-10 22:51:34 -07:00
main.py Revert "Revert "Provide options for summary output in text and json format. Fixes #57."" 2017-09-08 07:08:58 -07:00
pre-commit.sh don't build docker containers on pre-commit 2017-08-12 05:52:27 +00:00
release_process.md start documenting release process see #31 2017-09-10 07:43:37 +00:00
requirements.txt Jamesser dev (#119) 2022-07-12 11:12:12 -07:00
web.py whitespace 2017-08-24 22:54:59 +00:00

README.md

Overview

NOTICE: SimDem is a proof of concept with lots of bugs. SimDem is undergoing a complete rewrite. As such, it is still in development and features may be removed or iterated on as we refine executable docs. If you are able to contribute, we want your help!

SimDem is an open source project that will provide tooling that empowers all people to write tutorials in markdown that then becomes interactive documentation. Simdem works with standard markdown language and can be combined with any tutorial which run bash commands to create executable documentation which can be automatically tested for correctness through open source CI/CD tools and provides an interactive learning environment wherein individuals can truly learn best practices by doing rather than watching or reading

Try it Out

Run Executable Docs Using Azure Cloud Shell

Azure Cloud Shell provides an environment with all of the prerequisites installed to run Simdem. This is the recommended method for new users to try and develop tutorials for simdem.

Open Azure Cloud Shell and select Bash as the environment.

The following code snippet gets started with Simdem.

Note This snippet clones the Simdem repo, installs necessary dependencies, and runs the interactive Simdem tutorial script.

git clone https://github.com/Azure/simdem.git

cd simdem

pip3 install -r requirements.txt

python3 main.py tutorial simdem

The general format to run an executable document is: python3 main.py <MODE_OF_OPERATION> <SCRIPT_DIRECTORY_NAME>

Run Executable Docs Using Local Machine

If you would like a more customizable development environment, or do not have an active Azure Subscription, Simdem can be run on a local machine with Python.

In Order to run and develop executable docs you need the following prerequisites.

  • Python
  • Pip3 (installed by default with python 3.4 or greater)
  • A Linux Bash Shell

Run the following in a Linux Bash Shell on your local machine:

Note This snippet clones the Simdem repo, installs necessary dependencies, and runs the interactive Simdem tutorial script.

git clone https://github.com/Azure/simdem.git

cd simdem

pip3 install -r requirements.txt

python3 main.py tutorial simdem

Modes of Operation

You can run executable documents in four different modes:

  • Tutorial: Displays the descriptive text of the tutorial and pauses at code blocks to allow user interaction. python3 main.py tutorial test
  • Learn: Requires the user to type the complete command in order to move forward with execution. python3 main.py learn test
  • Test: Runs the commands and then verifies that the output is sufficiently similar to the expected results (recorded in the markdown file) to be considered correct. python3 main.py test test
  • Demo: Runs the complete script continuously, only pausing when custom input is required. python3 main.py demo test
  • Script: Creates an executable bash script from the document python3 main.py script test

Writing Your Own Executable Document

Writing your own executable document is easy to do. The first step to writing an executable document is to create a folder in the demo_scripts directory with the name of your document.

After creating the new folder, every simdem document needs two files.

  1. README.md
  2. env.json

The README.md is written in markdown and is the content which simdem parses and presents in an executable manner. For example Azure Create VM readme.md

The env.json file is a standard json file with default values for your executable document. This is critical for the automated testing aspect of simdem so that documents can be executed without any human interaction. For example

{
    "MY_RESOURCE_GROUP_NAME": "myResourceGroup",
    "MY_LOCATION": "EastUS",
    "MY_VM_NAME": "myVM",
    "MY_USERNAME": "azureuser"
}

Once the README.md and env.json files have been successfully created, you can run your new document with the following command:

python3 main.py <MODE_OF_OPERATION> <SCRIPT_DIRECTORY_NAME>

Example

The following is an example of how one might create their first executable document

cd demo_scripts
mkdir myCoolDocument
cd myCoolDocument
touch README.md
touch env.json

Once you add content to README.md and env.json the files, they can be run in an executable manner with the following command:

python3 main.py tutorial myCoolDocument

Learn More About Writing Your Own Executable Document

To learn more about writing executable documentation use the interactive tutorial by running:

python3 main.py tutorial tutorial

Setting up CI/CD with Github Actions

In Progress

Contributing

This is an open source project. Don't keep your code improvements, features and cool ideas to yourself. Please issue pull requests against our GitHub repo.

Be sure to use our Git pre-commit script to test your contributions before committing, simply run the following command:

ln -s ../../pre-commit.sh .git/hooks/pre-commit

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Publishing

The latest version is built from source on each commit. To publish a version tagged image use ./scripts/publish.sh <FLAVOR> script. This will publish both the CLI and NoVNC containers if no FLAVOR is provided.

Don't forget to bump the version number after using this script. To do this open simdem.py and find and edit the following line (somewhere near the top of the file):

SIMDEM_VERSION = "0.4.1"

Learn more

If you want to learn more before running the program then why not read the interactive tutorial as a markdown page on GitHub.