-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5a60c15
commit 9457fbf
Showing
6 changed files
with
194 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: documentation_dev | ||
on: | ||
pull_request_target: | ||
branches: | ||
- main | ||
types: [closed] | ||
push: | ||
branches: | ||
- main | ||
|
||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Wait for version update | ||
run: | | ||
sleep 60 | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install . | ||
- name: Sphinx build | ||
run: | | ||
poetry run sphinx-build docs _build | ||
- uses: actions/checkout@v4 | ||
with: | ||
# This is necessary so that we have the tags. | ||
fetch-depth: 0 | ||
ref: gh-pages | ||
path: gh_pages | ||
- name: copy stable and preview version changes | ||
run: | | ||
cp -rv gh_pages/preview_pr _build/preview_pr || echo "Ignoring exit status" | ||
- name: Deploy to GitHub Pages | ||
uses: peaceiris/actions-gh-pages@v3 | ||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | ||
with: | ||
publish_branch: gh-pages | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: _build/ | ||
force_orphan: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
name: "preview" | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["ready_for_review"] | ||
types: | ||
- completed | ||
|
||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
docs: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
steps: | ||
- name: Download workflow artifact | ||
uses: dawidd6/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
workflow: peek_icons.yml | ||
run_id: ${{ github.event.workflow_run.id }} | ||
|
||
- name: Read the pr_num file | ||
id: pr_num_reader | ||
uses: juliangruber/[email protected] | ||
with: | ||
path: ./pr_num/pr_num.txt | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
path: main | ||
- name: Checkout Pull Request | ||
env: | ||
GITHUB_USER: ${{ secrets.GITHUB_USER }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
cd main | ||
gh pr checkout ${{ steps.pr_num_reader.outputs.content }} | ||
cd .. | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Install and configure Poetry | ||
uses: snok/install-poetry@v1 | ||
- name: Install dependencies and build doc | ||
run: | | ||
set +e | ||
cd main | ||
curl -C - https://raw.githubusercontent.com/rlberry-py/rlberry/main/pyproject.toml > pyproject.toml | ||
poetry install --all-extras --with dev --sync | ||
poetry run sphinx-build docs ../_build | ||
echo "exitcode=$?" >> $GITHUB_ENV | ||
cd .. | ||
- uses: actions/checkout@v4 | ||
with: | ||
# This is necessary so that we have the tags. | ||
fetch-depth: 0 | ||
ref: gh-pages | ||
path: gh_pages | ||
|
||
- name: Commit documentation changes | ||
if: ${{ env.exitcode == 0 }} | ||
run: | | ||
cd gh_pages | ||
rm -r preview_pr || echo "Ignoring exit status" | ||
mkdir preview_pr | ||
cp -rv ../_build/* preview_pr | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
git add . | ||
git commit -m "Preview documentation" | ||
git push | ||
- name: Comment on the PR about the result | ||
uses: jungwinter/comment@v1 # let us comment on a specific PR | ||
if: ${{ env.exitcode == 0 }} | ||
env: | ||
MESSAGE: | | ||
Hello, | ||
The build of the doc succeeded. The documentation preview is available here: | ||
https://rlberry-py.github.io/rlberry/preview_pr | ||
with: | ||
type: create | ||
issue_number: ${{ steps.pr_num_reader.outputs.content }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
body: > | ||
${{ format(env.MESSAGE, | ||
fromJSON(steps.icons_overview_img_step.outputs.markdown_urls)[0], | ||
join(fromJSON(steps.icons_detailed_img_step.outputs.markdown_urls), '')) }} | ||
- name: Comment on the PR about the result, fail | ||
uses: jungwinter/comment@v1 # let us comment on a specific PR | ||
if: ${{ env.exitcode != 0 }} | ||
env: | ||
MESSAGE: | | ||
Hello, | ||
The build of the doc failed. Look up the reason here: | ||
https://github.com/rlberry-py/rlberry/actions/workflows/preview.yml | ||
with: | ||
type: create | ||
issue_number: ${{ steps.pr_num_reader.outputs.content }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
body: > | ||
${{ format(env.MESSAGE, | ||
fromJSON(steps.icons_overview_img_step.outputs.markdown_urls)[0], | ||
join(fromJSON(steps.icons_detailed_img_step.outputs.markdown_urls), '')) }} | ||
- name: Exit | ||
run: exit "$exitcode" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: ready_for_review | ||
|
||
on: | ||
pull_request: | ||
types: [labeled, opened, reopened, synchronize] | ||
|
||
jobs: | ||
build: | ||
if: contains( github.event.pull_request.labels.*.name, 'ready for review') | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Run a one-line script | ||
run: echo ready for review! | ||
- name: Save the PR number in an artifact | ||
shell: bash | ||
env: | ||
PR_NUM: ${{ github.event.number }} | ||
run: echo $PR_NUM > pr_num.txt | ||
|
||
- name: Upload the PR number | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: pr_num | ||
path: ./pr_num.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
.. _api: | ||
|
||
########### | ||
rlberry API | ||
########### | ||
################# | ||
rlberry-scool API | ||
################# | ||
|
||
|
||
Manager | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,3 @@ git+https://github.com/sphinx-contrib/video | |
matplotlib | ||
nbsphinx | ||
sphinx-tabs | ||
rlberry |