-
Notifications
You must be signed in to change notification settings - Fork 4
193 lines (164 loc) · 6.22 KB
/
validate-docs-site.yaml
File metadata and controls
193 lines (164 loc) · 6.22 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
name: Validate docs site (render, test, and deploy)
on:
pull_request:
types: [opened, synchronize, ready_for_review]
permissions:
issues: write
pull-requests: write
jobs:
validate:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- name: Check out documentation repository
uses: actions/checkout@v4
# Reclaim space + create a reserve for deterministic headroom
- name: Free space + create reserve
uses: ./.github/actions/free-disk-space
with:
remove_dotnet: "true"
remove_android: "true"
remove_haskell: "true"
prune_docker: "true"
apt_cleanup: "true"
create_reserve_gb: "3"
- name: Check out validmind-library repository
uses: actions/checkout@v4
with:
repository: validmind/validmind-library
path: site/_source/validmind-library
token: ${{ secrets.DOCS_CI_RO_PAT }}
- name: Check out installation repository
uses: actions/checkout@v4
with:
repository: validmind/installation
path: site/_source/installation
token: ${{ secrets.DOCS_CI_RO_PAT }}
sparse-checkout: |
site/installation
sparse-checkout-cone-mode: true
- name: Check out release-notes repository
uses: actions/checkout@v4
with:
repository: validmind/release-notes
path: site/_source/release-notes
token: ${{ secrets.DOCS_CI_RO_PAT }}
sparse-checkout: |
releases
sparse-checkout-cone-mode: true
- name: Check out backend repository
uses: actions/checkout@v4
with:
repository: validmind/backend
path: site/_source/backend
token: ${{ secrets.DOCS_CI_RO_PAT }}
sparse-checkout: |
src/backend/templates/documentation/model_documentation
sparse-checkout-cone-mode: true
- name: Verify copyright headers
run: |
cd site
make verify-copyright
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
version: pre-release
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Generate Python library docs
run: |
cd site/_source/validmind-library
make install && make quarto-docs
cd ../../
rm -rf validmind
mkdir -p validmind
rsync -av --exclude '_build' --exclude 'templates' _source/validmind-library/docs/ validmind/
- name: Generate template schema docs
run: |
pip install json-schema-for-humans
BACKEND_ROOT=site/_source/backend python scripts/generate_template_schema_docs.py
- name: Populate installation
run: cp -r site/_source/installation/site/installation site/installation
- name: Populate release notes
run: |
cp -r site/_source/release-notes/releases site
rm -f site/releases/backend-releases.qmd site/releases/cmvm-releases.qmd
- name: Render demo docs site
run: |
cd site
quarto render --profile development 2>&1 | tee render_errors.log || {
echo "Quarto render failed immediately";
cat render_errors.log;
exit 1;
}
make generate-sitemap
- name: Add robots.txt for PR preview
run: cp site/environments/robots-staging.txt site/_site/robots.txt
- name: Test for warnings or errors
run: |
if grep -q 'WARN\|WARNING\|ERROR:' site/render_errors.log; then
echo "Warnings or errors detected during Quarto render"
cat site/render_errors.log
exit 1
else
echo "No warnings or errors detected during Quarto render"
fi
# Demo bucket is in us-east-1
- name: Configure AWS credentials
run: aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }} && aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }} && aws configure set default.region us-east-1
- name: Deploy PR preview
run: aws s3 sync site/_site s3://validmind-docs-staging/site/pr_previews/${{ github.head_ref }} --delete --exclude "notebooks/EXECUTED/*" && aws cloudfront create-invalidation --distribution-id ESWVTZYFL873V --paths "/*" --no-cli-pager
- name: Post comment with preview URL
uses: actions/github-script@v6
with:
script: |
const previewUrl = `https://docs-staging.validmind.ai/pr_previews/${{ github.head_ref }}/index.html`;
// Delete old preview comments
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
for (const comment of comments) {
if (comment.user.login === 'github-actions[bot]' && comment.body.includes('## Validate docs site')) {
await github.rest.issues.deleteComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: comment.id,
});
}
}
let comment = `## Validate docs site\n\n`;
comment += `✓ INFO: A live preview of the docs site is available — [Open the preview](${previewUrl})\n\n`;
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: comment
});
- name: Install pandoc
run: |
sudo apt-get update
sudo apt-get install -y pandoc
- name: Validate LLM markdown render
run: bash llm/render.sh && bash llm/clean.sh
working-directory: site
# Release headroom and shrink before final lightweight steps & post-job
- name: Release reserve & shrink
if: always()
uses: ./.github/actions/free-disk-space
with:
release_reserve: "true"
remove_paths: |
site/_source/installation
site/_source/release-notes
site/_source/backend
site/render_errors.log
site/_freeze
dev.env
valid.env
- name: Final disk usage
if: always()
run: df -hT /