Skip to content

Commit 499ce37

Browse files
committed
Merge branch 'main' into accordion-test-update
# Conflicts: # tests/playwright/controls.py
2 parents 4512291 + 023de32 commit 499ce37

File tree

1,122 files changed

+88669
-32307
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,122 files changed

+88669
-32307
lines changed

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: 'check py-shiny'
2+
description: 'Action that checks py-shiny in multiple steps so that any of them may fail but not prevent the others from running. Note, this action is used by py-htmltools as a way to consistently check py-shiny. If more checks are needed for py-htmltools to believe py-shiny is working, it should be added here.'
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Run unit tests
7+
shell: bash
8+
run: |
9+
# Run unit tests
10+
make check-tests
11+
12+
- name: Type check
13+
shell: bash
14+
run: |
15+
# Type check
16+
make check-types
17+
18+
- name: Lint code
19+
shell: bash
20+
run: |
21+
# Lint code
22+
make check-lint
23+
24+
- name: Verify code formatting
25+
shell: bash
26+
run: |
27+
# Verify code formatting
28+
make check-format
29+
30+
- name: Verify code can run with mypy (not Windows)
31+
if: ${{ runner.os != 'Windows' }}
32+
shell: bash
33+
run: |
34+
# Verify code can run with mypy (not Windows)
35+
make ci-check-mypy-can-run
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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.'
3+
inputs:
4+
browser:
5+
description: 'Browser to use for testing. Currently supports `chromium`, `firefox`, and `webkit`.'
6+
required: false
7+
default: ''
8+
all-browsers:
9+
description: 'Force all pytest browsers to used when testing'
10+
required: false
11+
default: 'false'
12+
disable-playwright-diagnostics:
13+
description: 'Disable playwright diagnostics: tracing, video, screenshot'
14+
required: false
15+
default: 'true'
16+
outputs:
17+
browsers:
18+
description: 'pytest browsers to use'
19+
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 }}
26+
runs:
27+
using: "composite"
28+
steps:
29+
- name: Determine browsers to use
30+
shell: bash
31+
id: browsers
32+
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 --screenshot=only-on-failure --full-page-screenshot --video off --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+
57+
if [ "${{ inputs.all-browsers }}" == "true" ]; then
58+
echo "Using all browsers!"
59+
exit 0
60+
fi
61+
62+
if [ "${{ github.event_name }}" == "pull_request" ]; then
63+
echo "Using chrome browser only!"
64+
echo 'browsers=PYTEST_BROWSERS="--browser chromium"' >> "$GITHUB_OUTPUT"
65+
fi
66+
67+
echo "No custom pytest browsers!"
68+
exit 0

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

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,48 @@ inputs:
44
python-version:
55
description: 'Python version to use'
66
required: false
7-
default: "3.11"
7+
default: "3.12"
88
runs:
99
using: "composite"
1010
steps:
1111
- name: Set up Python ${{ inputs.python-version }}
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
20+
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
28+
shell: bash
29+
run: |
30+
echo "UV_SYSTEM_PYTHON=1" >> $GITHUB_ENV
2331
2432
- name: Install dependencies
2533
shell: bash
2634
run: |
27-
pip install https://github.com/rstudio/py-htmltools/tarball/main
28-
pip install https://github.com/posit-dev/py-shinylive/tarball/main
29-
make install-deps
35+
make ci-install-deps
3036
3137
- name: Install
3238
shell: bash
3339
run: |
34-
make install
40+
make ci-install-wheel
41+
42+
- name: Install backports.tarfile
43+
if: ${{ startsWith(inputs.python-version, '3.8') }}
44+
shell: bash
45+
run: |
46+
uv pip install backports.tarfile
47+
48+
- name: Pip list
49+
shell: bash
50+
run: |
51+
uv pip list

.github/workflows/build-docs.yaml

Lines changed: 69 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,114 @@
1-
name: Build API docs
1+
name: Build API docs and Shinylive for GitHub Pages
2+
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)
26

37
on:
48
workflow_dispatch:
59
push:
6-
branches: ["main"]
10+
branches: ["main", "docs-**"]
711
pull_request:
812

913
jobs:
10-
build:
14+
build-docs:
1115
runs-on: ubuntu-latest
1216
strategy:
1317
matrix:
14-
python-version: ["3.11"]
18+
python-version: ["3.12"]
1519
fail-fast: false
1620

1721
steps:
18-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
1925

20-
- name: Set up Python ${{ matrix.python-version }}
21-
uses: actions/setup-python@v4
26+
- name: Setup py-shiny
27+
uses: ./.github/py-shiny/setup
2228
with:
2329
python-version: ${{ matrix.python-version }}
2430

25-
- name: Upgrade pip
26-
run: python -m pip install --upgrade pip
27-
31+
# =====================================================
32+
# API docs
33+
# =====================================================
2834
- name: Install Quarto
2935
uses: quarto-dev/quarto-actions/setup@v2
3036
with:
31-
version: 1.3.340
37+
version: 1.4.549
3238

3339
- name: Install dependencies
3440
run: |
35-
cd docs
36-
make ../venv
37-
. ../venv/bin/activate && pip install https://github.com/posit-dev/py-htmltools/tarball/main https://github.com/posit-dev/py-shinylive/tarball/main
38-
make deps
41+
make ci-install-docs
3942
4043
- name: Run quartodoc
4144
run: |
42-
cd docs
43-
make quartodoc
45+
make docs-quartodoc
46+
47+
# =====================================================
48+
# Shinylive
49+
# =====================================================
50+
- name: Check out shinylive
51+
if: github.event_name != 'pull_request'
52+
uses: actions/checkout@v4
53+
with:
54+
repository: rstudio/shinylive
55+
ref: main
56+
path: shinylive-repo
57+
58+
- name: Update shinylive's copy of shiny and htmltools
59+
if: github.event_name != 'pull_request'
60+
run: |
61+
cd shinylive-repo
62+
make submodules
63+
make submodules-pull-shiny
64+
make submodules-pull-htmltools
65+
66+
- name: Build shinylive
67+
if: github.event_name != 'pull_request'
68+
run: |
69+
cd shinylive-repo
70+
make all
71+
72+
- name: Use local build of shinylive for building docs
73+
if: github.event_name != 'pull_request'
74+
run: |
75+
cd shinylive-repo && shinylive assets install-from-local ./build
76+
77+
# =====================================================
78+
# Build site
79+
# =====================================================
4480

4581
- name: Build site
82+
if: github.event_name != 'pull_request'
4683
run: |
4784
cd docs
4885
make site
4986
87+
# =====================================================
88+
# Deploy
89+
# =====================================================
90+
91+
- name: Move built API docs and shinylive to single directory
92+
if: github.ref == 'refs/heads/main'
93+
run: |
94+
mkdir deploy
95+
mv docs/_site deploy/docs
96+
mv shinylive-repo/_shinylive deploy/shinylive
97+
5098
- name: Upload site artifact
5199
if: github.ref == 'refs/heads/main'
52100
uses: actions/upload-pages-artifact@v1
53101
with:
54-
path: "docs/_site"
55-
102+
path: "deploy"
56103

57104
deploy:
58105
if: github.ref == 'refs/heads/main'
59-
needs: build
106+
needs: build-docs
60107

61108
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
62109
permissions:
63-
pages: write # to deploy to Pages
64-
id-token: write # to verify the deployment originates from an appropriate source
110+
pages: write # to deploy to Pages
111+
id-token: write # to verify the deployment originates from an appropriate source
65112

66113
# Deploy to the github-pages environment
67114
environment:

0 commit comments

Comments
 (0)