[pitivi/thiblahute/pre_commit_ci: 1/4] Run our pre commit hooks on the CI server




commit 410ed953db6748917bd14afaa5c08243ae6fea5b
Author: Thibault Saunier <tsaunier igalia com>
Date:   Wed May 20 15:11:48 2020 -0400

    Run our pre commit hooks on the CI server
    
    And fix some minor issues that were in the code

 .gitlab-ci.yml                       | 50 +++++++++++++++++-------------------
 .pre-commit-config.yaml              | 13 ++++++++++
 data/gstpresets/jpeg-raw-in-qt.gep   |  1 -
 data/gstpresets/prores-raw-in-qt.gep |  2 +-
 pitivi/dialogs/prefs.py              |  2 +-
 5 files changed, 38 insertions(+), 30 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6a6745f2d..191dcba79 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -5,7 +5,7 @@ stages:
   - deploy
 
 variables:
-  MANIFEST: build/flatpak/org.pitivi.Pitivi.json
+  MANIFEST: /build/pitivi/build/flatpak/org.pitivi.Pitivi.json
   DBUS_ID: org.pitivi.Pitivi
   XUNIT_PATH: ${CI_PROJECT_DIR}/xunit.xml
   GST_DEBUG_NO_COLOR: "true"
@@ -27,13 +27,16 @@ pitivi:master:
     - export IMAGE="${CI_REGISTRY}/${NAMESPACE}/${CI_PROJECT_NAME}:master-sdk_3.38"
     - export BASE_IMAGE="registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:3.38"
     - export TMPIMAGENAME="tmp-pitivi-master-sdk_3.38"
-    - export BUILDDIR="\${HOME}/pitivi"
-    - export CLONE_PITIVI="git clone ${CI_PROJECT_URL}.git --single-branch \${HOME}/pitivi -b 
${CI_COMMIT_REF_NAME}"
-    - export BUILD_PITIVI="flatpak-builder --user --disable-rofiles-fuse ${BUILDDIR}/app 
${BUILDDIR}/build/flatpak/org.pitivi.Pitivi.json --state-dir=\${HOME}/flatpak-cache --ccache"
+
+    - export CLONE_PITIVI="git clone ${CI_PROJECT_URL}.git --single-branch /build/pitivi -b 
${CI_COMMIT_REF_NAME}"
+    # All the downloads, build dirs, build cache, etc. are stored in /build/flatpak-cache.
+    - export BUILD_PITIVI="flatpak-builder --user --disable-rofiles-fuse /build/pitivi/app ${MANIFEST} 
--state-dir=/build/flatpak-cache --ccache"
+    # Run pre-commit to download and cache the hooks.
+    - export PRE_COMMIT="cd /build/pitivi && flatpak-builder --disable-rofiles-fuse 
--filesystem=/build/pitivi --env=PRE_COMMIT_HOME=/build/pre-commit-home --share=network --run 
/build/pitivi/app ${MANIFEST} pre-commit install-hooks"
 
     - env
 
-    - docker run --privileged --name ${TMPIMAGENAME} ${BASE_IMAGE} bash -c "${CLONE_PITIVI} && 
${BUILD_PITIVI} && rm -Rf ${BUILDDIR}"
+    - docker run --privileged --name ${TMPIMAGENAME} ${BASE_IMAGE} bash -c "${CLONE_PITIVI} && 
${BUILD_PITIVI} && ${PRE_COMMIT} && rm -Rf /build/pitivi"
     - docker commit ${TMPIMAGENAME} ${IMAGE}
     - docker rm ${TMPIMAGENAME}
     - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
@@ -49,33 +52,27 @@ build:
   tags:
     - flatpak
   image: registry.gitlab.gnome.org/gnome/pitivi:master-sdk_3.38
-  variables:
-    BLACKLIST: >
-      -b tests.test_effects.EffectsPropertiesManagerTest.test_dependent_properties
   script:
-    - export BUILDDIR=${HOME}/pitivi
-    - export MANIFEST=${BUILDDIR}/build/flatpak/org.pitivi.Pitivi.json
-    - export RUN_IN_SANDBOX="flatpak-builder --disable-rofiles-fuse --filesystem=${BUILDDIR} 
--filesystem=${CI_PROJECT_DIR} --env=PITIVI_DEVELOPMENT=1 --env=GST_DEBUG=2 --env=GST_DEBUG_NO_COLOR=true 
--run app ${MANIFEST}"
-    - export FLATPAK_BUILDER_CACHE="--state-dir=${HOME}/flatpak-cache"
-    - export FLATPAK_REPO="${CI_PROJECT_DIR}/flatpak_repo"
+    - export RUN_IN_SANDBOX="flatpak-builder --disable-rofiles-fuse --filesystem=/build/pitivi 
--filesystem=${CI_PROJECT_DIR} --env=PITIVI_DEVELOPMENT=1 --env=GST_DEBUG=2 --env=GST_DEBUG_NO_COLOR=true 
--env=PRE_COMMIT_HOME=/build/pre-commit-home --run /build/pitivi/app ${MANIFEST}"
 
     - env
 
-    # Working around the fact that flatpak-builder *requires* the cache dir
-    # to be on the same filesystem as the build dir
-    - mv ${CI_PROJECT_DIR} ${BUILDDIR}
+    # flatpak-builder *requires* the cache dir and the build dir to be on the
+    # same filesystem.
+    # The cache dir is in /build/flatpak-cache.
+    # The build dir is in /builds/GNOME/pitivi/flatpak_repo
+    #
+    # Moving the git repo from /builds/GNOME/pitivi to /build/pitivi so it's on
+    # the same filesystem as the flatpak-builder cache in /build/flatpak-cache.
+    - mv ${CI_PROJECT_DIR} /build/pitivi
     - mkdir -p ${CI_PROJECT_DIR}
 
