Skip to content

Commit

Permalink
Move commands into make files; Remove remaining merge queue commands
Browse files Browse the repository at this point in the history
  • Loading branch information
schloerke committed Jul 23, 2024
1 parent 1c4ade1 commit bac659a
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 98 deletions.
4 changes: 2 additions & 2 deletions .github/py-shiny/pytest-browsers/action.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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'
Expand Down
29 changes: 3 additions & 26 deletions .github/py-shiny/setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,8 @@ 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
Expand All @@ -33,34 +29,15 @@ runs:
run: |
echo "UV_SYSTEM_PYTHON=1" >> $GITHUB_ENV
# - name: Create virtual environment
# shell: bash
# run: |
# uv venv venv

- name: Install dependencies
shell: bash
run: |
# make install-deps
uv pip install "htmltools @ git+https://github.com/posit-dev/py-htmltools.git"
uv pip install -e ".[dev,test]"
make ci-install-deps
- name: Install
shell: bash
run: |
# make install
# make clean
# make dist
uv pip install setuptools
python setup.py sdist
python setup.py bdist_wheel
ls -l dist
# make install
uv pip uninstall shiny
uv pip install dist/shiny*.whl
make ci-install-wheel
- name: Install backports.tarfile
if: ${{ startsWith(inputs.python-version, '3.8') }}
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/build-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
push:
branches: ["main"]
pull_request:
merge_group:

jobs:
build-docs:
Expand Down Expand Up @@ -33,10 +32,7 @@ jobs:

- name: Install dependencies
run: |
# install docs dependencies
uv pip install -e ".[dev,test,doc]"
uv pip install "htmltools @ git+https://github.com/posit-dev/py-htmltools.git" \
"shinylive @ git+https://github.com/posit-dev/py-shinylive.git"
make ci-install-docs
- name: Run quartodoc
run: |
Expand Down Expand Up @@ -77,7 +73,7 @@ jobs:
# =====================================================

- name: Build site
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'merge_group' || startsWith(github.head_ref, 'docs') }}
if: ${{ github.ref == 'refs/heads/main' || (!github.event.pull_request.draft) || startsWith(github.head_ref, 'docs') }}
run: |
cd docs
make site
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:

- name: Install rsconnect
run: |
uv pip install "rsconnect_python @ git+https://github.com/rstudio/rsconnect-python.git"
make ci-install-rsconnect
- name: Test that deployable example apps work
timeout-minutes: 5 # ~10s locally
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
branches: ["main", "rc-*"]
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
merge_group:
release:
types: [published]
schedule:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/verify-js-built.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches: ["main", "rc-*"]
pull_request:
merge_group:

jobs:
verify_js_built:
Expand Down
34 changes: 31 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ for line in sys.stdin:
endef
export PRINT_HELP_PYSCRIPT

BROWSER := python -c "$$BROWSER_PYSCRIPT"
BROWSER := python3 -c "$$BROWSER_PYSCRIPT"

help: FORCE
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
@python3 -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts

Expand Down Expand Up @@ -98,7 +98,7 @@ check-pyright: pyright-typings
pyright
check-pytest: FORCE
@echo "-------- Running tests with pytest ----------"
python3 tests/pytest/asyncio_prevent.py
python tests/pytest/asyncio_prevent.py
pytest

# Check types with pyright
Expand Down Expand Up @@ -192,6 +192,13 @@ dist: clean ## builds source and wheel package
python3 setup.py sdist
python3 setup.py bdist_wheel
ls -l dist
ci-dist: FORCE
$(MAKE) clean
pip install setuptools
python setup.py sdist
python setup.py bdist_wheel
ls -l dist


## install the package to the active Python's site-packages
# Note that instead of --force-reinstall, we uninstall and then install, because
Expand All @@ -200,9 +207,30 @@ dist: clean ## builds source and wheel package
install: dist
pip uninstall -y shiny
python3 -m pip install dist/shiny*.whl
ci-install-wheel: FORCE
$(MAKE) ci-dist
# make install
uv pip uninstall shiny
uv pip install dist/shiny*.whl

install-deps: FORCE ## install dependencies
pip install -e ".[dev,test]" --upgrade
ci-install-deps: FORCE
uv pip install "htmltools @ git+https://github.com/posit-dev/py-htmltools.git"
uv pip install -e ".[dev,test]"

install-docs: FORCE
pip install -e ".[dev,test,doc]"
pip install https://github.com/posit-dev/py-htmltools/tarball/main
pip install https://github.com/posit-dev/py-shinylive/tarball/main
ci-install-docs: FORCE
uv pip install -e ".[dev,test,doc]"
uv pip install "htmltools @ git+https://github.com/posit-dev/py-htmltools.git" \
"shinylive @ git+https://github.com/posit-dev/py-shinylive.git"

ci-install-rsconnect: FORCE
uv pip install "rsconnect-python @ git+https://github.com/rstudio/rsconnect-python.git"


