diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 198b7f9..667682e 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -8,6 +8,12 @@ on: pull_request: branches: [ main, develop ] workflow_dispatch: + inputs: + deploy_docs: + description: Build and deploy the documentation without publishing to PyPI + required: true + default: false + type: boolean jobs: @@ -93,8 +99,10 @@ jobs: deploy-docs: needs: test - # only on pushes tagged with v... - if: startsWith(github.ref, 'refs/tags/v') + # Run for releases or when explicitly requested from the Actions UI. + if: >- + startsWith(github.ref, 'refs/tags/v') || + (github.event_name == 'workflow_dispatch' && inputs.deploy_docs) runs-on: ubuntu-latest environment: asim defaults: @@ -102,40 +110,27 @@ jobs: shell: bash -l {0} steps: - uses: actions/checkout@v4 - - name: Set up Python 3.10 - uses: actions/setup-python@v5 + - name: Install uv and set Python 3.10 + uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 with: + version: "0.12.2" python-version: "3.10" + enable-cache: true - name: Install dependencies - uses: conda-incubator/setup-miniconda@v3 - with: - miniforge-version: latest - environment-file: envs/testing.yml - python-version: "3.10" - activate-environment: testing-env - auto-activate-base: false - auto-update-conda: false - - name: Install Jupyterbook and ruamel.yaml - run: | - # The docs use the Jupyter Book 1.x Sphinx project layout. - conda install "jupyter-book<2" ruamel.yaml sphinx-autosummary-accessors -c conda-forge - - name: Install sharrow - run: | - python -m pip install --no-deps . - - name: Conda checkup run: | - conda info -a - conda list - - name: Install pip build + uv sync --locked --dev + - name: UV checkup run: | - python -m pip install --upgrade build + uv --version + uv run --locked python --version + uv pip list - name: Build wheel run: | - python -m build + uv build - name: Build the docs run: | - python docs/_script/run_all.py - jupyter-book build ./docs + uv run --locked --with-requirements docs/requirements.txt python docs/_script/run_all.py + uv run --locked --with-requirements docs/requirements.txt jupyter-book build ./docs - name: Push to GitHub Pages uses: peaceiris/actions-gh-pages@v3.5.9 with: @@ -145,7 +140,10 @@ jobs: # now send to PyPI - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@release/v1 - if: github.repository_owner == 'ActivitySim' + if: >- + github.event_name == 'push' && + github.repository_owner == 'ActivitySim' && + startsWith(github.ref, 'refs/tags/v') with: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/docs/requirements.txt b/docs/requirements.txt index 6162bd0..7fe0f65 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,4 +1,5 @@ jupyter-book < 2 +ruamel.yaml matplotlib numpy >= 1.19 pandas >= 1.2