ci: Re-implement the gi-checker in python

To cleanup and ignore the gstreamer-utils crate
This commit is contained in:
Thibault Saunier 2022-03-11 10:03:03 -03:00
parent 081d42ac86
commit 56a46fc6fd
2 changed files with 43 additions and 25 deletions

View file

@ -408,31 +408,7 @@ gir-checks:
extends: .img-stable extends: .img-stable
stage: 'extras' stage: 'extras'
script: script:
- git diff --exit-code - python3 ci/gir-checks.py
- 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
outdated: outdated:
extends: .img-stable extends: .img-stable

42
ci/gir-checks.py Normal file
View file

@ -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()