# ## If caching is ever used, we could run:
# install-deps: FORCE ## install latest dependencies
Expand Down
92 changes: 34 additions & 58 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.PHONY: help Makefile
# Using `FORCE` as prerequisite to _force_ the target to always run; https://www.gnu.org/software/make/manual/make.html#index-FORCE
FORCE: ;

.PHONY: Makefile
.DEFAULT_GOAL := help

define BROWSER_PYSCRIPT
Expand All @@ -21,86 +24,59 @@ for line in sys.stdin:
endef
export PRINT_HELP_PYSCRIPT

BROWSER := python -c "$$BROWSER_PYSCRIPT"

# Use venv from parent
VENV = ../venv
PYBIN = $(VENV)/bin

# Any targets that depend on $(VENV) or $(PYBIN) will cause the venv to be
# created. To use the venv, python scripts should run with the prefix $(PYBIN),
# as in `$(PYBIN)/pip`.
$(VENV):
python3 -m venv $(VENV)

$(PYBIN): $(VENV)


help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

dev-htmltools: $(PYBIN) ## Install development version of htmltools
$(PYBIN)/pip install https://github.com/posit-dev/py-htmltools/tarball/main
BROWSER := python3 -c "$$BROWSER_PYSCRIPT"

dev-shinylive: $(PYBIN) ## Install development version of shinylive
$(PYBIN)/pip install https://github.com/posit-dev/py-shinylive/tarball/main
help: FORCE
@python3 -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

deps: $(PYBIN) dev-htmltools dev-shinylive ## Install build dependencies
$(PYBIN)/pip install pip --upgrade
$(PYBIN)/pip install ..[doc]
deps: FORCE ## Install build dependencies
cd .. && $(MAKE) install-

quartodoc: quartodoc_build_core quartodoc_build_express quartodoc_build_test quartodoc_post ## Build quartodocs for express and core
quartodoc: quartodoc_build_core quartodoc_build_express quartodoc_build_test quartodoc_post ## Build quartodocs for express, core, and testing

## Build interlinks for API docs
quartodoc_interlinks: $(PYBIN)
. $(PYBIN)/activate \
&& quartodoc interlinks
quartodoc_interlinks: FORCE
quartodoc interlinks

## Build core API docs
quartodoc_build_core: $(PYBIN) quartodoc_interlinks
quartodoc_build_core: quartodoc_interlinks FORCE
$(eval export SHINY_ADD_EXAMPLES=true)
$(eval export IN_QUARTODOC=true)
$(eval export SHINY_MODE=core)
. $(PYBIN)/activate \
&& echo "::group::quartodoc build core docs" \
&& quartodoc build --config _quartodoc-core.yml --verbose \
&& mv objects.json _objects_core.json \
&& echo "::endgroup::"
@echo "::group::quartodoc build core docs"
quartodoc build --config _quartodoc-core.yml --verbose \
&& mv objects.json _objects_core.json
@echo "::endgroup::"

## Build express API docs
quartodoc_build_express: $(PYBIN) quartodoc_interlinks
quartodoc_build_express: quartodoc_interlinks FORCE
$(eval export SHINY_ADD_EXAMPLES=true)
$(eval export IN_QUARTODOC=true)
$(eval export SHINY_MODE=express)
. $(PYBIN)/activate \
&& echo "::group::quartodoc build express docs" \
&& quartodoc build --config _quartodoc-express.yml --verbose \
&& mv objects.json _objects_express.json \
&& echo "::endgroup::"
@echo "::group::quartodoc build express docs"
quartodoc build --config _quartodoc-express.yml --verbose \
&& mv objects.json _objects_express.json
@echo "::endgroup::"

## Build test API docs
quartodoc_build_test: $(PYBIN) quartodoc_interlinks
quartodoc_build_test: quartodoc_interlinks FORCE
$(eval export SHINY_ADD_EXAMPLES=true)
$(eval export IN_QUARTODOC=true)
$(eval export SHINY_MODE=express)
. $(PYBIN)/activate \
&& echo "::group::quartodoc build testing docs" \
&& quartodoc build --config _quartodoc-testing.yml --verbose \
&& mv objects.json _objects_test.json \
&& echo "::endgroup::"
@echo "::group::quartodoc build testing docs"
quartodoc build --config _quartodoc-testing.yml --verbose \
&& mv objects.json _objects_test.json
@echo "::endgroup::"

## Clean up after quartodoc build
quartodoc_post: $(PYBIN)
. $(PYBIN)/activate \
&& python _combine_objects_json.py
quartodoc_post: FORCE
python _combine_objects_json.py

site: ## Build website
. $(PYBIN)/activate \
&& quarto render
site: FORCE ## Build website (quarto render)
quarto render

serve: ## Build website and serve
. $(PYBIN)/activate \
&& quarto preview --port 8080
serve: FORCE ## Build website and serve (quarto preview)
&& quarto preview --port 8080

clean: ## Clean build artifacts
clean: FORCE ## Clean build artifacts
rm -rf _inv api _site .quarto

0 comments on commit bac659a

Please sign in to comment.