Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
schloerke authored Jul 26, 2024
2 parents bbec48b + 4d2056e commit fd871cf
Show file tree
Hide file tree
Showing 21 changed files with 399 additions and 225 deletions.
42 changes: 40 additions & 2 deletions .github/py-shiny/pytest-browsers/action.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,59 @@
name: 'Custom merge queue browsers'
description: 'Trim down pytest browsers for any github event other than merge_group.'
name: 'Trim down pytest browsers'
description: 'Trim down pytest browsers so the browser tabs are not shut down between tests, speeding up testing.'
inputs:
browser:
description: 'Browser to use for testing. Currently supports `chromium`, `firefox`, and `webkit`.'
required: false
default: ''
all-browsers:
description: 'Force all pytest browsers to used when testing'
required: false
default: 'false'
disable-playwright-diagnostics:
description: 'Disable playwright diagnostics: tracing, video, screenshot'
required: false
default: 'true'
outputs:
browsers:
description: 'pytest browsers to use'
value: ${{ steps.browsers.outputs.browsers }}
has-playwright-diagnostics:
description: 'Whether playwright diagnostics have been enabled'
value: ${{ steps.browsers.outputs.has-playwright-diagnostics }}
playwright-diagnostic-args:
description: 'Args to supply to `make playwright` like commands.'
value: ${{ steps.browsers.outputs.playwright-diagnostic-args }}
runs:
using: "composite"
steps:
- name: Determine browsers to use
shell: bash
id: browsers
run: |
# Determine which browsers to use
if [ "${{ inputs.disable-playwright-diagnostics }}" == "true" ]; then
echo "Disabling playwright diagnostics!"
echo 'has-playwright-diagnostics=false' >> "$GITHUB_OUTPUT"
echo 'playwright-diagnostic-args=--tracing off --video off --screenshot off' >> "$GITHUB_OUTPUT"
else
echo "Using playwright diagnostics!"
echo 'has-playwright-diagnostics=true' >> "$GITHUB_OUTPUT"
echo 'playwright-diagnostic-args=--tracing=retain-on-failure --video=retain-on-failure --screenshot=only-on-failure --full-page-screenshot --output=test-results' >> "$GITHUB_OUTPUT"
fi
if [ "${{ inputs.browser }}" != "" ]; then
BROWSER="${{ inputs.browser }}"
if [ "$BROWSER" == "chromium" ] || [ "$BROWSER" == "firefox" ] || [ "$BROWSER" == "webkit" ]; then
echo "Using custom browser $BROWSER !"
echo "browsers=PYTEST_BROWSERS=\"--browser $BROWSER\"" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "Unknown browser: $BROWSER"
exit 1
fi
if [ "${{ inputs.all-browsers }}" == "true" ]; then
echo "Using all browsers!"
exit 0
Expand Down
28 changes: 15 additions & 13 deletions .github/py-shiny/setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,40 @@ runs:
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
# # Caching with pip only saves ~15 seconds. Not work risks of confusion.
# cache: 'pip'
# cache-dependency-path: |
# setup.cfg

- name: Upgrade pip
- name: Upgrade `pip`
shell: bash
run: python -m pip install --upgrade pip
run: |
python -m pip install --upgrade pip
- name: Pip list
- name: Install `uv`
shell: bash
run: |
pip install uv
# https://github.com/astral-sh/uv/blob/main/docs/guides/integration/github.md#using-uv-pip
- name: Allow uv to use the system Python by default
shell: bash
run: |
pip list
echo "UV_SYSTEM_PYTHON=1" >> $GITHUB_ENV
- name: Install dependencies
shell: bash
run: |
pip install https://github.com/rstudio/py-htmltools/tarball/main
make install-deps
make ci-install-deps
- name: Install
shell: bash
run: |
make install
make ci-install-wheel
- name: Install backports.tarfile
if: ${{ startsWith(inputs.python-version, '3.8') }}
shell: bash
run: |
pip install backports.tarfile
uv pip install backports.tarfile
- name: Pip list
shell: bash
run: |
pip list
uv pip list
35 changes: 15 additions & 20 deletions .github/workflows/build-docs.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
name: Build API docs and Shinylive for GitHub Pages

# Allow for `main` branch to build full website and deploy
# Allow branches that start with `docs-` to build full website, but not deploy
# Allow for PRs to build quartodoc only. (No shinylive, no site build, no deploy)

on:
workflow_dispatch:
push:
branches: ["main"]
branches: ["main", "docs-**"]
pull_request:
merge_group:

jobs:
build-docs:
Expand All @@ -18,14 +21,11 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Setup py-shiny
uses: ./.github/py-shiny/setup
with:
python-version: ${{ matrix.python-version }}

- name: Upgrade pip
run: python -m pip install --upgrade pip

# =====================================================
# API docs
# =====================================================
Expand All @@ -36,53 +36,48 @@ jobs:

- name: Install dependencies
run: |
cd docs
make ../venv
make deps
make ci-install-docs
- name: Run quartodoc
run: |
cd docs
make quartodoc
make docs-quartodoc
# =====================================================
# Shinylive
# =====================================================
- name: Check out shinylive
if: github.ref == 'refs/heads/main'
if: github.event_name != 'pull_request'
uses: actions/checkout@v4
with:
repository: rstudio/shinylive
ref: main
path: shinylive-repo

- name: Update shinylive's copy of shiny and htmltools
if: github.ref == 'refs/heads/main'
if: github.event_name != 'pull_request'
run: |
cd shinylive-repo
make submodules
make submodules-pull-shiny
make submodules-pull-htmltools
- name: Build shinylive
if: github.ref == 'refs/heads/main'
if: github.event_name != 'pull_request'
run: |
cd shinylive-repo
make all
- name: Use local build of shinylive for building docs
if: github.ref == 'refs/heads/main'
if: github.event_name != 'pull_request'
run: |
. venv/bin/activate
cd shinylive-repo
shinylive assets install-from-local ./build
cd shinylive-repo && shinylive assets install-from-local ./build
# =====================================================
# Build site
# =====================================================

- name: Build site
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'merge_group' || startsWith(github.head_ref, 'docs') }}
if: github.event_name != 'pull_request'
run: |
cd docs
make site
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/deploy-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install rsconnect
run: |
make ci-install-rsconnect
- name: Test that deployable example apps work
timeout-minutes: 5 # ~10s locally
env:
Expand Down
Loading

0 comments on commit fd871cf

Please sign in to comment.