-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
138 lines (125 loc) · 4.11 KB
/
.gitlab-ci.yml
File metadata and controls
138 lines (125 loc) · 4.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
variables:
ANSIBLE_FORCE_COLOR: 'true'
stages:
- test
- build-and-deploy
# Reusable before_script fragments
# enchant is required in all sphinx-build jobs because RST files use
# the .. spelling:word-list:: directive (registered by sphinxcontrib.spelling).
# Without the extension loaded the directive is unknown and -W fails the build.
.install_uv: &install_uv
- apt-get update -qq && apt-get install -y -qq git libenchant-2-2
- pip install uv --quiet
- uv sync --quiet
.install_uv_with_rsync: &install_uv_with_rsync
- apt-get update -qq && apt-get install -y -qq git libenchant-2-2 rsync openssh-client
- pip install uv --quiet
- uv sync --quiet
# azure-cli image is CBL-Mariner-based (not Alpine); uses tdnf as package manager
.install_uv_azure: &install_uv_azure
- tdnf install -y git enchant2 tar
- curl -LsSf https://github.com/astral-sh/uv/releases/latest/download/uv-x86_64-unknown-linux-musl.tar.gz | tar -xz --strip-components=1 -C /usr/local/bin uv-x86_64-unknown-linux-musl/uv
- uv sync --quiet
# Runner tag (selects GitLab runner with Docker executor)
.on_docker_runner: &on_docker_runner
tags:
- docker20
linkcheck:
<<: *on_docker_runner
stage: test
image: python:3.11-slim
variables:
SPHINX_IGNORE_EXTERNAL_LINKS: "true"
before_script: *install_uv
script:
- uv run sphinx-build -W --keep-going -b linkcheck . _build/linkcheck
linkcheck_external:
<<: *on_docker_runner
stage: test
image: python:3.11-slim
before_script: *install_uv
script:
- uv run sphinx-build -W --keep-going -b linkcheck . _build/linkcheck
allow_failure: true
spellcheck:
<<: *on_docker_runner
stage: test
image: python:3.11-slim
before_script: *install_uv
script:
- uv run sphinx-build -W --keep-going -b spelling . _build/spelling
build:
<<: *on_docker_runner
stage: test
image: python:3.11-slim
before_script: *install_uv
script:
- uv run sphinx-build -W --keep-going -b html . _build/html
artifacts:
paths:
- _build/html/**/*
deploy:
<<: *on_docker_runner
stage: build-and-deploy
image: python:3.11-slim
before_script: *install_uv_with_rsync
rules:
- if: $CI_COMMIT_BRANCH == "master"
when: on_success
- when: never
script:
- uv run sphinx-build -b html . _build/html
- bash load_ssh_key_for_deploy.sh
- rsync -rt _build/html/ support@data.aimms.com:/home/aimms/www/documentation.aimms.com
retry: 1
internal_documentation_deploy:
<<: *on_docker_runner
stage: build-and-deploy
image: python:3.11-slim
before_script: *install_uv_with_rsync
script:
- uv run sphinx-build -b html . _build/html
- bash load_ssh_key_for_deploy.sh
- ssh support@data.aimms.com mkdir -p /home/aimms/www/documentation-staging/${CI_COMMIT_BRANCH}
- rsync -r --omit-dir-times --delete-excluded _build/html/ support@data.aimms.com:/home/aimms/www/documentation-staging/${CI_COMMIT_BRANCH}
az_deploy:
<<: *on_docker_runner
stage: build-and-deploy
image: mcr.microsoft.com/azure-cli
before_script: *install_uv_azure
rules:
- if: $CI_COMMIT_BRANCH == "master"
when: on_success
- when: never
script:
- uv run sphinx-build -b html . _build/html
- az storage copy -s '_build/html' --recursive --destination-container '$web' -- --overwrite=true --as-subdir=false
upload_html_to_rfx_blob:
<<: *on_docker_runner
stage: build-and-deploy
image: mcr.microsoft.com/azure-cli
before_script: *install_uv_azure
rules:
- if: $CI_COMMIT_BRANCH == "master"
when: on_success
- when: never
script:
- uv run sphinx-build -b html . _build/html
- mkdir -p _build/flat
- |
set -eo pipefail
find _build/html -name "*.html" -print0 | while IFS= read -r -d '' f; do
parent=$(basename "$(dirname "$f")")
filename=$(basename "$f")
if [ "$parent" = "html" ]; then
cp "$f" "_build/flat/$filename"
else
cp "$f" "_build/flat/${parent}-${filename}"
fi
done
- >
az storage blob sync
--connection-string "$RALFXPROJECT_CONNECTION_STRING"
--container rfx-aimms-doc
--source _build/flat
--delete-destination true