diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a4894b8a9..639208a80 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -408,31 +408,7 @@ gir-checks: extends: .img-stable stage: 'extras' script: - - git diff --exit-code - - git clone --depth 1 https://github.com/gtk-rs/checker - - git diff --exit-code - - cd checker && echo '[workspace]' >> Cargo.toml - - cd .. && git diff --exit-code && cd checker - - cargo build --locked --color=always --release - - cd .. && git diff --exit-code && cd checker - - | - cargo run --color=always --release -- ../gstreamer* ../gstreamer-gl/{egl,wayland,x11} - - cd .. && git diff --exit-code && cd checker - # Check doc aliases - - | - for crate in ../gstreamer* ../gstreamer-gl/{egl,wayland,x11}; do - echo '--> Checking doc aliases in ' $crate - python3 doc_aliases.py $crate - done - - cd .. - # To ensure that there was no missing #[doc(alias = "...")] - - git diff --exit-code - - | - for crate in gstreamer* gstreamer-gl/{egl,wayland,x11}; do - echo '-->' $crate - ./checker/check_init_asserts $crate - done - - git diff --exit-code + - python3 ci/gir-checks.py outdated: extends: .img-stable diff --git a/ci/gir-checks.py b/ci/gir-checks.py new file mode 100644 index 000000000..407f7859b --- /dev/null +++ b/ci/gir-checks.py @@ -0,0 +1,42 @@ +from itertools import chain +import os +import sys +from pathlib import Path as P +from subprocess import check_call as exec + +NATIVE_CRATES = ["gstreamer-utils"] + +def git(*args): + exec(["git"] + list(args)) + +def check_no_git_diff(): + git("diff", "--exit-code") + +check_no_git_diff() +git("clone", "--depth", "1", "https://github.com/gtk-rs/checker") +check_no_git_diff() + +rootdir = P(".") +checker_dir = P("checker") +with (checker_dir / "Cargo.toml").open("a") as f: + f.write("[workspace]\n") + +check_no_git_diff() +exec(['cargo', 'build', '--locked', '--color=always', '--release'], cwd=checker_dir) +check_no_git_diff() + +exec('cargo run --color=always --release -- ../gstreamer* ../gstreamer-gl/{egl,wayland,x11}', cwd=checker_dir, shell=True) + +gl_dir = rootdir / 'gstreamer-gl' +for crate in chain(rootdir.glob('gstreamer*'), [gl_dir / 'egl', gl_dir / 'wayland', gl_dir / 'x11']): + # Ignore "native" crates + if crate.name in NATIVE_CRATES: + continue + + print(f'--> Checking doc aliases in {crate.absolute()}') + exec(['python3', 'doc_aliases.py', crate.absolute()], cwd=checker_dir) + + print(f'--> {crate.absolute()}') + exec(['./checker/check_init_asserts', crate.absolute()]) + +check_no_git_diff()