Skip to content

Commit 982783d

Browse files
committed
CI: Add virtualenv
1 parent 1b429b4 commit 982783d

File tree

3 files changed

+49
-4
lines changed

3 files changed

+49
-4
lines changed

.github/workflows/build_offline_docs.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,33 @@ jobs:
2525
with:
2626
ref: ${{ matrix.branch }}
2727

28+
- name: Get Python version
29+
id: pythonv
30+
run: |
31+
echo "PYTHON_VERSION=$(python --version)" >> $GITHUB_OUTPUT
32+
33+
- name: Restore cached virtualenv
34+
uses: actions/cache/restore@v4
35+
with:
36+
key: venv-${{ runner.os }}-${{ steps.pythonv.outputs.PYTHON_VERSION }}-${{ hashFiles('requirements.txt') }}
37+
path: .venv
38+
2839
- name: Install dependencies
2940
run: |
30-
sudo pip3 install -r requirements.txt
41+
python -m venv .venv
42+
source .venv/bin/activate
43+
python -m pip install -r requirements.txt
44+
echo "$VIRTUAL_ENV/bin" >> $GITHUB_PATH
45+
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV
3146
sudo apt update
3247
sudo apt install parallel libwebp7
3348
49+
- name: Save virtualenv cache
50+
uses: actions/cache/save@v4
51+
with:
52+
key: venv-${{ runner.os }}-${{ steps.pythonv.outputs.PYTHON_VERSION }}-${{ hashFiles('requirements.txt') }}
53+
path: .venv
54+
3455
- name: Sphinx - Build HTML
3556
run: make SPHINXOPTS='--color -j 4' html
3657

.github/workflows/ci.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,33 @@ jobs:
1818
- name: Style checks via pre-commit
1919
uses: pre-commit/[email protected]
2020

21+
- name: Get Python version
22+
id: pythonv
23+
run: |
24+
echo "PYTHON_VERSION=$(python --version)" >> $GITHUB_OUTPUT
25+
26+
- name: Restore cached virtualenv
27+
uses: actions/cache/restore@v4
28+
with:
29+
key: venv-${{ runner.os }}-${{ steps.pythonv.outputs.PYTHON_VERSION }}-${{ hashFiles('requirements.txt') }}
30+
path: .venv
31+
2132
- name: Install dependencies
22-
run: sudo pip3 install -r requirements.txt
33+
run: |
34+
python -m venv .venv
35+
source .venv/bin/activate
36+
python -m pip install -r requirements.txt
37+
echo "$VIRTUAL_ENV/bin" >> $GITHUB_PATH
38+
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV
39+
40+
- name: Save virtualenv cache
41+
uses: actions/cache/save@v4
42+
with:
43+
key: venv-${{ runner.os }}-${{ steps.pythonv.outputs.PYTHON_VERSION }}-${{ hashFiles('requirements.txt') }}
44+
path: .venv
2345

2446
# Use dummy builder to improve performance as we don't need the generated HTML in this workflow.
2547
- name: Sphinx build
26-
run: make SPHINXOPTS='--color -j 4 -W' dummy
48+
run: |
49+
source .venv/bin/activate
50+
make SPHINXOPTS='--color -j 4 -W' dummy

conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
is_i18n = tags.has("i18n") # noqa: F821
141141
print("Build language: {}, i18n tag: {}".format(language, is_i18n))
142142

143-
exclude_patterns = ["_build"]
143+
exclude_patterns = [".*", "**/.*", "_build", "_tools"]
144144

145145
# fmt: off
146146
# These imports should *not* be moved to the start of the file,

0 commit comments

Comments
 (0)