-    - cd ${BUILDDIR}
-    - flatpak-builder --user --disable-rofiles-fuse ${FLATPAK_BUILDER_CACHE} --disable-download --ccache 
--repo=${FLATPAK_REPO} --force-clean app build/flatpak/org.pitivi.Pitivi.json --subject="Rolling update for 
pitivi master" --body="See ${CI_JOB_URL}"
+    - cd /build/pitivi
+    - flatpak-builder --user --disable-rofiles-fuse --state-dir=/build/flatpak-cache --disable-download 
--ccache --repo=${CI_PROJECT_DIR}/flatpak_repo --force-clean app build/flatpak/org.pitivi.Pitivi.json 
--subject="Rolling update for pitivi master" --body="See ${CI_JOB_URL}"
     - ${RUN_IN_SANDBOX} meson mesonbuild/
     - ${RUN_IN_SANDBOX} ninja -C mesonbuild/
-    - xvfb-run -n 32 -s "-screen 0 640x480x24" ${RUN_IN_SANDBOX} gst-validate-launcher 
$PWD/tests/ptv_testsuite.py --dump-on-failure --timeout-factor 4 --xunit-file ${XUNIT_PATH} 
--logs-dir=${CI_PROJECT_DIR}/tests-logs ${BLACKLIST}
-
-    # For some reason GitLab fails to upload directories
-    - cd ${CI_PROJECT_DIR}/
-    - tar czf tests-logs.tar.gz tests-logs/
-    - tar cf flatpak_repo.tar flatpak_repo/
+    - ${RUN_IN_SANDBOX} --share=network pre-commit run --all-files
+    - xvfb-run -n 32 -s "-screen 0 640x480x24" ${RUN_IN_SANDBOX} gst-validate-launcher 
$PWD/tests/ptv_testsuite.py --dump-on-failure --timeout-factor 4 --xunit-file ${XUNIT_PATH} --logs-dir 
${CI_PROJECT_DIR}/tests-logs
   cache:
     paths:
       - flatpak-cache
@@ -83,8 +80,8 @@ build:
     expire_in: 30 days
     paths:
       - xunit.xml
-      - flatpak_repo.tar
-      - tests-logs.tar.gz
+      - repo/
+      - tests-logs/
     reports:
       junit:
         - ${XUNIT_PATH}
@@ -95,7 +92,6 @@ deploy:
     - PitiviBuildMachine
   stage: deploy
   script:
-    - tar xf flatpak_repo.tar
     - flatpak build-commit-from --src-repo=flatpak_repo /srv/http --timestamp=NOW --gpg-sign=739E841A
   only:
     - master@GNOME/pitivi
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 17a758c49..9d2a97ecf 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -27,6 +27,7 @@ repos:
         args:
           # http://www.pydocstyle.org/en/latest/error_codes.html
           - --ignore=D1,D203,D213,D401,D406,D407,D413
+        exclude: '.*pitivi/utils/extract.py$|.*pitivi/autoaligner.py$'
   - repo: https://gitlab.com/PyCQA/flake8
     rev: 3.7.9
     hooks:
@@ -35,6 +36,11 @@ repos:
           # http://flake8.pycqa.org/en/latest/user/error-codes.html
           # https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes
           - --ignore=E402,E501,E722,F401,F841,W504
+        exclude: >
+          (?x)^(
+            pitivi/utils/extract.py|
+            pitivi/autoaligner.py|
+          )$
   - repo: local
     hooks:
       - id: pylint
@@ -42,6 +48,13 @@ repos:
         entry: python3 -m pylint.__main__ --rcfile=pylint.rc
         language: system
         types: [python]
+        exclude: >
+          (?x)^(
+            pitivi/utils/extract.py|
+            pitivi/autoaligner.py|
+            tests/validate-tests/manager.py|
+            bin/pitivi.in
+          )$
   - repo: https://github.com/adrienverge/yamllint.git
     rev: v1.20.0
     hooks:
diff --git a/data/gstpresets/jpeg-raw-in-qt.gep b/data/gstpresets/jpeg-raw-in-qt.gep
index bf3a86de6..876f60a33 100644
--- a/data/gstpresets/jpeg-raw-in-qt.gep
+++ b/data/gstpresets/jpeg-raw-in-qt.gep
@@ -23,4 +23,3 @@ presence=0
 pass=0
 variableframerate=false
 preset=Quality High
-
diff --git a/data/gstpresets/prores-raw-in-qt.gep b/data/gstpresets/prores-raw-in-qt.gep
index 4081291df..8b247f772 100644
--- a/data/gstpresets/prores-raw-in-qt.gep
+++ b/data/gstpresets/prores-raw-in-qt.gep
@@ -21,4 +21,4 @@ type=video
 format=video/x-prores
 presence=0
 pass=0
-variableframerate=false
\ No newline at end of file
+variableframerate=false
diff --git a/pitivi/dialogs/prefs.py b/pitivi/dialogs/prefs.py
index d8e0c21ae..14d593917 100644
--- a/pitivi/dialogs/prefs.py
+++ b/pitivi/dialogs/prefs.py
@@ -393,7 +393,7 @@ class PreferencesDialog(Loggable):
         index = 0
         for group in shortcuts_manager.groups:
             actions = shortcuts_manager.group_actions[group]
-            for action, title, _ in actions:
+            for action, title, _unused in actions:
                 item = ModelItem(self.app, action, title, group)
                 self.list_store.append(item)
                 self.action_ids[action] = index


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]