Skip to content

Commit 9bb1996

Browse files
committed
CI: only use virtualenv if it is installed (helps with caching)
1 parent 12a6fce commit 9bb1996

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

.github/workflows/local-playground-test.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@ name: Test local Playground
33
on:
44
push:
55
branches: [ "main" ]
6-
paths: [ "mkdocs/docs/playground/**", ".github/workflows/local-playground-test.yml" ]
6+
paths: &paths
7+
- mkdocs/docs/playground/**
8+
- mkdocs/docs/serve-no-livereload.sh
9+
- .github/workflows/local-playground-test.yml
710
pull_request:
811
branches: [ "main" ]
9-
paths: [ "mkdocs/docs/playground/**", ".github/workflows/local-playground-test.yml" ]
12+
paths: *paths
1013
workflow_dispatch:
1114

1215
jobs:

mkdocs/serve-no-livereload.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@ set -e
55
# Go to the directory with this script
66
cd "$(dirname "$(readlink -f "$0")")"
77

8-
# Create a Python virtualenv if it does not exist yet
9-
if ! test -d env; then
10-
virtualenv -p python3 env
8+
# Create a Python virtualenv if we have the tool installed
9+
# and it does not exist yet.
10+
if which virtualenv; then
11+
if ! test -d env; then
12+
virtualenv -p python3 env
13+
fi
14+
source env/bin/activate
1115
fi
1216

1317
# Serve the website without live reloading (useful for tests)
14-
source env/bin/activate
1518
pip install -r requirements.txt
1619
mkdocs serve --no-livereload

0 commit comments

Comments
 (0)