Skip to content

Commit

Permalink
This commit squashes everything that was used to setup the new docume…
Browse files Browse the repository at this point in the history
…ntation workflow with github page.
  • Loading branch information
TimotheeMathieu committed Nov 8, 2023
1 parent 3669911 commit 47f6d06
Show file tree
Hide file tree
Showing 16 changed files with 259 additions and 38 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/page.yml → .github/workflows/doc_dev.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
name: documentation
name: documentation_dev
on:
pull_request_target:
branches:
- main
types: [closed]
push:
branches:
- main
paths:
- docs/*

on: [push, pull_request, workflow_dispatch]

permissions:
contents: write
Expand All @@ -9,7 +18,8 @@ jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.10'
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/doc_stable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: documentation_stable
on:
workflow_run:
workflows: ["documentation_dev"]
types:
- completed

permissions:
contents: write

jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
path: main
- name: checkout latest
run: |
cd main
git checkout $(git describe --tags $(git rev-list --tags --max-count=1))
cd ..
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
pip install -r main/docs/requirements.txt
pip install -r main/requirements.txt
- name: Sphinx build
run: |
sphinx-build main/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: Commit documentation changes
run: |
cd gh_pages
rm -r stable || echo "Ignoring exit status"
mkdir stable
cp -rv ../_build/* stable
git config user.name github-actions
git config user.email [email protected]
git add .
git commit -m "Documentation Stable"
git push
4 changes: 2 additions & 2 deletions .github/workflows/dunamai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: '3.7'
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
# This is necessary so that we have the tags.
fetch-depth: 0
Expand Down
110 changes: 110 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
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 dependencies
run: |
set +e
pip install -r main/docs/requirements.txt
pip install -r main/requirements.txt
sphinx-build main/docs _build
echo "exitcode=$?" >> $GITHUB_ENV
- 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"
26 changes: 26 additions & 0 deletions .github/workflows/ready_for_review.yml
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
16 changes: 5 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@
<a href="https://pypi.org/project/rlberry/">
<img alt="Python Version" src="https://img.shields.io/badge/python-3.10-blue">
</a>
<a href="https://github.com/rlberry-py/rlberry/workflows/test/badge.svg">
<img alt="pytest" src="https://github.com/rlberry-py/rlberry/workflows/test/badge.svg">
</a>
<a href='https://rlberry.readthedocs.io/en/latest/?badge=latest'>
<img alt="Documentation Status" src="https://readthedocs.org/projects/rlberry/badge/?version=latest">
</a>
<a href="https://img.shields.io/github/contributors/rlberry-py/rlberry">
<img alt="contributors" src="https://img.shields.io/github/contributors/rlberry-py/rlberry">
</a>
Expand Down Expand Up @@ -82,12 +76,12 @@ Install the latest version for a stable release.
pip install rlberry
```

The documentation includes more [installation instructions](https://rlberry.readthedocs.io/en/latest/installation.html) in particular for users that work with Jax.
The documentation includes more [installation instructions](https://rlberry-py.github.io/rlberry/installation.html).


## Getting started

In our [documentation](https://rlberry.readthedocs.io/en/latest/), you will find [quick starts](https://rlberry.readthedocs.io/en/latest/user_guide.html#quick-start-setup-an-experiment-and-evaluate-different-agents) to the library and a [user guide](https://rlberry.readthedocs.io/en/latest/user_guide.html) with a few tutorials on using rlberry.
In our [documentation](https://rlberry-py.github.io/rlberry/), you will find [quick starts](https://rlberry-py.github.io/rlberry/basics/quick_start_rl/quickstart.html#quick-start) to the library and a [user guide](https://rlberry-py.github.io/rlberry/user_guide.html) with a few tutorials on using rlberry. See also the [stable documentation](https://rlberry-py.github.io/rlberry/stable/) for the documentation corresponding to the last release.

Also, we provide a handful of notebooks on [Google colab](https://colab.research.google.com/) as examples to show you
how to use `rlberry`:
Expand All @@ -99,7 +93,7 @@ how to use `rlberry`:

## Changelog

See the [changelog](https://rlberry.readthedocs.io/en/latest/changelog.html) for a history of the chages made to rlberry.
See the [changelog](https://rlberry-py.github.io/rlberry/changelog.html) for a history of the chages made to rlberry.

## Citing rlberry

Expand All @@ -126,9 +120,9 @@ The modules listed below are experimental at the moment, that is, they are not t

## About us
This project was initiated and is actively maintained by [INRIA SCOOL team](https://team.inria.fr/scool/).
More information [here](https://rlberry.readthedocs.io/en/latest/about.html#).
More information [here](https://rlberry-py.github.io/rlberry/stable/about.html).

## Contributing

Want to contribute to `rlberry`? Please check [our contribution guidelines](https://rlberry.readthedocs.io/en/latest/contributing.html). **If you want to add any new agents or environments, do not hesitate
Want to contribute to `rlberry`? Please check [our contribution guidelines](https://rlberry-py.github.io/rlberry/stable/contributing.html). **If you want to add any new agents or environments, do not hesitate
to [open an issue](https://github.com/rlberry-py/rlberry/issues/new/choose)!**
2 changes: 1 addition & 1 deletion docs/beginner_dev_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Before a PR can be merged, it needs to be approved. Please prefix the title of y
* Azure pipelines are used for testing rlberry on Linux, Mac and Windows, with different dependencies and settings.
* Readthedocs is used to build the docs for viewing.
* github page are used to build the docs for viewing.
Please note that if you want to skip the CI (azure pipeline is long to run), use `[ci skip]` in the description of the commit.
Expand Down
1 change: 0 additions & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ Version 0.4.1
Version 0.4.0
-------------


*PR #273*

* Change the default behavior of `plot_writer_data` so that if seaborn has version >= 0.12.0 then
Expand Down
18 changes: 3 additions & 15 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import os
import sys


import sphinx_gallery # noqa
from sphinx_gallery.sorting import ExplicitOrder

Expand All @@ -22,10 +23,9 @@
# -- Project information -----------------------------------------------------

project = "rlberry"
copyright = "2022, rlberry team"
copyright = "2023, rlberry team"
author = "rlberry team"


ver_file = os.path.join("../rlberry", "_version.py")
with open(ver_file) as f:
exec(f.read())
Expand All @@ -51,19 +51,7 @@
]

myst_enable_extensions = ["amsmath"]
# myst_enable_extensions = [
# "amsmath",
# "colon_fence",
# "deflist",
# "dollarmath",
# "fieldlist",
# "html_admonition",
# "html_image",
# "replacements",
# "smartquotes",
# "substitution",
# "tasklist",
# ]


autodoc_default_options = {
"members": True,
Expand Down
2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
:align: center

.. _rlberry: https://github.com/rlberry-py/rlberry
../

.. _index:

An RL Library for Research and Education
========================================
Expand Down
6 changes: 4 additions & 2 deletions docs/themes/scikit-learn-fork/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{% block htmltitle %}
<title>{{ title|striptags|e }}{{ titlesuffix }}</title>
{% endblock %}
<link rel="canonical" href="https://rlberry.readthedocs.io/en/stable/{{pagename}}.html" />
<link rel="canonical" href="https://rlberry-py.github.io/rlberry/{{pagename}}.html" />

{% if favicon %}
<link rel="shortcut icon" href="{{ pathto('_static/' + favicon, 1) }}"/>
Expand Down Expand Up @@ -59,10 +59,12 @@
{%- if pagename != "install" %}
<br>
<div class="alert alert-warning p-1 mb-2" role="alert">

<p class="text-center mb-0">
rlberry {{ release }}<br/>
<a href="https://rlberry.readthedocs.io/en/stable/">Old version of doc</a>
<a href="{{ pathto('versions')}}">Other versions</a>
</p>

</div>
{%- endif %}
{%- if meta and meta['parenttoc']|tobool %}
Expand Down
2 changes: 1 addition & 1 deletion docs/themes/scikit-learn-fork/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<div id="searchbox" role="search">
<div class="searchformwrapper">
<form action="https://duckduckgo.com/">
<input type="hidden" id="sites" name="sites" value="https://rlberry.readthedocs.io">
<input type="hidden" id="sites" name="sites" value="https://rlberry-py.github.io/rlberry/">
<input type="search" placeholder="Search &hellip;" value="" name="q" />
<input class="sk-search-text-btn" type="submit" value="{{ _('Go') }}" /></form>

Expand Down
Loading

0 comments on commit 47f6d06

Please sign in to comment.