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

feature: trigger doc build on release tag #2301

Merged

Conversation

yuejiaointel
Copy link
Contributor

@yuejiaointel yuejiaointel commented Feb 6, 2025

Description

Hi all,
This PR intends to automate the process to release sklearnex doc. Main changes are in a new file called doc-release.yml. Automation will be triggered if a valid tag is pushed.
Best


PR completeness and readability

  • I have reviewed my changes thoroughly before submitting this pull request.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have resolved any merge conflicts that might occur with the base branch.

Testing

  • I have run it locally and tested the changes extensively.
  • All CI jobs are green or I have provided justification why they aren't.

Copy link

codecov bot commented Feb 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Flag Coverage Δ
azure 78.05% <ø> (?)
github 70.74% <ø> (-0.27%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 72 files with indirect coverage changes

@yuejiaointel yuejiaointel changed the title feature: trigger doc build on release-test tag feature: trigger doc build on release tag Feb 7, 2025
@yuejiaointel yuejiaointel force-pushed the feature_automate_new_doc_version branch from eaeb693 to d781667 Compare February 26, 2025 07:49
Copy link
Contributor

@david-cortes-intel david-cortes-intel left a comment

Choose a reason for hiding this comment

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

LGTM, pending a reply back from @icfaust about #2301 (comment)

Copy link
Contributor

@icfaust icfaust left a comment

Choose a reason for hiding this comment

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

overall good, just some nitpicks I noticed.

run: |
# Set git auth for push changes
git config --global user.name "GitHub Actions"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
Copy link
Contributor

Choose a reason for hiding this comment

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

Where does this number come from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I searched git config and there is a .cache/per-commit/repondmp4e6s/workflows/main.yml so I tried to jsut copy it over, need this config to push the changes

run: |
export LD_LIBRARY_PATH=$(dirname $(dirname $(which python)))/lib:$LD_LIBRARY_PATH
cd doc
./build-doc.sh --gh-pages
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: divergence from docs CI by having the --gh-pages flag.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that's because they do slightly different things. This one with --gh-pages uses different build options and generates a versioned folder - simply reusing the result from the docs CI and renaming it results in docs that don't render when put under gh-pages.

But that shouldn't be a problem because in the end both of them are using the same software to build the docs, with the same pinned versions from requirements-doc.txt.

if git checkout $DOC_VERSION 2>/dev/null; then
echo "Successfully checked out tag $DOC_VERSION."
else
echo "ERROR: Tag $DOC_VERSION does not exist."
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
echo "ERROR: Tag $DOC_VERSION does not exist."
echo "::error:: Tag $DOC_VERSION does not exist."

https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-error-message

Maybe this for something more informative to the user of github actions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed thx!

export DOC_VERSION="${GITHUB_REF#refs/tags/}"
# Error out if cannot find version
if [ -z "$DOC_VERSION" ]; then
echo "ERROR: Failed to determine documentation version."
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
echo "ERROR: Failed to determine documentation version."
echo "::error:: Failed to determine documentation version."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed thx!


jobs:
build-docs:
runs-on: ubuntu-latest
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

@Alexsandruss will know better, but we like to have fixed versions for the runners.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed thx!


# Checkout gh-pages branch
if ! git checkout gh-pages; then
echo "ERROR: Could not checkout gh-pages branch!"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
echo "ERROR: Could not checkout gh-pages branch!"
echo "::error:: Could not checkout gh-pages branch!"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed thx!

cp -R "$DEPLOY_DIR/$SHORT_DOC_VERSION" latest
cp "$DEPLOY_DIR/index.html" .
if ! diff -r "$SHORT_DOC_VERSION" latest > /dev/null; then
echo "ERROR: Content mismatch between $SHORT_DOC_VERSION and latest directories"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
echo "ERROR: Content mismatch between $SHORT_DOC_VERSION and latest directories"
echo "::error:: Content mismatch between $SHORT_DOC_VERSION and latest directories"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed thx!

- name: Deploy Documentation to gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Copy link
Contributor

Choose a reason for hiding this comment

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

This run call is 57 lines long, ideally it should be a separate shell script located in .github/scripts/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved now I have a doc_release.sh in scripts

Copy link
Contributor

Choose a reason for hiding this comment

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

I had the impression that the scripts were meant to be executable both locally and on GH.

This script would mostly be about git commands which are specific to this particular workflow and not reusable elsewhere. I think it makes sense to keep it here.

Copy link
Contributor

Choose a reason for hiding this comment

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

@Alexsandruss @homksei please weigh in on this, as we are both inferring about the rules of the codebase when it comes to this topic.

Copy link
Contributor

Choose a reason for hiding this comment

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

@david-cortes-intel As far as I see, the script is a general deployment script which the only git commands which are specific to github is the setting the username and email, which could be maintained in the workflow.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that sounds like a reasonable split.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thx for the suggestions! Moved git config back to yml

{% endblock %}
{% include "versions.html" %}
{{ super() }}
{% endblock %}
Copy link
Contributor

Choose a reason for hiding this comment

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

Endline here needs to be added (unless it breaks the html).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed thx!

}
]
]
Copy link
Contributor

Choose a reason for hiding this comment

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

another newline here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed thx!

git add doc/versions.json
git add index.html
git commit . -m "Automatic doc update for version $DOC_VERSION"
git push origin gh-pages
Copy link
Contributor

Choose a reason for hiding this comment

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

newline here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed thx!

Copy link
Contributor

@icfaust icfaust left a comment

Choose a reason for hiding this comment

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

Just add the endline to the one file and can merge.

@yuejiaointel yuejiaointel merged commit e9b929f into uxlfoundation:main Mar 5, 2025
27 checks passed
@yuejiaointel yuejiaointel deleted the feature_automate_new_doc_version branch March 5, 2025 05:14
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.

3 participants