Skip to content

Commit 54fc1a4

Browse files
committed
refactor(plantuml): plantuml render
Change plantuml renderer to locally
1 parent 58773a9 commit 54fc1a4

5 files changed

Lines changed: 99 additions & 5 deletions

File tree

.github/workflows/dev-documentation.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
- master
77
workflow_dispatch:
88

9+
env:
10+
CI_DOCKER_CACHE_PATH: ci/cache/docker
11+
912
# Мы хотим чтобы deploy в ветку gh-pages
1013
# происходили консистентно друг за другом
1114
concurrency:
@@ -19,25 +22,69 @@ jobs:
1922
deploy:
2023
name: Deploy dev documentation
2124
runs-on: ubuntu-22.04
25+
env:
26+
RENDERER_NETWORK: renderer-net
27+
RENDERER_IMAGE: plantuml/plantuml-server:jetty-v1.2026.0
28+
RENDERER_CONTAINER_NAME: renderer
2229
defaults:
2330
run:
2431
working-directory: documentation
2532
steps:
2633
- uses: actions/checkout@v6
2734
with:
2835
fetch-depth: 0
36+
37+
- name: Setup docker image cache
38+
id: docker-image-cache
39+
uses: actions/cache@v3
40+
with:
41+
path: ${{ env.CI_DOCKER_CACHE_PATH }}
42+
key: ${{ env.RENDERER_IMAGE }}
43+
44+
- name: Update docker image cache
45+
if: steps.docker-image-cache.outputs.cache-hit != 'true'
46+
working-directory: ${{ github.workspace }}
47+
run: |
48+
docker pull "$RENDERER_IMAGE"
49+
mkdir -p ${CI_DOCKER_CACHE_PATH}/${RENDERER_IMAGE}
50+
docker image save -o ${CI_DOCKER_CACHE_PATH}/${RENDERER_CONTAINER_NAME}.tar "$RENDERER_IMAGE"
51+
52+
- name: Load docker image cache
53+
if: steps.docker-image-cache.outputs.cache-hit == 'true'
54+
working-directory: ${{ github.workspace }}
55+
run: |
56+
docker image load -i ${CI_DOCKER_CACHE_PATH}/${RENDERER_CONTAINER_NAME}.tar
57+
58+
- name: Start renderer service locally
59+
run: |
60+
docker network create "$RENDERER_NETWORK"
61+
docker run -d -p 7036:8080 --name "$RENDERER_CONTAINER_NAME" --network "$RENDERER_NETWORK" "$RENDERER_IMAGE"
62+
63+
2964
- name: Configure Git user
3065
run: |
3166
git config user.email "actions@github.com"
3267
git config user.name "GitHub Actions"
68+
69+
3370
- name: Setup python
3471
uses: actions/setup-python@v5
3572
with:
3673
python-version: 3.x
3774
cache: 'pip'
75+
3876
- name: Download mkdocs plugins
3977
run: pip install -r requirements.txt
78+
4079
- name: Deploy documentation into gh-pages branch
4180
run: mike deploy dev --push
81+
4282
- name: Setup default version
4383
run: mike set-default dev --push
84+
85+
- name: Cleanup renderer container
86+
if: always()
87+
run: |
88+
docker rm -f "$RENDERER_CONTAINER_NAME"
89+
docker network rm -f "$RENDERER_NETWORK"
90+
docker rmi -f ${RENDERER_REGISTRY}${RENDERER_IMAGE}

.github/workflows/release-documentation.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
required: true
99
type: string
1010

