From 3002756d22c0a07c059041598963947ac282b190 Mon Sep 17 00:00:00 2001 From: schroedtert Date: Fri, 22 Sep 2023 12:06:04 +0200 Subject: [PATCH] Build PR preview --- .github/workflows/docs.yml | 38 --------------------------- .github/workflows/pr-docs.yml | 41 ++++++++++++++++++++++++++++++ docs/{source => }/requirements.txt | 0 3 files changed, 41 insertions(+), 38 deletions(-) delete mode 100644 .github/workflows/docs.yml rename docs/{source => }/requirements.txt (100%) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index cba750df6b..0000000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,38 +0,0 @@ -# This is a basic workflow to help you get started with Actions -name: Build documentation - -# Controls when the workflow will run -on: - # Triggers the workflow on push or pull request events but only for the master branch - push: - branches: [ master ] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - # This workflow contains a single job called "build" - build: - # The type of runner that the job will run on - runs-on: ubuntu:23-04 - steps: - - name: Checkout - uses: actions/checkout@master - with: - fetch-depth: 0 # otherwise, you will fail to push refs to dest repo - - name: Install dependencies - run: | - sudo apt-get update; - sudo apt-get install -y g++ cmake ninja-build python3-full - python -m pip install --upgrade pip - pip install .[doc] - - name: Build and Commit - uses: sphinx-notes/pages@master - with: - documentation_path: doc/source - - name: Push changes - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: gh-pages \ No newline at end of file diff --git a/.github/workflows/pr-docs.yml b/.github/workflows/pr-docs.yml index e69de29bb2..4189856a46 100644 --- a/.github/workflows/pr-docs.yml +++ b/.github/workflows/pr-docs.yml @@ -0,0 +1,41 @@ +name: Deploy PR previews + +on: + pull_request: + types: + - opened + - reopened + - synchronize + - closed + +concurrency: preview-${{ github.ref }} + +jobs: + deploy-preview: + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install dependencies + run: + sudo apt-get update && sudo apt-get install -y g++ cmake ninja-build + + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: "3.11" + + - name: Install jupedsim + run: | + pip install . + + - name: Build documentation + run: | + python3 -m pip install -r docs/requirements.txt + sphinx-build docs/source docs/build -j$(nproc) + + - name: Deploy preview + uses: rossjrw/pr-preview-action@v1 + with: + source-dir: ./docs/build/ diff --git a/docs/source/requirements.txt b/docs/requirements.txt similarity index 100% rename from docs/source/requirements.txt rename to docs/requirements.txt