Skip to content

Commit 12d39cf

Browse files
authored
Merge branch 'main' into feat-narwhals
2 parents bbe6261 + 4d2056e commit 12d39cf

File tree

23 files changed

+403
-227
lines changed

23 files changed

+403
-227
lines changed

.github/py-shiny/pytest-browsers/action.yaml

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,59 @@
1-
name: 'Custom merge queue browsers'
2-
description: 'Trim down pytest browsers for any github event other than merge_group.'
1+
name: 'Trim down pytest browsers'
2+
description: 'Trim down pytest browsers so the browser tabs are not shut down between tests, speeding up testing.'
33
inputs:
4+
browser:
5+
description: 'Browser to use for testing. Currently supports `chromium`, `firefox`, and `webkit`.'
6+
required: false
7+
default: ''
48
all-browsers:
59
description: 'Force all pytest browsers to used when testing'
610
required: false
711
default: 'false'
12+
disable-playwright-diagnostics:
13+
description: 'Disable playwright diagnostics: tracing, video, screenshot'
14+
required: false
15+
default: 'true'
816
outputs:
917
browsers:
1018
description: 'pytest browsers to use'
1119
value: ${{ steps.browsers.outputs.browsers }}
20+
has-playwright-diagnostics:
21+
description: 'Whether playwright diagnostics have been enabled'
22+
value: ${{ steps.browsers.outputs.has-playwright-diagnostics }}
23+
playwright-diagnostic-args:
24+
description: 'Args to supply to `make playwright` like commands.'
25+
value: ${{ steps.browsers.outputs.playwright-diagnostic-args }}
1226
runs:
1327
using: "composite"
1428
steps:
1529
- name: Determine browsers to use
1630
shell: bash
1731
id: browsers
1832
run: |
33+
# Determine which browsers to use
34+
35+
if [ "${{ inputs.disable-playwright-diagnostics }}" == "true" ]; then
36+
echo "Disabling playwright diagnostics!"
37+
echo 'has-playwright-diagnostics=false' >> "$GITHUB_OUTPUT"
38+
echo 'playwright-diagnostic-args=--tracing off --video off --screenshot off' >> "$GITHUB_OUTPUT"
39+
else
40+
echo "Using playwright diagnostics!"
41+
echo 'has-playwright-diagnostics=true' >> "$GITHUB_OUTPUT"
42+
echo 'playwright-diagnostic-args=--tracing=retain-on-failure --video=retain-on-failure --screenshot=only-on-failure --full-page-screenshot --output=test-results' >> "$GITHUB_OUTPUT"
43+
fi
44+
45+
if [ "${{ inputs.browser }}" != "" ]; then
46+
BROWSER="${{ inputs.browser }}"
47+
48+
if [ "$BROWSER" == "chromium" ] || [ "$BROWSER" == "firefox" ] || [ "$BROWSER" == "webkit" ]; then
49+
echo "Using custom browser $BROWSER !"
50+
echo "browsers=PYTEST_BROWSERS=\"--browser $BROWSER\"" >> "$GITHUB_OUTPUT"
51+
exit 0
52+
fi
53+
echo "Unknown browser: $BROWSER"
54+
exit 1
55+
fi
56+
1957
if [ "${{ inputs.all-browsers }}" == "true" ]; then
2058
echo "Using all browsers!"
2159
exit 0

.github/py-shiny/setup/action.yaml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,40 @@ runs:
1212
uses: actions/setup-python@v5
1313
with:
1414
python-version: ${{ inputs.python-version }}
15-
# # Caching with pip only saves ~15 seconds. Not work risks of confusion.
16-
# cache: 'pip'
17-
# cache-dependency-path: |
18-
# setup.cfg
1915

