[Android] CI: Use rules instead of except/only

Hugo Beauzée-Luyssen git at videolan.org
Tue Sep 8 06:40:54 CEST 2020


vlc-android | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Sep  7 15:24:59 2020 +0200| [8d387f9da2d618254807522335f1c547dbdccc2f] | committer: Hugo Beauzée-Luyssen

CI: Use rules instead of except/only

> https://code.videolan.org/videolan/vlc-android/commit/8d387f9da2d618254807522335f1c547dbdccc2f
---

 buildsystem/gitlab/.gitlab-ci.yml | 69 +++++++++++++++------------------------
 1 file changed, 26 insertions(+), 43 deletions(-)

diff --git a/buildsystem/gitlab/.gitlab-ci.yml b/buildsystem/gitlab/.gitlab-ci.yml
index a920af87a..434cbb7ed 100644
--- a/buildsystem/gitlab/.gitlab-ci.yml
+++ b/buildsystem/gitlab/.gitlab-ci.yml
@@ -20,16 +20,17 @@ cache:
 # Rebuilds libvlc JNI
 .build-libvlc-base:
     extends: .build-all-base
-    only:
-        refs:
-            - master at videolan/vlc-android
-            - merge_requests
+    rules:
+        # Explicitely refuse to build anything that would also trigger
+        # a medialib build
+      - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
+        changes:
+          - medialibrary/**/*
+          - buildsystem/**/*
+        when: never
+      - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
         changes:
-            # For build script, we rely on the .build-ml-base config
-            # which will also build libvlc
-            - libvlc/**/*
-    except:
-        - schedules
+          - libvlc/**/*
     variables:
         EXTRA_BUILD_PARAM: -l
 
@@ -37,15 +38,11 @@ cache:
 # This implies rebuilding VLC beforehand
 .build-ml-base:
     extends: .build-all-base
-    only:
-        refs:
-            - master at videolan/vlc-android
-            - merge_requests
+    rules:
+      - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
         changes:
-            - medialibrary/**/*
-            - buildsystem/**/*
-    except:
-        - schedules
+          - medialibrary/**/*
+          - buildsystem/**/*
     variables:
         EXTRA_BUILD_PARAM: -ml
 
@@ -55,20 +52,8 @@ continuous-app-build:
     script:
         - ./buildsystem/compile.sh --init
         - ./gradlew assembleDebug
-    only:
-        refs:
-            - master at videolan/vlc-android
-            - merge_requests
-        changes:
-            - "**/*"
-            - buildsystem/gitlab/.gitlab-ci.yml
-    except:
-        refs:
-            - schedules
-        changes:
-            - buildsystem/*
-            - libvlc/**/*
-            - medialibrary/**/*
+    rules:
+      - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
 
 #################################
 # Template config instantiation #
@@ -117,8 +102,8 @@ build-ml-x86_64:
 # Nightly builds: build native & app code, and ship the APK as artifact
 nightly-arm64:
     extends: .build-all-base
-    only: 
-        - schedules
+    rules:
+        - if: '$CI_PIPELINE_SOURCE == "schedule"'
     variables:
         ARCH: arm64
     artifacts:
@@ -128,8 +113,8 @@ nightly-arm64:
 
 nightly-armv7:
     extends: .build-all-base
-    only: 
-        - schedules
+    rules:
+        - if: '$CI_PIPELINE_SOURCE == "schedule"'
     variables:
         ARCH: arm
     artifacts:
@@ -139,8 +124,8 @@ nightly-armv7:
 
 nightly-x86:
     extends: .build-all-base
-    only: 
-        - schedules
+    rules:
+        - if: '$CI_PIPELINE_SOURCE == "schedule"'
     variables:
         ARCH: x86
     artifacts:
@@ -150,8 +135,8 @@ nightly-x86:
 
 nightly-x86_64:
     extends: .build-all-base
-    only: 
-        - schedules
+    rules:
+        - if: '$CI_PIPELINE_SOURCE == "schedule"'
     variables:
         ARCH: x86_64
     artifacts:
@@ -161,10 +146,8 @@ nightly-x86_64:
 
 publish_libs:
     extends: .build-all-base
-    only:
-        - /^libvlc-.*$/
-    except:
-        - branches
+    rules:
+        - if: '$CI_COMMIT_TAG =~ /^libvlc-.*$/'
     variables:
         ARCH: all
     script:



More information about the Android mailing list