Skip to content
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

Add Github Actions workflow to build documentation #993

Merged
merged 2 commits into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: "Docs"

on:
pull_request:
branches:
- "v*.*"
- "master"
- "feature/*"
push:
branches:
- "v*.*"
- "master"
- "feature/*"

jobs:
giza:
name: "Build Docs"
runs-on: "ubuntu-20.04"

steps:
- name: "Checkout library"
uses: "actions/checkout@v3"
with:
path: library
fetch-depth: 2

- name: "Checkout docs"
uses: "actions/checkout@v3"
with:
repository: mongodb/docs-php-library
path: docs
fetch-depth: 2

- name: "Setup python"
uses: actions/setup-python@v4
with:
python-version: '2.7'

# The requirements file installs urllib3 with an incompatible version; we replace it with one that works
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this worth a PR to mongodb/docs-tools? Worst case it doesn't get merged.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created mongodb/docs-tools#599 to update this.

- name: "Install giza"
run: |
pip install -r https://raw.githubusercontent.com/mongodb/docs-tools/master/giza/requirements.txt
pip install urllib3==1.25.2

- name: "Sync documentation"
run: "rsync -a library/docs/ docs/source/"
jmikola marked this conversation as resolved.
Show resolved Hide resolved

- name: "Run Giza"
run: "giza make publish"
Copy link
Member

@jmikola jmikola Oct 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@i80and: Any chance you know of a way to get giza to return a non-zero exit code on an erroneous docs build?

Quoting @alcaeus's comment in the OP:

I was not able to make giza make publish exit with a non-zero exit code, even when using a wrong filename to link to a file.

working-directory: docs

- name: "Upload built documentation"
uses: actions/upload-artifact@v3
with:
name: php-library-docs.tar.gz
path: docs/build/public/master/php-library.tar.gz
8 changes: 4 additions & 4 deletions docs/reference/bson.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Overview
--------

MongoDB stores data records as BSON documents. BSON is a binary representation
of :term:`JSON` documents, though it contains more data types than JSON. For the
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently, this term isn't defined and the current docs don't render this in a special way, so I removed it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I've seen this error before but never traced it back to this line. I agree this serves no purpose.

It could be something that only builds correctly with the docs team's build tools, since those pull in additional resources used by the server manual (or did if they no longer use Giza).

BSON spec, see `bsonspec.org <https://bsonspec.org/>`_.
of JSON documents, though it contains more data types than JSON. For the BSON
spec, see `bsonspec.org <https://bsonspec.org/>`_.

By default, the |php-library| returns BSON documents as
:phpclass:`MongoDB\\Model\\BSONDocument` objects and BSON arrays as
Expand Down Expand Up @@ -106,7 +106,7 @@ of the PHP class in a special property within the BSON document.
When deserializing a PHP variable from BSON, the encoded class name of a
:php:`Persistable <mongodb-bson-persistable>` object will override any class
specified in the type map, but it will not override ``"array"`` and
``"stdClass"`` or ``"object"``. This is discussed in the
``"stdClass"`` or ``"object"``. This is discussed in the
:php:`persistence specification <mongodb.persistence>` but it bears
repeating.

Expand All @@ -121,7 +121,7 @@ Consider the following class definition:
private $id;
private $name;
private $createdAt;

public function __construct($name)
{
$this->id = new MongoDB\BSON\ObjectId;
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/method/MongoDBChangeStream-current.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,4 @@ See Also
- :ref:`Tailable Cursor Iteration <php-tailable-cursor>`
- :manual:`Change Streams </changeStreams>` documentation in the MongoDB manual
- :manual:`Change Events </reference/change-events/>` documentation in the
MongoDB manual
MongoDB manual
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file (and the next) were lacking a trailing newline.

2 changes: 1 addition & 1 deletion docs/reference/method/MongoDBChangeStream-key.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ See Also
- :phpmethod:`MongoDB\\Database::watch()`
- :php:`Iterator::key() <iterator.key>`
- :ref:`Tailable Cursor Iteration <php-tailable-cursor>`
- :manual:`Change Streams </changeStreams>` documentation in the MongoDB manual
- :manual:`Change Streams </changeStreams>` documentation in the MongoDB manual