summaryrefslogtreecommitdiff
path: root/ci
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2021-12-02 17:57:09 -0500
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2021-12-06 12:18:25 +0000
commit06f1dfc72474d906a94c77532ff9036f796ecc49 (patch)
tree5de2dfdd671450286dc682c873dc83c839256534 /ci
parent49736fb3fdbdfc61d6cc5bc586db6d72cfd458cc (diff)
downloadgstreamer-06f1dfc72474d906a94c77532ff9036f796ecc49.tar.gz
ci: fedora-docker: Cache media files
As of now all integration tests endup fetching 600MB of media every run. This will increase the docker side, but this is to the traceof that the docker image will quickly be cached on all runners. Fixes #841 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1413>
Diffstat (limited to 'ci')
-rw-r--r--ci/docker/fedora/prepare.sh9
-rwxr-xr-xci/scripts/handle-subprojects-cache.py24
2 files changed, 28 insertions, 5 deletions
diff --git a/ci/docker/fedora/prepare.sh b/ci/docker/fedora/prepare.sh
index 9ab1d986fc..5e0563face 100644
--- a/ci/docker/fedora/prepare.sh
+++ b/ci/docker/fedora/prepare.sh
@@ -238,17 +238,20 @@ cargo --version
rustc --version
# get gstreamer and make all subprojects available
-# FIXME: we don't really need to clone it now as we have the repo checkout out already
-git clone -b ${DEFAULT_BRANCH} https://gitlab.freedesktop.org/gstreamer/gstreamer.git /gstreamer
+git clone -b ${GIT_BRANCH} ${GIT_URL} /gstreamer
+git -C /gstreamer submodule update --init --depth=1
meson subprojects download --sourcedir /gstreamer
/gstreamer/ci/scripts/handle-subprojects-cache.py --build /gstreamer/subprojects/
# Run git gc to prune unwanted refs and reduce the size of the image
-for i in $(find subprojects/ -mindepth 1 -maxdepth 1 -type d);
+for i in $(find /subprojects/ -mindepth 1 -maxdepth 1 -type d);
do
git -C $i gc --aggressive || true;
done
+# Now remove the gstreamer clone
+rm -rf /gstreamer
+
echo "Removing DNF cache"
dnf clean all
diff --git a/ci/scripts/handle-subprojects-cache.py b/ci/scripts/handle-subprojects-cache.py
index 6281e094d6..9e3722111d 100755
--- a/ci/scripts/handle-subprojects-cache.py
+++ b/ci/scripts/handle-subprojects-cache.py
@@ -24,9 +24,23 @@ def create_cache_in_image(options):
if project_name != "packagecache" and not os.path.exists(os.path.join(project_path, '.git')):
continue
+ if os.path.exists(os.path.join(DEST, project_name)):
+ continue
+
print("Copying %s" % project_name)
shutil.copytree(project_path, os.path.join(DEST, project_name))
+ media_path = os.path.join(options.subprojects_dir, '..', '.git',
+ 'modules', 'subprojects', 'gst-integration-testsuites', 'medias')
+ if os.path.exists(os.path.join(DEST, 'medias.git')):
+ return
+
+ if os.path.exists(media_path):
+ print("Creating media cache")
+ shutil.copytree(media_path, os.path.join(DEST, 'medias.git'))
+ else:
+ print("Did not find medias in %s" % media_path)
+
def copy_cache(options):
# FIXME Remove when not needed anymore.
@@ -37,8 +51,14 @@ def copy_cache(options):
for project_name in os.listdir(path):
project_path = os.path.join(options.subprojects_dir, project_name)
-
cache_dir = os.path.join(path, project_name)
+
+ if project_name == 'medias.git':
+ project_path = os.path.join(options.subprojects_dir, '..', '.git', 'modules',
+ 'subprojects', 'gst-integration-testsuites')
+ os.makedirs(project_path, exist_ok=True)
+ project_path = os.path.join(project_path, 'medias')
+
if os.path.exists(project_path):
print("- Ignoring %s" % cache_dir)
continue
@@ -47,7 +67,7 @@ def copy_cache(options):
print("- Ignoring %s" % cache_dir)
continue
- print("Copying from %s" % cache_dir)
+ print("Copying from %s -> %s" % (cache_dir, project_path))
shutil.copytree(cache_dir, project_path)