Skip to content

Commit e9368a7

Browse files
matsumotosanBorda
andauthored
ci: uv for docs-build (#21206)
replace pip with uv Co-authored-by: Jirka Borovec <[email protected]>
1 parent 3bdf8ee commit e9368a7

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

.github/workflows/docs-build.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,23 +71,29 @@ jobs:
7171
# only Pytorch has/uses notebooks
7272
submodules: ${{ matrix.pkg-name == 'pytorch' }}
7373
lfs: ${{ matrix.pkg-name == 'pytorch' }}
74-
- uses: actions/setup-python@v6
74+
75+
- name: Install uv and set Python version
76+
uses: astral-sh/setup-uv@v6
7577
with:
7678
python-version: "3.10"
79+
# TODO: Avoid activating environment like this
80+
# see: https://github.com/astral-sh/setup-uv/tree/v6/?tab=readme-ov-file#activate-environment
81+
activate-environment: true
82+
enable-cache: true
7783

7884
- name: List notebooks
7985
if: ${{ matrix.pkg-name == 'pytorch' }}
8086
working-directory: _notebooks/
8187
run: |
82-
pip install -q py-tree
88+
uv pip install -q py-tree
8389
py-tree .notebooks/
8490
ls -lhR .notebooks/
8591
8692
- name: Pull sphinx template
8793
run: |
88-
pip install -q -r requirements/ci.txt
94+
uv pip install -q -r requirements/ci.txt
8995
aws s3 sync --no-sign-request s3://sphinx-packages/ ${PYPI_LOCAL_DIR}
90-
pip install lai-sphinx-theme -U -f ${PYPI_LOCAL_DIR}
96+
uv pip install lai-sphinx-theme -U -f ${PYPI_LOCAL_DIR}
9197
9298
- name: pip wheels cache
9399
uses: actions/cache/restore@v4
@@ -101,25 +107,29 @@ jobs:
101107
run: |
102108
sudo apt-get update --fix-missing
103109
sudo apt-get install -y pandoc
110+
104111
- name: Install package & dependencies
105112
timeout-minutes: 20
106113
run: |
107114
mkdir -p ${PYPI_CACHE_DIR} # in case cache was not hit
108115
ls -lh ${PYPI_CACHE_DIR}
109-
pip install .[all] -U -r requirements/${{ matrix.pkg-name }}/docs.txt \
116+
uv pip install .[all] -U -r requirements/${{ matrix.pkg-name }}/docs.txt \
110117
-f ${PYPI_LOCAL_DIR} -f ${PYPI_CACHE_DIR} --extra-index-url="${TORCH_URL}"
111-
pip list
118+
uv pip list
119+
112120
- name: Install req. for Notebooks/tutorials
113121
if: matrix.pkg-name == 'pytorch'
114122
timeout-minutes: 10
115-
run: pip install -q -r _notebooks/.actions/requires.txt
123+
run: uv pip install -q -r _notebooks/.actions/requires.txt
116124

117125
- name: Full build for deployment
118126
if: github.event_name != 'pull_request'
119127
run: echo "DOCS_FETCH_ASSETS=1" >> $GITHUB_ENV
128+
120129
- name: Build without warnings
121130
if: github.event_name != 'workflow_dispatch'
122131
run: echo "BUILD_SPHINX_OPTS=-W --keep-going" >> $GITHUB_ENV
132+
123133
- name: Make ${{ matrix.target }}
124134
working-directory: ./docs/source-${{ matrix.pkg-name }}
125135
# allow failing link check and doctest if you run with dispatch
@@ -129,6 +139,7 @@ jobs:
129139
- name: Keep artifact
130140
if: github.event_name == 'pull_request'
131141
run: echo "ARTIFACT_DAYS=7" >> $GITHUB_ENV
142+
132143
- name: Upload built docs
133144
if: ${{ matrix.target == 'html' }}
134145
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)