Skip to content

Commit

Permalink
CI: Add virtualenv
Browse files Browse the repository at this point in the history
  • Loading branch information
mhilbrunner committed Jan 6, 2025
1 parent cba4e89 commit 30046d6
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 4 deletions.
23 changes: 22 additions & 1 deletion .github/workflows/build_offline_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,33 @@ jobs:
with:
ref: ${{ matrix.branch }}

- name: Get Python version
id: pythonv
run: |
echo "PYTHON_VERSION=$(python --version)" >> $GITHUB_OUTPUT
- name: Restore cached virtualenv
uses: actions/cache/restore@v4
with:
key: venv-${{ runner.os }}-${{ steps.pythonv.outputs.PYTHON_VERSION }}-${{ hashFiles('requirements.txt') }}
path: .venv

- name: Install dependencies
run: |
sudo pip3 install -r requirements.txt
python -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
echo "$VIRTUAL_ENV/bin" >> $GITHUB_PATH
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV
sudo apt update
sudo apt install parallel libwebp7
- name: Save virtualenv cache
uses: actions/cache/save@v4
with:
key: venv-${{ runner.os }}-${{ steps.pythonv.outputs.PYTHON_VERSION }}-${{ hashFiles('requirements.txt') }}
path: .venv

- name: Sphinx - Build HTML
run: make SPHINXOPTS='--color' html

Expand Down
28 changes: 26 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,33 @@ jobs:
- name: Style checks via pre-commit
uses: pre-commit/[email protected]

- name: Get Python version
id: pythonv
run: |
echo "PYTHON_VERSION=$(python --version)" >> $GITHUB_OUTPUT
- name: Restore cached virtualenv
uses: actions/cache/restore@v4
with:
key: venv-${{ runner.os }}-${{ steps.pythonv.outputs.PYTHON_VERSION }}-${{ hashFiles('requirements.txt') }}
path: .venv

- name: Install dependencies
run: sudo pip3 install -r requirements.txt
run: |
python -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
echo "$VIRTUAL_ENV/bin" >> $GITHUB_PATH
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV
- name: Save virtualenv cache
uses: actions/cache/save@v4
with:
key: venv-${{ runner.os }}-${{ steps.pythonv.outputs.PYTHON_VERSION }}-${{ hashFiles('requirements.txt') }}
path: .venv

# Use dummy builder to improve performance as we don't need the generated HTML in this workflow.
- name: Sphinx build
run: make SPHINXOPTS='--color -j 4 -W' dummy
run: |
source .venv/bin/activate
make SPHINXOPTS='--color -j 4 -W' dummy
2 changes: 1 addition & 1 deletion conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
is_i18n = tags.has("i18n") # noqa: F821
print("Build language: {}, i18n tag: {}".format(language, is_i18n))

exclude_patterns = ["_build"]
exclude_patterns = [".*", "**/.*", "_build"]

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

0 comments on commit 30046d6

Please sign in to comment.