From ebbd0d1c0b271635fdafd98d9ab1d550ad66a852 Mon Sep 17 00:00:00 2001 From: Maximilian Naumann Date: Sun, 22 Dec 2024 14:58:13 +0100 Subject: [PATCH] Add temporary docs for PRs (#24) --- .github/workflows/cd.yml | 27 +++++++++++++++++++++ .github/workflows/ci.yml | 51 +++++++++++++++++++++------------------- CODEOWNERS | 2 +- mkdocs.yml | 1 + 4 files changed, 56 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/cd.yml 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/CODEOWNERS b/CODEOWNERS index ab86a48..22c4f5c 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1 +1 @@ -* @m-naumann @jtruetsch @keroe @immel-f +* @m-naumann @jtruetsch @keroe @immel-f @annikajuliabaetz 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: