ci: Check that documentation is updated as required

This commit is contained in:
Thibault Saunier 2022-08-29 12:33:57 -04:00
parent 16d804e761
commit e391f1ef25
2 changed files with 29 additions and 0 deletions

View file

@ -177,10 +177,19 @@ test nightly:
meson shared: meson shared:
extends: .meson extends: .meson
variables:
CI_ARTIFACTS_URL: "${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/"
script: script:
- meson build --default-library=shared --prefix=$(pwd)/install - meson build --default-library=shared --prefix=$(pwd)/install
- ninja -C build install - ninja -C build install
- ./ci/check-plugins-installed.py install - ./ci/check-plugins-installed.py install
- ninja -C build docs/gst_plugins_cache.json
- ci/check-documentation-diff.py
artifacts:
when: always
expire_in: "7 days"
paths:
- plugins-cache-diffs/
meson static: meson static:
extends: .meson extends: .meson

20
ci/check-documentation-diff.py Executable file
View file

@ -0,0 +1,20 @@
#!/usr/bin/python3
import os, subprocess, sys
if __name__ == "__main__":
diffsdir = 'plugins-cache-diffs'
os.makedirs(diffsdir, exist_ok=True)
res = 0
try:
subprocess.check_call(['git', 'diff', '--quiet'] )
except subprocess.CalledProcessError:
diffname = os.path.join(diffsdir, 'plugins_cache.diff')
res += 1
with open(diffname, 'w') as diff:
subprocess.check_call(['git', 'diff'], stdout=diff)
print('\033[91mYou have a diff in the documentation cache. Please update with:\033[0m')
print(' $ curl %s/%s | git apply -' % (os.environ['CI_ARTIFACTS_URL'], diffname.replace('../', '')))
if res != 0:
print('(note that it might take a few minutes for artefacts to be available on the server)\n')
sys.exit(res)