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

CI: Add untracked generated documentation files when publishing #492

Merged
merged 1 commit into from
Oct 31, 2024

Conversation

pniedzielski
Copy link
Collaborator

If generating the documentation creates files that do not already exist on the gh-pages branch, the current GitHub Action to generate documentation will not add them. Instead, it will only update existing files. This may happen when a new component is added, or when the Doxygen version differs from prior runs. This bit us on our first run of the documentation-generation GitHub Action, because the version that GitHub Actions uses is different than the version that built our original documentation.

This patch explicitly adds all files generated under the docs/docs/apidocs/cpp_apidocs directory, including both untracked files and tracked, modified files.

Copy link
Collaborator

@678098 678098 left a comment

Choose a reason for hiding this comment

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

How does this PR perform if there are no changes to commit?

@pniedzielski
Copy link
Collaborator Author

How does this PR perform if there are no changes to commit?

I think the only way this will happen is when we manually run the workflow, because our doxygen invocation looks like ( cat Doxyfile ; echo "PROJECT_NUMBER=${{ github.sha }}" ) | doxygen -. Namely, we embed the commit SHA into the version, which is printed to the documentation header. But, just in case, the behavior is to not commit any changes.

I ran the following commands to verify this:

mkdir workspace && cd workspace

# Build the docs, commit, and push to `gh-pages1` branch a first time, using constant version string `v1.0`.  This makes an update.
git clone https://github.com/pniedzielski/blazingmq.git
cd blazingmq/
rm -rf docs/
git clone --branch gh-pages1 https://github.com/pniedzielski/blazingmq.git docs
( cat Doxyfile ; echo "PROJECT_NUMBER=v1.0" ) | doxygen -
cd docs/
git add .
git commit -s -am "Manual update #1"
git push

cd ../..
rm -rf blazingmq/

# Perform same steps as above again.  No changes to `main`, `gh-pages1` in well-known state.
# `doxygen` generation should be idempotent, so should be no changes to commit.git clone https://github.com/pniedzielski/blazingmq.git
cd blazingmq/
rm -rf docs/
git clone --branch gh-pages1 https://github.com/pniedzielski/blazingmq.git docs
( cat Doxyfile ; echo "PROJECT_NUMBER=v1.0" ) | doxygen -
cd docs/
git add .
echo $?  # 0
git commit -s -am "Manual update #2"
echo $?  # 1
git push
echo $?  # 0

I believe the git commit failing with return code 1 will cause the action to exit (with failure). I think we want the action to exit like this, but we don't want it to fail:

git add . && git commit -s -am "Manual update #2" && git push || true

I'll make this change tomorrow.

Copy link

@bmq-oss-ci bmq-oss-ci bot left a comment

Choose a reason for hiding this comment

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

Build 348 of commit 1825c1f has completed with FAILURE

If generating the documentation creates files that do not already exist
on the `gh-pages` branch, the current GitHub Action to generate
documentation will not add them.  Instead, it will only update existing
files.  This may happen when a new component is added, or when the
Doxygen version differs from prior runs.  This bit us on our first run
of the documentation-generation GitHub Action, because the version that
GitHub Actions uses is different than the version that built our
original documentation.

This patch explicitly adds all files generated under the
`docs/docs/apidocs/cpp_apidocs` directory, including both untracked
files and tracked, modified files.

Signed-off-by: Patrick M. Niedzielski <patrick@pniedzielski.net>
@pniedzielski pniedzielski marked this pull request as ready for review October 31, 2024 14:10
@pniedzielski pniedzielski requested a review from a team as a code owner October 31, 2024 14:10
@pniedzielski pniedzielski requested a review from 678098 October 31, 2024 14:10
@pniedzielski pniedzielski merged commit 844ba5c into bloomberg:main Oct 31, 2024
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants