Skip to content

Commit

Permalink
Add kokoro docs job to publish to googleapis.dev. (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
busunkim96 authored Jul 22, 2019
1 parent 460cceb commit 1873811
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 111 deletions.
48 changes: 48 additions & 0 deletions .kokoro/docs/common.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Build logs will be here
action {
define_artifacts {
regex: "**/*sponge_log.xml"
}
}

# Download trampoline resources.
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"

# Use the trampoline script to run in docker.
build_file: "python-ndb/.kokoro/trampoline.sh"

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/python-multi"
}
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/google-cloud-python/.kokoro/publish-docs.sh"
}

env_vars: {
key: "STAGING_BUCKET"
value: "docs-staging"
}

# Fetch the token needed for reporting release status to GitHub
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "yoshi-automation-github-key"
}
}
}

before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "docuploader_service_account"
}
}
}
1 change: 1 addition & 0 deletions .kokoro/docs/ndb.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Format: //devtools/kokoro/config/proto/build.proto
42 changes: 42 additions & 0 deletions .kokoro/publish-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

set -eo pipefail

# Disable buffering, so that the logs stream through.
export PYTHONUNBUFFERED=1

cd github/python-ndb

# Remove old nox
python3.6 -m pip uninstall --yes --quiet nox-automation

# Install nox
python3.6 -m pip install --upgrade --quiet nox
python3.6 -m nox --version

# build docs
nox -s docs

python3 -m pip install gcp-docuploader

# install a json parser
sudo apt-get update
sudo apt-get -y install software-properties-common
sudo add-apt-repository universe
sudo apt-get update
sudo apt-get -y install jq

# create metadata
python3 -m docuploader create-metadata \
--name=$(jq --raw-output '.name // empty' .repo-metadata.json) \
--version=$(python3 setup.py --version) \
--language=$(jq --raw-output '.language // empty' .repo-metadata.json) \
--distribution-name=$(python3 setup.py --name) \
--product-page=$(jq --raw-output '.product_documentation // empty' .repo-metadata.json) \
--github-repository=$(jq --raw-output '.repo // empty' .repo-metadata.json) \
--issue-tracker=$(jq --raw-output '.issue_tracker // empty' .repo-metadata.json)

cat docs.metadata

# upload docs
python3 -m docuploader upload docs/_build/html --metadata-file docs.metadata --staging-bucket docs-staging
10 changes: 10 additions & 0 deletions .repo-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "python-ndb",
"name_pretty": "NDB Client Library for Google Cloud Datastore",
"client_documentation": "https://googleapis.dev/python/python-ndb/latest",
"issue_tracker": "https://github.com/googleapis/python-ndb/issues",
"release_level": "alpha",
"language": "python",
"repo": "googleapis/python-ndb",
"distribution_name": "google-cloud-ndb",
}
28 changes: 21 additions & 7 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"""

import os
import shutil

import nox

Expand Down Expand Up @@ -107,13 +108,26 @@ def blacken(session):

@nox.session(py=DEFAULT_INTERPRETER)
def docs(session):
# Install all dependencies.
session.install("Sphinx")
session.install("sphinxcontrib.spelling")
session.install(".")
# Building the docs.
run_args = ["bash", "test_utils/test_utils/scripts/update_docs.sh"]
session.run(*run_args)
"""Build the docs for this library."""

session.install("-e", ".")
session.install(
"sphinx", "alabaster", "recommonmark", "sphinxcontrib.spelling"
)

shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
session.run(
"sphinx-build",
"-W", # warnings as errors
"-T", # show full traceback on exception
"-N", # no colors
"-b",
"html",
"-d",
os.path.join("docs", "_build", "doctrees", ""),
os.path.join("docs", ""),
os.path.join("docs", "_build", "html", ""),
)


@nox.session(py=DEFAULT_INTERPRETER)
Expand Down
104 changes: 0 additions & 104 deletions test_utils/test_utils/scripts/update_docs.sh

This file was deleted.

0 comments on commit 1873811

Please sign in to comment.