Skip to content

Commit ddb25c8

Browse files
1 parent cedc7d5 commit ddb25c8

File tree

7 files changed

+515
-1
lines changed

7 files changed

+515
-1
lines changed

‎.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Setup Python
1313
uses: actions/setup-python@v5
1414
with:
15-
python-version: "3.10"
15+
python-version: "3.8"
1616
- name: Install nox
1717
run: |
1818
python -m pip install --upgrade setuptools pip wheel

‎.kokoro/docker/docs/Dockerfile

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from ubuntu:24.04
16+
17+
ENV DEBIAN_FRONTEND noninteractive
18+
19+
# Ensure local Python is preferred over distribution Python.
20+
ENV PATH /usr/local/bin:$PATH
21+
22+
# Install dependencies.
23+
RUN apt-get update \
24+
&& apt-get install -y --no-install-recommends \
25+
apt-transport-https \
26+
build-essential \
27+
ca-certificates \
28+
curl \
29+
dirmngr \
30+
git \
31+
gpg-agent \
32+
graphviz \
33+
libbz2-dev \
34+
libdb5.3-dev \
35+
libexpat1-dev \
36+
libffi-dev \
37+
liblzma-dev \
38+
libreadline-dev \
39+
libsnappy-dev \
40+
libssl-dev \
41+
libsqlite3-dev \
42+
portaudio19-dev \
43+
redis-server \
44+
software-properties-common \
45+
ssh \
46+
sudo \
47+
tcl \
48+
tcl-dev \
49+
tk \
50+
tk-dev \
51+
uuid-dev \
52+
wget \
53+
zlib1g-dev \
54+
&& add-apt-repository universe \
55+
&& apt-get update \
56+
&& apt-get -y install jq \
57+
&& apt-get clean autoclean \
58+
&& apt-get autoremove -y \
59+
&& rm -rf /var/lib/apt/lists/* \
60+
&& rm -f /var/cache/apt/archives/*.deb
61+
62+
63+
###################### Install python 3.10.14 for docs/docfx session
64+
65+
# Download python 3.10.14
66+
RUN wget https://www.python.org/ftp/python/3.10.14/Python-3.10.14.tgz
67+
68+
# Extract files
69+
RUN tar -xvf Python-3.10.14.tgz
70+
71+
# Install python 3.10.14
72+
RUN ./Python-3.10.14/configure --enable-optimizations
73+
RUN make altinstall
74+
75+
ENV PATH /usr/local/bin/python3.10:$PATH
76+
77+
###################### Install pip
78+
RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
79+
&& python3.10 /tmp/get-pip.py \
80+
&& rm /tmp/get-pip.py
81+
82+
# Test pip
83+
RUN python3.10 -m pip
84+
85+
# Install build requirements
86+
COPY requirements.txt /requirements.txt
87+
RUN python3.10 -m pip install --require-hashes -r requirements.txt
88+
89+
CMD ["python3.10"]
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
nox
2+
gcp-docuploader

‎.kokoro/docker/docs/requirements.txt

Lines changed: 297 additions & 0 deletions
Large diffs are not rendered by default.

‎.kokoro/docs/common.cfg

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Build logs will be here
4+
action {
5+
define_artifacts {
6+
regex: "**/*sponge_log.xml"
7+
}
8+
}
9+
10+
# Download trampoline resources.
11+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
12+
13+
# Use the trampoline script to run in docker.
14+
build_file: "python-bigquery-pandas/.kokoro/trampoline_v2.sh"
15+
16+
# Configure the docker image for kokoro-trampoline.
17+
env_vars: {
18+
key: "TRAMPOLINE_IMAGE"
19+
value: "gcr.io/cloud-devrel-kokoro-resources/python-lib-docs"
20+
}
21+
env_vars: {
22+
key: "TRAMPOLINE_BUILD_FILE"
23+
value: "github/python-bigquery-pandas/.kokoro/publish-docs.sh"
24+
}
25+
26+
env_vars: {
27+
key: "STAGING_BUCKET"
28+
value: "docs-staging"
29+
}
30+
31+
env_vars: {
32+
key: "V2_STAGING_BUCKET"
33+
# Push non-cloud library docs to `docs-staging-v2-dev` instead of the
34+
# Cloud RAD bucket `docs-staging-v2`
35+
value: "docs-staging-v2-dev"
36+
}
37+
38+
# It will upload the docker image after successful builds.
39+
env_vars: {
40+
key: "TRAMPOLINE_IMAGE_UPLOAD"
41+
value: "true"
42+
}
43+
44+
# It will always build the docker image.
45+
env_vars: {
46+
key: "TRAMPOLINE_DOCKERFILE"
47+
value: ".kokoro/docker/docs/Dockerfile"
48+
}
49+
50+
# Fetch the token needed for reporting release status to GitHub
51+
before_action {
52+
fetch_keystore {
53+
keystore_resource {
54+
keystore_config_id: 73713
55+
keyname: "yoshi-automation-github-key"
56+
}
57+
}
58+
}
59+
60+
before_action {
61+
fetch_keystore {
62+
keystore_resource {
63+
keystore_config_id: 73713
64+
keyname: "docuploader_service_account"
65+
}
66+
}
67+
}

‎.kokoro/docs/docs.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto

‎.kokoro/publish-docs.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/bash
2+
# Copyright 2024 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# https://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -eo pipefail
17+
18+
# Disable buffering, so that the logs stream through.
19+
export PYTHONUNBUFFERED=1
20+
21+
export PATH="${HOME}/.local/bin:${PATH}"
22+
23+
# build docs
24+
nox -s docs
25+
26+
# create metadata
27+
python3.10 -m docuploader create-metadata \
28+
--name=$(jq --raw-output '.name // empty' .repo-metadata.json) \
29+
--version=$(python3.10 setup.py --version) \
30+
--language=$(jq --raw-output '.language // empty' .repo-metadata.json) \
31+
--distribution-name=$(python3.10 setup.py --name) \
32+
--product-page=$(jq --raw-output '.product_documentation // empty' .repo-metadata.json) \
33+
--github-repository=$(jq --raw-output '.repo // empty' .repo-metadata.json) \
34+
--issue-tracker=$(jq --raw-output '.issue_tracker // empty' .repo-metadata.json)
35+
36+
cat docs.metadata
37+
38+
# upload docs
39+
python3.10 -m docuploader upload docs/_build/html --metadata-file docs.metadata --staging-bucket "${STAGING_BUCKET}"
40+
41+
42+
# docfx yaml files
43+
nox -s docfx
44+
45+
# create metadata.
46+
python3.10 -m docuploader create-metadata \
47+
--name=$(jq --raw-output '.name // empty' .repo-metadata.json) \
48+
--version=$(python3.10 setup.py --version) \
49+
--language=$(jq --raw-output '.language // empty' .repo-metadata.json) \
50+
--distribution-name=$(python3.10 setup.py --name) \
51+
--product-page=$(jq --raw-output '.product_documentation // empty' .repo-metadata.json) \
52+
--github-repository=$(jq --raw-output '.repo // empty' .repo-metadata.json) \
53+
--issue-tracker=$(jq --raw-output '.issue_tracker // empty' .repo-metadata.json)
54+
55+
cat docs.metadata
56+
57+
# upload docs
58+
python3.10 -m docuploader upload docs/_build/html/docfx_yaml --metadata-file docs.metadata --destination-prefix docfx --staging-bucket "${V2_STAGING_BUCKET}"

0 commit comments

Comments
 (0)