11+
env:
12+
CI_DOCKER_CACHE_PATH: ci/cache/docker
13+
1114
# Мы хотим чтобы deploy в ветку gh-pages
1215
# происходили консистентно друг за другом
1316
concurrency:
@@ -21,6 +24,10 @@ jobs:
2124
deploy:
2225
name: Deploy release documentation
2326
runs-on: ubuntu-22.04
27+
env:
28+
RENDERER_NETWORK: renderer-net
29+
RENDERER_IMAGE: plantuml/plantuml-server:jetty-v1.2026.0
30+
RENDERER_CONTAINER_NAME: renderer
2431
steps:
2532
- name: Validate semver tag format
2633
id: validate-tag
@@ -38,12 +45,39 @@ jobs:
3845
echo "✅ Valid tag: $TAG"
3946
echo "Version for docs: $VERSION"
4047
echo "version=$VERSION" >> $GITHUB_OUTPUT
48+
4149
- name: Checkout repository with tag
4250
uses: actions/checkout@v6
4351
with:
4452
ref: "${{ github.event.inputs.tag }}"
4553
fetch-depth: 0
4654

55+
- name: Setup docker image cache
56+
id: docker-image-cache
57+
uses: actions/cache@v3
58+
with:
59+
path: ${{ env.CI_DOCKER_CACHE_PATH }}
60+
key: ${{ env.RENDERER_IMAGE }}
61+
62+
- name: Update docker image cache
63+
if: steps.docker-image-cache.outputs.cache-hit != 'true'
64+
working-directory: ${{ github.workspace }}
65+
run: |
66+
docker pull "$RENDERER_IMAGE"
67+
mkdir -p ${CI_DOCKER_CACHE_PATH}/${RENDERER_IMAGE}
68+
docker image save -o ${CI_DOCKER_CACHE_PATH}/${RENDERER_CONTAINER_NAME}.tar "$RENDERER_IMAGE"
69+
70+
- name: Load docker image cache
71+
if: steps.docker-image-cache.outputs.cache-hit == 'true'
72+
working-directory: ${{ github.workspace }}
73+
run: |
74+
docker image load -i ${CI_DOCKER_CACHE_PATH}/${RENDERER_CONTAINER_NAME}.tar
75+
76+
- name: Start renderer service locally
77+
run: |
78+
docker network create "$RENDERER_NETWORK"
79+
docker run -d -p 7036:8080 --name "$RENDERER_CONTAINER_NAME" --network "$RENDERER_NETWORK" ${RENDERER_REGISTRY}${RENDERER_IMAGE}
80+
4781
- name: Configure Git user
4882
run: |
4983
git config user.email "actions@github.com"
@@ -66,3 +100,10 @@ jobs:
66100
# env:
67101
# # Для дебага, если нужно
68102
# MIKE_VERBOSE: 1
103+
104+
- name: Cleanup renderer container
105+
if: always()
106+
run: |
107+
docker rm -f "$RENDERER_CONTAINER_NAME"
108+
docker network rm -f "$RENDERER_NETWORK"
109+
docker rmi -f ${RENDERER_REGISTRY}${RENDERER_IMAGE}

documentation/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313
source venv/bin/activate
1414
pip install -r requirements.txt
1515
```
16-
17-
2. Соберите или запустите сайт:
16+
2. Необходим `docker`. Запустите сервер рендеринга локально:
17+
```shell
18+
docker run -d -p 7036:8080 plantuml/plantuml-server:jetty-v1.2026.0
19+
```
20+
3. Соберите или запустите сайт:
1821

1922
```shell
2023
mkdocs build

documentation/README_EN.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ To deploy documentation locally on current branch/tag:
1313
source venv/bin/activate
1414
pip install -r requirements.txt
1515
```
16-
17-
2. Build or serve site:
16+
2. Requires `docker`. Start the render server locally:
17+
```shell
18+
docker run -d -p 7036:8080 plantuml/plantuml-server:jetty-v1.2026.0
19+
```
20+
3. Build or serve site:
1821

1922
```shell
2023
mkdocs build

documentation/mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ plugins:
4848
- drawio:
4949
darkmode: true
5050
- plantuml:
51-
puml_url: https://www.plantuml.com/plantuml/
51+
puml_url: http://localhost:7036
5252
# в секундах(in seconds)
5353
request_timeout: 300
5454

0 commit comments

Comments
 (0)