shithub: dav1d

Download patch

ref: bf60f0ab4e329a19045c29eb90c5184f040d88b3
parent: c4dea948cb87cab375a4c54859ad75442a388b7d
author: Konstantin Pavlov <[email protected]>
date: Fri Mar 6 18:03:49 EST 2020

CI: Deduplicate and template jobs

This makes it much easier to introduce new jobs without copying walls of
text over and over.  No functional changes.

Changes are:
 - move docker images to common templates to make them easier to bump
 - replace "debian" tag with "docker" to choose runners
 - align meson parameters
 - use variables sections where applicable
 - move test data cache to before_script

--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -3,12 +3,51 @@
     - build
     - test
 
-style-check:
+.debian-amd64-common:
     image: registry.videolan.org:5000/dav1d-debian-unstable:20190215130514
-    stage: style
+    stage: build
     tags:
-        - debian
+        - docker
         - amd64
+
+.debian-llvm-mingw-common:
+    image: registry.videolan.org:5000/vlc-debian-llvm-mingw:20190218133533
+    stage: build
+    tags:
+        - docker
+        - amd64
+
+.debian-aarch64-common:
+    image: registry.videolan.org/dav1d-debian-buster-aarch64:20200218203017
+    stage: build
+    tags:
+        - docker
+        - aarch64
+
+.debian-armv7-common:
+    image: registry.videolan.org:5000/dav1d-debian-unstable-armv7:20190202101732
+    stage: build
+    tags:
+        - docker
+        - armv7
+
+.debian-ppc64le-common:
+    image: registry.videolan.org/dav1d-debian-unstable-ppc64le:20190606105121
+    stage: build
+    tags:
+        - docker
+        - ppc64le
+
+.ubuntu-common:
+    image: registry.videolan.org/dav1d-ubuntu-bionic:20200121182340
+    stage: build
+    tags:
+        - docker
+        - amd64
+
+style-check:
+    extends: .debian-amd64-common
+    stage: style
     script:
         - git grep -I -n -P "\t|\r| $" -- . ':(exclude)*/compat/*' && exit 1
         - git grep -I -n -i "david" -- . ':(exclude)THANKS.md' ':(exclude).gitlab-ci.yml' && exit 1
@@ -35,34 +74,29 @@
           done
 
 build-debian:
-    image: registry.videolan.org:5000/dav1d-debian-unstable:20190215130514
-    stage: build
+    extends: .debian-amd64-common
     tags:
+        - docker
         - avx2
         - amd64
     script:
-        - meson build --buildtype release --werror
+        - meson build --buildtype release
+                      --werror
         - ninja -C build
         - cd build && meson test -v
 
 build-debian-static:
-    image: registry.videolan.org:5000/dav1d-debian-unstable:20190215130514
-    stage: build
-    tags:
-        - debian
-        - amd64
+    extends: .debian-amd64-common
     script:
-        - meson build --buildtype release --default-library static --werror
+        - meson build --buildtype release
+                      --default-library static
+                      --werror
         - ninja -C build
         - cd build && meson test -v
         - nm -A -g src/libdav1d.a | grep " [ABCDGRST] " | (! grep -v " _*dav1d_")
 
 build-debian32:
-    image: registry.videolan.org:5000/dav1d-debian-unstable:20181218135732
-    stage: build
-    tags:
-        - debian
-        - amd64
+    extends: .debian-amd64-common
     script:
         - meson build --buildtype release
                       --werror
@@ -71,11 +105,7 @@
         - cd build && meson test -v
 
 build-win32:
-    image: registry.videolan.org:5000/dav1d-debian-unstable:20190215130514
-    stage: build
-    tags:
-        - debian
-        - amd64
+    extends: .debian-amd64-common
     script:
         - wineserver -p && wine wineboot
         - meson build --buildtype release
@@ -95,11 +125,7 @@
         expire_in: 1 week
 
 build-win32-unaligned-stack:
-    image: registry.videolan.org:5000/vlc-debian-llvm-mingw:20190218133533
-    stage: build
-    tags:
-        - debian
-        - amd64
+    extends: .debian-llvm-mingw-common
     script:
         - wineserver -p && wine wineboot
         - meson build --buildtype release
@@ -110,11 +136,7 @@
         - cd build && meson test -v
 
 build-win64:
-    image: registry.videolan.org:5000/dav1d-debian-unstable:20190215130514
-    stage: build
-    tags:
-        - debian
-        - amd64
+    extends: .debian-amd64-common
     script:
         - wineserver -p && wine wineboot
         - meson build --buildtype release
@@ -134,11 +156,7 @@
         expire_in: 1 week
 
 build-win-arm32:
-    image: registry.videolan.org:5000/vlc-debian-llvm-mingw:20190218133533
-    stage: build
-    tags:
-        - debian
-        - amd64
+    extends: .debian-llvm-mingw-common
     script:
         - meson build --buildtype release
                       --werror
@@ -150,11 +168,7 @@
         - armv7-w64-mingw32-nm -A -g build/src/libdav1d.a | grep " [ABCDGRST] " | (! grep -E -v " \.| _*dav1d_")
 
 build-win-arm64:
-    image: registry.videolan.org:5000/vlc-debian-llvm-mingw:20190218133533
-    stage: build
-    tags:
-        - debian
-        - amd64
+    extends: .debian-llvm-mingw-common
     script:
         - meson build --buildtype release
                       --werror
@@ -172,24 +186,20 @@
         expire_in: 1 week
 
 build-debian-aarch64:
-    stage: build
-    image: registry.videolan.org/dav1d-debian-buster-aarch64:20200218203017
-    tags:
-        - aarch64
-        - debian
+    extends: .debian-aarch64-common
     script:
-        - meson build --buildtype debugoptimized --werror
+        - meson build --buildtype debugoptimized
+                      --werror
         - ninja -C build
         - cd build && meson test -v
 
 build-debian-aarch64-clang-5:
-    stage: build
-    image: registry.videolan.org/dav1d-debian-buster-aarch64:20200218203017
-    tags:
-        - aarch64
-        - debian
+    extends: .debian-aarch64-common
+    variables:
+        CC: clang-5.0
+        CFLAGS: '-integrated-as'
     script:
-        - env CC=clang-5.0 CFLAGS='-integrated-as' meson build --buildtype release
+        - meson build --buildtype release
         - ninja -C build
         - cd build && meson test -v
 
@@ -198,48 +208,41 @@
     tags:
         - macos
     script:
-        - meson build --buildtype release -Ddefault_library=both --werror
+        - meson build --buildtype release
+                      -Ddefault_library=both
+                      --werror
         - ninja -C build
         - cd build && meson test -v
 
 build-debian-werror:
-    image: registry.videolan.org/dav1d-debian-buster-aarch64:20200218203017
-    stage: build
-    tags:
-        - aarch64
-        - debian
+    extends: .debian-aarch64-common
+    variables:
+        CC: clang-7
     script:
-        - env CC='clang-7' meson build --buildtype debug --werror
+        - meson build --buildtype debug
+                      --werror
         - ninja -C build
 
 build-debian-armv7:
-    stage: build
-    image: registry.videolan.org:5000/dav1d-debian-unstable-armv7:20190202101732
-    tags:
-        - armv7
-        - debian
+    extends: .debian-armv7-common
     script:
-        - linux32 meson build --buildtype debugoptimized --werror
+        - linux32 meson build --buildtype debugoptimized
+                              --werror
         - ninja -C build
         - cd build && meson test -v
 
 build-debian-armv7-clang-5:
-    stage: build
-    image: registry.videolan.org:5000/dav1d-debian-unstable-armv7:20190202101732
-    tags:
-        - armv7
-        - debian
+    extends: .debian-armv7-common
+    variables:
+        CC: clang-5.0
+        CFLAGS: '-integrated-as'
     script:
-        - env CC=clang-5.0 CFLAGS='-integrated-as' linux32 meson build --buildtype release
+        - linux32 meson build --buildtype release
         - ninja -C build
         - cd build && meson test -v
 
 build-ubuntu-snap:
-    stage: build
-    image: registry.videolan.org/dav1d-ubuntu-bionic:20200121182340
-    tags:
-        - debian
-        - amd64
+    extends: .ubuntu-common
     script:
         - cd package/snap && snapcraft snap
         - |
@@ -256,143 +259,117 @@
     allow_failure: true
 
 build-debian-ppc64le:
-    stage: build
-    image: registry.videolan.org/dav1d-debian-unstable-ppc64le:20190606105121
-    tags:
-        - ppc64le
-        - docker
+    extends: .debian-ppc64le-common
     script:
-        - meson build --buildtype release --werror
+        - meson build --buildtype release
+                      --werror
         - ninja -C build
         - cd build && meson test -v
 
-test-debian:
-    image: registry.videolan.org:5000/dav1d-debian-unstable:20190215130514
+.test-common:
     stage: test
-    needs: ["build-debian"]
-    tags:
-        - debian
-        - amd64
     cache:
         key: testdata.git-20190215
         paths:
             - cache/dav1d-test-data.git/
-    script:
+    before_script:
         - test -d cache || mkdir cache
         - test -d cache/dav1d-test-data.git && GIT_DIR=cache/dav1d-test-data.git git fetch --refmap=refs/heads/master:refs/heads/master origin master
         - test -d cache/dav1d-test-data.git || git clone --bare https://code.videolan.org/videolan/dav1d-test-data.git cache/dav1d-test-data.git
         - git clone cache/dav1d-test-data.git tests/dav1d-test-data
-        - meson build --buildtype release -Dtestdata_tests=true -Dlogging=false
+    dependencies: []
+
+test-debian:
+    extends:
+        - .debian-amd64-common
+        - .test-common
+    needs: ["build-debian"]
+    script:
+        - meson build --buildtype release
+                      -Dtestdata_tests=true
+                      -Dlogging=false
         - ninja -C build
         - cd build && time meson test -v
-    dependencies: []
 
 test-debian-unaligned-stack:
-    image: registry.videolan.org:5000/dav1d-debian-unstable:20190215130514
-    stage: test
+    extends:
+        - .debian-amd64-common
+        - .test-common
     needs: ["build-debian"]
     tags:
+        - docker
         - avx2
         - amd64
-    cache:
-        key: testdata.git-20190215
-        paths:
-            - cache/dav1d-test-data.git/
     script:
-        - test -d cache || mkdir cache
-        - test -d cache/dav1d-test-data.git && GIT_DIR=cache/dav1d-test-data.git git fetch --refmap=refs/heads/master:refs/heads/master origin master
-        - test -d cache/dav1d-test-data.git || git clone --bare https://code.videolan.org/videolan/dav1d-test-data.git cache/dav1d-test-data.git
-        - git clone cache/dav1d-test-data.git tests/dav1d-test-data
-        - meson build --buildtype release -Dtestdata_tests=true -Dlogging=false -Dstack_alignment=16
+        - meson build --buildtype release
+                      -Dtestdata_tests=true
+                      -Dlogging=false
+                      -Dstack_alignment=16
         - ninja -C build
         - cd build && time meson test -v
-    dependencies: []
 
 test-debian-asan:
-    image: registry.videolan.org:5000/dav1d-debian-unstable:20190215130514
-    stage: test
+    extends:
+        - .debian-amd64-common
+        - .test-common
     needs: ["build-debian"]
-    tags:
-        - debian
-        - amd64
-    cache:
-        key: testdata.git-20190215
-        paths:
-            - cache/dav1d-test-data.git/
     variables:
         ASAN_OPTIONS: 'detect_leaks=0'
     script:
-        - test -d cache || mkdir cache
-        - test -d cache/dav1d-test-data.git && GIT_DIR=cache/dav1d-test-data.git git fetch --refmap=refs/heads/master:refs/heads/master origin master
-        - test -d cache/dav1d-test-data.git || git clone --bare https://code.videolan.org/videolan/dav1d-test-data.git cache/dav1d-test-data.git
-        - git clone cache/dav1d-test-data.git tests/dav1d-test-data
-        - meson build --buildtype debugoptimized -Dtestdata_tests=true -Dlogging=false -Db_sanitize=address -Denable_asm=false
+        - meson build --buildtype debugoptimized
+                      -Dtestdata_tests=true
+                      -Dlogging=false
+                      -Db_sanitize=address
+                      -Denable_asm=false
         - ninja -C build
         - cd build && time meson test -v --setup=sanitizer
-    dependencies: []
 
 test-debian-msan:
-    image: registry.videolan.org:5000/dav1d-debian-unstable:20190215130514
-    stage: test
+    extends:
+        - .debian-amd64-common
+        - .test-common
     needs: ["build-debian"]
-    tags:
-        - debian
-        - amd64
-    cache:
-        key: testdata.git-20190215
-        paths:
-            - cache/dav1d-test-data.git/
     variables:
         MSAN_OPTIONS: 'exitcode=1'
+        CC: clang
     script:
-        - test -d cache || mkdir cache
-        - test -d cache/dav1d-test-data.git && GIT_DIR=cache/dav1d-test-data.git git fetch --refmap=refs/heads/master:refs/heads/master origin master
-        - test -d cache/dav1d-test-data.git || git clone --bare https://code.videolan.org/videolan/dav1d-test-data.git cache/dav1d-test-data.git
-        - git clone cache/dav1d-test-data.git tests/dav1d-test-data
-        - env CC=clang meson build --buildtype debugoptimized -Dtestdata_tests=true -Dlogging=false -Db_sanitize=memory -Db_lundef=false -Denable_asm=false
+        - meson build --buildtype debugoptimized
+                      -Dtestdata_tests=true
+                      -Dlogging=false
+                      -Db_sanitize=memory
+                      -Db_lundef=false
+                      -Denable_asm=false
         - ninja -C build
         - cd build && time meson test -v --setup=sanitizer
-    dependencies: []
 
 test-debian-ubsan:
-    image: registry.videolan.org:5000/dav1d-debian-unstable:20190215130514
-    stage: test
+    extends:
+        - .debian-amd64-common
+        - .test-common
     needs: ["build-debian"]
-    tags:
-        - debian
-        - amd64
-    cache:
-        key: testdata.git-20190215
-        paths:
-            - cache/dav1d-test-data.git/
     variables:
         UBSAN_OPTIONS: 'print_stacktrace=1:halt_on_error=1'
+        CC: clang
     script:
-        - test -d cache || mkdir cache
-        - test -d cache/dav1d-test-data.git && GIT_DIR=cache/dav1d-test-data.git git fetch --refmap=refs/heads/master:refs/heads/master origin master
-        - test -d cache/dav1d-test-data.git || git clone --bare https://code.videolan.org/videolan/dav1d-test-data.git cache/dav1d-test-data.git
-        - git clone cache/dav1d-test-data.git tests/dav1d-test-data
-        - env CC=clang meson build --buildtype debugoptimized -Dtestdata_tests=true -Dlogging=false -Db_sanitize=undefined -Db_lundef=false -Denable_asm=false
+        - meson build --buildtype debugoptimized
+                      -Dtestdata_tests=true
+                      -Dlogging=false
+                      -Db_sanitize=undefined
+                      -Db_lundef=false
+                      -Denable_asm=false
         - ninja -C build
         - cd build && time meson test -v --setup=sanitizer
-    dependencies: []
 
 test-win64:
-    image: registry.videolan.org:5000/dav1d-debian-unstable:20190215130514
-    stage: test
+    extends:
+        - .debian-amd64-common
+        - .test-common
     needs: ["build-win64"]
     tags:
+        - docker
         - avx2
         - amd64
-    cache:
-        key: testdata.git-20190215
-        paths:
-            - cache/dav1d-test-data.git/
     script:
-        - test -d cache || mkdir cache
-        - test -d cache/dav1d-test-data.git && GIT_DIR=cache/dav1d-test-data.git git fetch --refmap=refs/heads/master:refs/heads/master origin master
-        - test -d cache/dav1d-test-data.git || git clone --bare https://code.videolan.org/videolan/dav1d-test-data.git cache/dav1d-test-data.git
-        - git clone cache/dav1d-test-data.git tests/dav1d-test-data
         - wineserver -p && wine wineboot
         - meson build --buildtype release
                       -Dtestdata_tests=true
@@ -400,73 +377,42 @@
                       --cross-file /opt/crossfiles/x86_64-w64-mingw32.meson
         - ninja -C build
         - cd build && time meson test -v
-    dependencies: []
 
 test-debian-aarch64:
-    image: registry.videolan.org/dav1d-debian-buster-aarch64:20200218203017
-    stage: test
+    extends:
+        - .debian-aarch64-common
+        - .test-common
     needs: ["build-debian-aarch64"]
-    tags:
-        - aarch64
-        - debian
-    cache:
-        key: testdata.git-20190215
-        paths:
-            - cache/dav1d-test-data.git/
     script:
-        - test -d cache || mkdir cache
-        - test -d cache/dav1d-test-data.git && GIT_DIR=cache/dav1d-test-data.git git fetch --refmap=refs/heads/master:refs/heads/master origin master
-        - test -d cache/dav1d-test-data.git || git clone --bare https://code.videolan.org/videolan/dav1d-test-data.git cache/dav1d-test-data.git
-        - git clone cache/dav1d-test-data.git tests/dav1d-test-data
         - meson build --buildtype release
                       -Dtestdata_tests=true
                       -Dlogging=false
         - ninja -C build
         - cd build && time meson test -v
-    dependencies: []
 
 test-debian-ppc64le:
-    image: registry.videolan.org/dav1d-debian-unstable-ppc64le:20190606105121
-    stage: test
+    extends:
+        - .debian-ppc64le-common
+        - .test-common
     needs: ["build-debian-ppc64le"]
-    tags:
-        - ppc64le
-        - docker
-    cache:
-        key: testdata.git-20190215
-        paths:
-            - cache/dav1d-test-data.git/
     script:
-        - test -d cache || mkdir cache
-        - test -d cache/dav1d-test-data.git && GIT_DIR=cache/dav1d-test-data.git git fetch --refmap=refs/heads/master:refs/heads/master origin master
-        - test -d cache/dav1d-test-data.git || git clone --bare https://code.videolan.org/videolan/dav1d-test-data.git cache/dav1d-test-data.git
-        - git clone cache/dav1d-test-data.git tests/dav1d-test-data
         - meson build --buildtype release
                       -Dtestdata_tests=true
                       -Dlogging=false
         - ninja -C build
         - cd build && time meson test -v
-    dependencies: []
 
 test-debian-armv7-clang-5:
-    stage: test
-    image: registry.videolan.org:5000/dav1d-debian-unstable-armv7:20190202101732
+    extends:
+        - .debian-armv7-common
+        - .test-common
     needs: ["build-debian-armv7-clang-5"]
-    tags:
-        - armv7
-        - debian
-    cache:
-        key: testdata.git-20190215
-        paths:
-            - cache/dav1d-test-data.git/
+    variables:
+        CC: clang-5.0
+        CFLAGS: '-integrated-as'
     script:
-        - test -d cache || mkdir cache
-        - test -d cache/dav1d-test-data.git && GIT_DIR=cache/dav1d-test-data.git git fetch --refmap=refs/heads/master:refs/heads/master origin master
-        - test -d cache/dav1d-test-data.git || git clone --bare https://code.videolan.org/videolan/dav1d-test-data.git cache/dav1d-test-data.git
-        - git clone cache/dav1d-test-data.git tests/dav1d-test-data
-        - env CC=clang-5.0 CFLAGS='-integrated-as' linux32 meson build --buildtype release
-                                                               -Dtestdata_tests=true
-                                                               -Dlogging=false
+        - linux32 meson build --buildtype release
+                              -Dtestdata_tests=true
+                              -Dlogging=false
         - ninja -C build
         - cd build && time meson test -v
-    dependencies: []