Skip to content

Commit adcbce5

Browse files
authored
optimize build time (#319)
- Add a GitHub action cache layer - Refill files modified time to use incremental build - Change from html builder to dummy builder
1 parent 09da482 commit adcbce5

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

‎.github/scripts/build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ cd cpython/Doc || exit 1
1414
mkdir -p locales/"$LOCALE"/
1515
ln -sfn "$(realpath ../../docs)" locales/"$LOCALE"/LC_MESSAGES
1616
pip3 install -q -r requirements.txt
17-
make html SPHINXOPTS="-D language=$LOCALE -D gettext_compact=0 -W --keep-going" 2> >(error)
17+
sphinx-build -b dummy -d build/doctrees -j auto -D language=$LOCALE -D gettext_compact=0 -W --keep-going -W . build/html 2> >(error)

‎.github/scripts/update.sh

+16
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
#!/bin/bash
22

3+
cd cpython || exit 1
4+
5+
# Restore git timestamp for enabling build cache
6+
rev=HEAD
7+
for f in $(git ls-tree -r -t --full-name --name-only "$rev" Doc) ; do
8+
touch -d $(git log --pretty=format:%cI -1 "$rev" -- "$f") "$f";
9+
done
10+
11+
cd ..
312
cd docs || exit 1
13+
14+
# Restore git timestamp for enabling build cache
15+
rev=HEAD
16+
for f in $(git ls-tree -r -t --full-name --name-only "$rev") ; do
17+
touch -d $(git log --pretty=format:%cI -1 "$rev" -- "$f") "$f";
18+
done
19+
420
$(realpath ../tx) pull --languages "$LOCALE" -t --use-git-timestamps --workers 25 --silent

‎.github/workflows/sync.yml

+9
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,17 @@ jobs:
3838
run: .github/scripts/update.sh
3939
env:
4040
TX_TOKEN: ${{ secrets.TRANSIFEX_APIKEY }}
41+
- uses: actions/cache/restore@v3
42+
with:
43+
path: cpython/Doc/build
44+
key: cache-${{ inputs.version }}-${{ github.run_id }}
45+
restore-keys: cache-${{ inputs.version }}-
4146
- name: build
4247
run: .github/scripts/build.sh
48+
- uses: actions/cache/save@v3
49+
with:
50+
path: cpython/Doc/build
51+
key: cache-${{ inputs.version }}-${{ github.run_id }}
4352
- name: stat
4453
run: python .github/scripts/tx_stat.py > ./docs/.stat.json
4554
env:

0 commit comments

Comments
 (0)