mirror of
https://gitlab.com/kupfer/kupferbootstrap.git
synced 2025-06-25 09:58:21 -04:00
docs: cache versioned html to tarball for speed and CI uploads
This commit is contained in:
parent
c7084895d6
commit
7955842da9
3 changed files with 25 additions and 16 deletions
|
@ -78,12 +78,18 @@ push_docker:
|
||||||
before_script: &docs_before_script
|
before_script: &docs_before_script
|
||||||
- pip install -r requirements.txt -r docs/requirements.txt
|
- pip install -r requirements.txt -r docs/requirements.txt
|
||||||
script: &docs_script
|
script: &docs_script
|
||||||
- '(cd docs && make -j$DOCS_MAKE_THREADS SPHINXARGS="$DOCS_SPHINXARGS" $DOCS_MAKE_TARGET)'
|
- make -C docs -j$DOCS_MAKE_THREADS SPHINXARGS="$DOCS_SPHINXARGS" $DOCS_MAKE_TARGET
|
||||||
after_script:
|
|
||||||
- mv "docs/$DOCS_MAKE_TARGET" public
|
- mv "docs/$DOCS_MAKE_TARGET" public
|
||||||
|
- if [[ -e docs/archived ]]; then cp -r docs/archived public/ ; fi
|
||||||
|
- rm -vf docs/archived/{main,dev,"$CI_COMMIT_REF_NAME"}.tar.gz # we want to cache only old tags as they won't change
|
||||||
|
after_script:
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- public
|
- public
|
||||||
|
cache:
|
||||||
|
key: docs
|
||||||
|
paths:
|
||||||
|
- docs/archived/*.tar.gz
|
||||||
|
|
||||||
build_docs:
|
build_docs:
|
||||||
stage: build
|
stage: build
|
||||||
|
|
1
docs/.gitignore
vendored
1
docs/.gitignore
vendored
|
@ -4,3 +4,4 @@ html
|
||||||
source/cli
|
source/cli
|
||||||
checkouts
|
checkouts
|
||||||
versions
|
versions
|
||||||
|
archived
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
buildargs := -b dirhtml -aE source
|
buildargs := -b dirhtml -aE source
|
||||||
|
|
||||||
.PHONY: cleanbuild clean serve serve_versions versions versions_git versions_index .phony_explicit
|
.PHONY: cleanbuild clean serve serve_versions versions versions_git versions_index
|
||||||
.NOTINTERMEDIATE:
|
.NOTINTERMEDIATE:
|
||||||
.PRECIOUS: versions/%/index.html checkouts/%/docs/html/index.html
|
.PRECIOUS: versions/index.html versions/%/index.html checkouts/%/docs/html/index.html archived/%.tar.gz
|
||||||
# helper to make versions/%/index.html phony
|
|
||||||
.phony_explicit:
|
|
||||||
|
|
||||||
BRANCHES := main dev
|
BRANCHES := main dev
|
||||||
TAGS := $(shell git tag)
|
TAGS := $(shell git tag)
|
||||||
|
@ -43,14 +41,16 @@ checkouts/%/docs/html/index.html:
|
||||||
(! [[ -e "$$checkout/docs/source/conf.py" ]] || echo "version = '$$ver'" >> "$$checkout/docs/source/conf.py") && \
|
(! [[ -e "$$checkout/docs/source/conf.py" ]] || echo "version = '$$ver'" >> "$$checkout/docs/source/conf.py") && \
|
||||||
$(MAKE) -C "$$checkout/docs" SPHINXARGS="-D version=$$ver"
|
$(MAKE) -C "$$checkout/docs" SPHINXARGS="-D version=$$ver"
|
||||||
|
|
||||||
versions/%/index.html: checkouts/%/docs/html/index.html .phony_explicit
|
archived/%.tar.gz: checkouts/%/docs/html/index.html
|
||||||
@mkdir -p versions
|
mkdir -p archived
|
||||||
@# use backslashed multi-line cmd because otherwise variables will be lost
|
tar -C "checkouts/$*/docs/html" -czf "$@" .
|
||||||
@branch="$$(basename "$(@D)")" && \
|
|
||||||
checkout="checkouts/$$branch" && \
|
versions/%/index.html: archived/%.tar.gz
|
||||||
echo "working on version '$$branch'" && \
|
@mkdir -p "$(@D)"
|
||||||
set -x && \
|
@echo "working on version '$*'"
|
||||||
cp -rf "$$checkout/docs/html/." "versions/$$branch/"
|
tar -xf "archived/$*.tar.gz" -C "$(@D)"
|
||||||
|
@# ensure index file exists and update its timestamp for Make's dependency detection
|
||||||
|
[[ -e "$(@)" ]] && touch "$(@)"
|
||||||
|
|
||||||
versions/versions.css: versjon/versions.css
|
versions/versions.css: versjon/versions.css
|
||||||
@mkdir -p versions
|
@mkdir -p versions
|
||||||
|
@ -59,12 +59,14 @@ versions/versions.css: versjon/versions.css
|
||||||
versions_git:
|
versions_git:
|
||||||
@$(MAKE) $(patsubst %, versions/%/index.html, $(VERSIONS))
|
@$(MAKE) $(patsubst %, versions/%/index.html, $(VERSIONS))
|
||||||
|
|
||||||
versions/index.html:
|
versions/index.html: $(sort $(wildcard versions/*/index.html))
|
||||||
rm -rf versions/stable
|
rm -rf versions/stable
|
||||||
@cd versions && set -x && versjon --stable-version main --user_templates ../versjon
|
@cd versions && set -x && versjon --stable-version main --user_templates ../versjon
|
||||||
|
@# ensure the global index.html exists and is newer than each version's index.html
|
||||||
|
[[ -e "$(@)" ]] && touch "$(@)"
|
||||||
|
|
||||||
versions: versions_git versions/versions.css
|
versions: versions_git versions/versions.css
|
||||||
@$(MAKE) versions/index.html
|
@$(MAKE) versions/index.html
|
||||||
|
|
||||||
serve_versions: versions
|
serve_versions: versions/index.html
|
||||||
cd versions && python -m http.server 9888
|
cd versions && python -m http.server 9888
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue