From a9b39f01a5ada5d18b8c96d6e6a5932ff32fdd53 Mon Sep 17 00:00:00 2001 From: Douglas Raillard Date: Thu, 8 Feb 2024 00:20:46 +0000 Subject: [PATCH] .gitlab-ci.yml: Pages for more refs --- .gitlab-ci.yml | 26 ++++++++++++++++---------- tools/check-setuppy | 2 +- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4c17b42e3..48bf7fa5b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -242,10 +242,11 @@ pages: out="$(readlink -f .)/public" function build_branch() { - local branch=$1 - local worktree=$(mktemp -d --suffix "-worktree-$branch") - git fetch origin "$branch" - git worktree add "$worktree" --checkout "$branch" + local ref=$1 + local publish_as=$2 + local worktree=$(mktemp -d --suffix "-worktree") + git fetch origin "$ref" + git worktree add "$worktree" --checkout "$ref" ( cd "$worktree" sudo ./install_base.sh --install-doc-extras @@ -257,12 +258,19 @@ pages: audit export LC_ALL=C - local doctree=$(mktemp -d --suffix "-doctree-$branch") - cd ./doc && sphinx-build -b html -n --no-color -W --keep-going -T -j auto -d "$doctree" . "$out/$branch" + local doctree=$(mktemp -d --suffix "-doctree") + cd ./doc && sphinx-build -b html -n --no-color -W --keep-going -T -j auto -d "$doctree" . "$out/$publish_as" ) } - build_branch main - build_branch preview + build_branch main main + build_branch preview preview + + # TODO: For now the release branch doc won't build as it lacks some necessary fixes + # build_branch release + # build_branch v4.0.0 v4 + + # Expose "main" as the "latest" branch + (cd "$out" && ln -s ./main ./latest) # Make the doc a lot more compact by trimming useless files find "$out" '-(' -name '*.ipynb' -or -name '*.ipynb.txt' '-)' -delete @@ -272,8 +280,6 @@ pages: # Rewrite absolute symlinks into relative ones symlinks -cr "$out" - # TODO: For now the release branch doc won't build as it lacks some necessary fixes - # build_branch release # Debug excessive sizes - du -hc "$out" | sort -h diff --git a/tools/check-setuppy b/tools/check-setuppy index 795219f8a..93a9d46f2 100755 --- a/tools/check-setuppy +++ b/tools/check-setuppy @@ -25,7 +25,7 @@ import sys LISA_HOME = os.getenv('LISA_HOME', '.') def call_git(*args): - return subprocess.check_output(('git', *args)).decode('utf-8') + return subprocess.check_output(('git', '-C', LISA_HOME, *args)).decode('utf-8') def get_git_sha1(ref): return call_git('rev-parse', ref).strip() -- GitLab