Beispiel #1
0
 def test_build_all_docs_success(self):
     action.build_all_docs(
         action.GithubEnvironment(build_command="make html", ),
         [
             os.path.join(TEST_PROJECTS_DIR, "no_errors"),
             os.path.join(TEST_PROJECTS_DIR, "warnings"),
         ],
     )
Beispiel #2
0
 def test_build_all_docs_some_success(self):
     with self.assertRaisesRegex(RuntimeError, "Build failed"):
         action.build_all_docs(
             action.GithubEnvironment(build_command="make html", ),
             [
                 os.path.join(TEST_PROJECTS_DIR, "no_errors"),
                 os.path.join(TEST_PROJECTS_DIR, "warnings_and_errors"),
             ],
         )
Beispiel #3
0
#!/usr/bin/env python3
import os
import json
from sphinx_action import action

# This is the entrypoint called by Github when our action is run. All the
# Github specific setup is done here to make it easy to test the action code
# in isolation.
if __name__ == "__main__":
    print("[sphinx-action] Starting sphinx-action build.")

    if "INPUT_PRE-BUILD-COMMAND" in os.environ:
        pre_command = os.environ["INPUT_PRE-BUILD-COMMAND"]
        print("Running: {}".format(pre_command))
        os.system(pre_command)

    github_env = action.GithubEnvironment(
        build_command=os.environ.get("INPUT_BUILD-COMMAND"), )

    # We build the doc folder passed in the inputs.
    action.build_all_docs(github_env, [os.environ.get("INPUT_DOCS-FOLDER")])
Beispiel #4
0
 def test_build_docs_with_no_docs_directories(self):
     """Make sure we bail out if they don't provide a single documentation
     directory"""
     with self.assertRaises(ValueError):
         action.build_all_docs(None, [])