diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..b0b914b --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,27 @@ +name: Continuous Deployment + +on: + push: + branches: [ main ] + +jobs: + deploy-docs: + runs-on: ubuntu-latest + concurrency: deploy-${{ github.ref }} + steps: + - uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v4 + with: + version: "0.5.10" + + - name: Set up env + run: uv sync --all-extras --frozen + + - name: Copy notebooks to docs folder + run: cp -r notebooks/* docs/notebooks + + - run: | + uv run ipython kernel install --user --name=behavior_generation_lecture + uv run mkdocs gh-deploy --force diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d4f40b5..a006528 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,5 @@ -name: Continuous Integration and Deployment +name: Continuous Integration + on: push: branches: [ main ] @@ -7,8 +8,11 @@ on: - cron: "0 3 * * 1" # Run every Monday 3 am jobs: - test: + ci: runs-on: ubuntu-latest + permissions: + pull-requests: write + contents: write steps: - uses: actions/checkout@v4 @@ -21,7 +25,7 @@ jobs: run: sudo apt install python3-tk -y - name: Set up env - run: uv sync --all-extras + run: uv sync --all-extras --frozen - name: Run ruff format run: uv run ruff format @@ -47,32 +51,31 @@ jobs: - name: Copy notebooks to docs folder run: cp -r notebooks/* docs/notebooks - - name: Build docs + - name: Build PR docs (including running the notebooks) run: | + sed -i "s/^site_name:.*$/site_name: 'Behavior Generation Lecture - tmp docs for PR ${{ github.event.pull_request.number }}'/" mkdocs.yml uv run ipython kernel install --user --name=behavior_generation_lecture - uv run mkdocs build + uv run mkdocs build --site-dir site/pr-${{ github.event.pull_request.number }} - deploy-pages: - runs-on: ubuntu-latest - needs: [test] - if: github.ref == 'refs/heads/main' - concurrency: deploy-${{ github.ref }} - steps: - - uses: actions/checkout@v4 - - - name: Install uv - uses: astral-sh/setup-uv@v4 + - name: Deploy PR docs + if: github.event_name == 'pull_request' + uses: peaceiris/actions-gh-pages@v4 with: - version: "0.5.10" + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: site/pr-${{ github.event.pull_request.number }} + destination_dir: pr-${{ github.event.pull_request.number }} # Deploy to subdirectory + publish_branch: gh-pages + keep_files: true # Retain other content on gh-pages + + - name: Add PR note + if: github.event_name == 'pull_request' + uses: marocchino/sticky-pull-request-comment@v2 + with: + message: | + ### :books: Docs - - name: Set up env - run: uv sync --all-extras + Created [temporary docs](https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr-${{ github.event.pull_request.number }}/). + - - name: Copy notebooks to docs folder - run: cp -r notebooks/* docs/notebooks - - - run: | - uv run ipython kernel install --user --name=behavior_generation_lecture - uv run mkdocs gh-deploy --force diff --git a/mkdocs.yml b/mkdocs.yml index 7a77ab3..f3a73c8 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -45,6 +45,7 @@ nav: - Decision Making: - Value Iteration: notebooks/mdp_value_iteration.ipynb - Q-Learning: notebooks/mdp_q_learning.ipynb + - Policy Gradient: notebooks/mdp_policy_gradient.ipynb - API Documentation (partial): reference/ plugins: diff --git a/notebooks/a_star_notebook.ipynb b/notebooks/a_star_notebook.ipynb index ec95db9..101f7db 100644 --- a/notebooks/a_star_notebook.ipynb +++ b/notebooks/a_star_notebook.ipynb @@ -59,9 +59,9 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "behavior_generation_lecture", "language": "python", - "name": "python3" + "name": "behavior_generation_lecture" }, "language_info": { "codemirror_mode": { diff --git a/notebooks/lateral_control_state_based_notebook.ipynb b/notebooks/lateral_control_state_based_notebook.ipynb index a939f95..d760899 100644 --- a/notebooks/lateral_control_state_based_notebook.ipynb +++ b/notebooks/lateral_control_state_based_notebook.ipynb @@ -83,9 +83,9 @@ "hash": "ea80bdc8d9eecdfb0ad4850befec70bcf98ec6f56b32ef8090165e65e0e9c093" }, "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "behavior_generation_lecture", "language": "python", - "name": "python3" + "name": "behavior_generation_lecture" }, "language_info": { "codemirror_mode": { diff --git a/notebooks/mdp_policy_gradient.ipynb b/notebooks/mdp_policy_gradient.ipynb index 004fe14..22dce58 100644 --- a/notebooks/mdp_policy_gradient.ipynb +++ b/notebooks/mdp_policy_gradient.ipynb @@ -211,9 +211,9 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "behavior_generation_lecture", "language": "python", - "name": "python3" + "name": "behavior_generation_lecture" }, "language_info": { "codemirror_mode": { diff --git a/notebooks/mdp_q_learning.ipynb b/notebooks/mdp_q_learning.ipynb index cbcc6d9..3d3b08d 100644 --- a/notebooks/mdp_q_learning.ipynb +++ b/notebooks/mdp_q_learning.ipynb @@ -191,9 +191,9 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "behavior_generation_lecture", "language": "python", - "name": "python3" + "name": "behavior_generation_lecture" }, "language_info": { "codemirror_mode": { diff --git a/notebooks/mdp_value_iteration.ipynb b/notebooks/mdp_value_iteration.ipynb index 4e0e37f..6d18864 100644 --- a/notebooks/mdp_value_iteration.ipynb +++ b/notebooks/mdp_value_iteration.ipynb @@ -191,9 +191,9 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "behavior_generation_lecture", "language": "python", - "name": "python3" + "name": "behavior_generation_lecture" }, "language_info": { "codemirror_mode": {