20-
- name: Upgrade pip
16+
- name: Upgrade `pip`
2117
shell: bash
22-
run: python -m pip install --upgrade pip
18+
run: |
19+
python -m pip install --upgrade pip
2320
24-
- name: Pip list
21+
- name: Install `uv`
22+
shell: bash
23+
run: |
24+
pip install uv
25+
26+
# https://github.com/astral-sh/uv/blob/main/docs/guides/integration/github.md#using-uv-pip
27+
- name: Allow uv to use the system Python by default
2528
shell: bash
2629
run: |
27-
pip list
30+
echo "UV_SYSTEM_PYTHON=1" >> $GITHUB_ENV
2831
2932
- name: Install dependencies
3033
shell: bash
3134
run: |
32-
pip install https://github.com/rstudio/py-htmltools/tarball/main
33-
make install-deps
35+
make ci-install-deps
3436
3537
- name: Install
3638
shell: bash
3739
run: |
38-
make install
40+
make ci-install-wheel
3941
4042
- name: Install backports.tarfile
4143
if: ${{ startsWith(inputs.python-version, '3.8') }}
4244
shell: bash
4345
run: |
44-
pip install backports.tarfile
46+
uv pip install backports.tarfile
4547
4648
- name: Pip list
4749
shell: bash
4850
run: |
49-
pip list
51+
uv pip list

.github/workflows/build-docs.yaml

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
name: Build API docs and Shinylive for GitHub Pages
22

3+
# Allow for `main` branch to build full website and deploy
4+
# Allow branches that start with `docs-` to build full website, but not deploy
5+
# Allow for PRs to build quartodoc only. (No shinylive, no site build, no deploy)
6+
37
on:
48
workflow_dispatch:
59
push:
6-
branches: ["main"]
10+
branches: ["main", "docs-**"]
711
pull_request:
8-
merge_group:
912

1013
jobs:
1114
build-docs:
@@ -18,14 +21,11 @@ jobs:
1821
steps:
1922
- uses: actions/checkout@v4
2023

21-
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v5
24+
- name: Setup py-shiny
25+
uses: ./.github/py-shiny/setup
2326
with:
2427
python-version: ${{ matrix.python-version }}
2528

26-
- name: Upgrade pip
27-
run: python -m pip install --upgrade pip
28-
2929
# =====================================================
3030
# API docs
3131
# =====================================================
@@ -36,53 +36,48 @@ jobs:
3636

3737
- name: Install dependencies
3838
run: |
39-
cd docs
40-
make ../venv
41-
make deps
39+
make ci-install-docs
4240
4341
- name: Run quartodoc
4442
run: |
45-
cd docs
46-
make quartodoc
43+
make docs-quartodoc
4744
4845
# =====================================================
4946
# Shinylive
5047
# =====================================================
5148
- name: Check out shinylive
52-
if: github.ref == 'refs/heads/main'
49+
if: github.event_name != 'pull_request'
5350
uses: actions/checkout@v4
5451
with:
5552
repository: rstudio/shinylive
5653
ref: main
5754
path: shinylive-repo
5855

5956
- name: Update shinylive's copy of shiny and htmltools
60-
if: github.ref == 'refs/heads/main'
57+
if: github.event_name != 'pull_request'
6158
run: |
6259
cd shinylive-repo
6360
make submodules
6461
make submodules-pull-shiny
6562
make submodules-pull-htmltools
6663
6764
- name: Build shinylive
68-
if: github.ref == 'refs/heads/main'
65+
if: github.event_name != 'pull_request'
6966
run: |
7067
cd shinylive-repo
7168
make all
7269
7370
- name: Use local build of shinylive for building docs
74-
if: github.ref == 'refs/heads/main'
71+
if: github.event_name != 'pull_request'
7572
run: |
76-
. venv/bin/activate
77-
cd shinylive-repo
78-
shinylive assets install-from-local ./build
73+
cd shinylive-repo && shinylive assets install-from-local ./build
7974
8075
# =====================================================
8176
# Build site
8277
# =====================================================
8378

8479
- name: Build site
85-
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'merge_group' || startsWith(github.head_ref, 'docs') }}
80+
if: github.event_name != 'pull_request'
8681
run: |
8782
cd docs
8883
make site

.github/workflows/deploy-tests.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ jobs:
2525
with:
2626
python-version: ${{ matrix.python-version }}
2727

28+
- name: Install rsconnect
29+
run: |
30+
make ci-install-rsconnect
31+
2832
- name: Test that deployable example apps work
2933
timeout-minutes: 5 # ~10s locally
3034
env:

0 commit comments

Comments
 (0)