Skip to content

Add ability to benchmark pull requests #51666

Add ability to benchmark pull requests

Add ability to benchmark pull requests #51666

Workflow file for this run

# Sphinx docs check
# -----------------
#
# There are 2 main reasons for having this dedicated Sphinx docs check in
# addition to the Read the Docs (RTD) builder:
#
# 1. This action is set up to fail on Sphinx warnings, whereas RTD's will show
# a passing sign for warnings, and only fail for errors. So this is a stricter
# check.
#
# 2. When this action detects warnings, it produces GitHub annotations on the
# Files Changed tab in the pull request. Such annotations can be convenient for
# developers/code reviewers (e.g., the same way CodeCov and CodeFactor
# annotate).
# -----------------
name: "Documentation check"
on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
jobs:
sphinx:
if: github.event.pull_request.draft == false
env:
DEPS_BRANCH: bot/stable-deps-update
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: PennyLaneAI/sphinx-action@master
with:
docs-folder: "doc/"
pre-build-command: >
apt install -y graphviz
&& pip3 install -r doc/requirements.txt
&& pip3 install .
&& pip3 install openfermionpyscf
&& pip3 install aiohttp fsspec h5py
&& pip freeze | grep -v 'file:///' > .github/stable/doc.txt.tmp
build-command: "sphinx-build -b html . _build -W --keep-going"
- name: Prepare local repo
if: github.event.pull_request.head.repo.full_name == 'PennyLaneAI/pennylane'
run: |
git fetch
git config user.name "GitHub Actions Bot"
git config user.email "<>"
if git ls-remote --exit-code origin "refs/heads/${{ env.DEPS_BRANCH }}"; then
git checkout "${{ env.DEPS_BRANCH }}"
else
git checkout master
git pull
git checkout -b "${{ env.DEPS_BRANCH }}"
fi
mv -f .github/stable/doc.txt.tmp .github/stable/doc.txt
- name: Determine if changes have been made
if: github.event.pull_request.head.repo.full_name == 'PennyLaneAI/pennylane'
id: changed
run: |
echo "has_changes=$(git status --porcelain | wc -l | awk '{print $1}')" >> $GITHUB_OUTPUT
- name: Stage changes
if: github.event.pull_request.head.repo.full_name == 'PennyLaneAI/pennylane' && steps.changed.outputs.has_changes != '0'
run: |
git add .github/stable/doc.txt
git commit -m "Update stable docs dependencies"
git push -f --set-upstream origin "${{ env.DEPS_BRANCH }}"
# Create PR to master
- name: Create pull request
if: github.event.pull_request.head.repo.full_name == 'PennyLaneAI/pennylane' && steps.changed.outputs.has_changes != '0'
uses: repo-sync/pull-request@v2
with:
source_branch: "${{ env.DEPS_BRANCH }}"
destination_branch: "master"
github_token: "${{ secrets.GITHUB_TOKEN }}"
pr_title: "Update stable dependency files"
# if updating the pr_body, please also update the same text in the tests.yml file
pr_body: |
Automatic update of stable requirement files to snapshot valid python environments.
Because bots are not able to trigger CI on their own, please do so by pushing an empty commit to this branch using the following command:
```
git commit --allow-empty -m 'trigger ci'
```
Alternatively, wait for this branch to be out-of-date with master, then just use the "Update branch" button!
Note that it is expected that the PennyLane-Lightning repo is a version ahead of the release, because the
version number is taken from the dev branch. Trying to `pip install` from the files will fail until that
major version of Lightning is released.
If pip install fails with a not found error when installing because of this, it can be fixed by manually
downgrading the PennyLane-Lightning version number in the file by 1 version and trying again.
pr_allow_empty: false
pr_draft: false