From 92e008bca84781c349e32f796e04eb2adf51695b Mon Sep 17 00:00:00 2001
From: nrbffs <38812627+nrbffs@users.noreply.github.com>
Date: Mon, 22 Apr 2019 11:09:18 -0400
Subject: [PATCH] CI: do not build all targets on all branches

When building non-tagged and non-scheduled commits, only build
x86-64 to speed up the build.
---
 .gitlab-ci.yml | 90 ++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 65 insertions(+), 25 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 757110bc4..cfedbdd12 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -7,7 +7,15 @@ stages:
   - build
   - package
 
-.target: &target
+# Build Types
+# ----
+#
+# * commit: build all branches on commit for x86-64 target.#
+# * nightly: built once a night from `master` branch for all targets. 
+# * beta: built from tag starting with "beta/", i.e. "beta/1.7-beta01" for all targets.
+# * stable: built from tag starting with "stable/", i.e. "stable/1.5" for all targets.
+
+.target:
   stage: build
   script:
     - make -C gluon update GLUON_SITEDIR="$CI_PROJECT_DIR"
@@ -18,79 +26,111 @@ stages:
     expire_in: 1 day
  
 target:ar71xx-generic:
-  <<: *target
+  extends: .target
+  only: 
+    - tags
+    - schedules
+    - web
   variables:
     GLUON_TARGET: ar71xx-generic
  
 target:ar71xx-nand:
-  <<: *target
+  extends: .target
+  only: 
+    - tags
+    - schedules
+    - web
   variables:
     GLUON_TARGET: ar71xx-nand
  
 target:ar71xx-tiny:
-  <<: *target
+  extends: .target
+  only: 
+    - tags
+    - schedules
+    - web
   variables:
     GLUON_TARGET: ar71xx-tiny
  
 target:brcm2708-bcm2708:
-  <<: *target
+  extends: .target
+  only: 
+    - tags
+    - schedules
+    - web
   variables:
     GLUON_TARGET: brcm2708-bcm2708
  
 target:brcm2708-bcm2709:
-  <<: *target
+  extends: .target
+  only: 
+    - tags
+    - schedules
+    - web
   variables:
     GLUON_TARGET: brcm2708-bcm2709
  
 target:mpc85xx-generic:
-  <<: *target
+  extends: .target
+  only: 
+    - tags
+    - schedules
+    - web
   variables:
     GLUON_TARGET: mpc85xx-generic
  
 target:ipq40xx:
-  <<: *target
+  extends: .target
+  only: 
+    - tags
+    - schedules
+    - web
   variables:
     GLUON_TARGET: ipq40xx
  
 target:ramips-mt7621:
-  <<: *target
+  extends: .target
+  only: 
+    - tags
+    - schedules
+    - web
   variables:
     GLUON_TARGET: ramips-mt7621
  
 target:ramips-mt76x8:
-  <<: *target
+  extends: .target
+  only: 
+    - tags
+    - schedules
+    - web
   variables:
     GLUON_TARGET: ramips-mt76x8
  
 target:x86-generic:
-  <<: *target
+  extends: .target
+  only: 
+    - tags
+    - schedules
+    - web
   variables:
     GLUON_TARGET: x86-generic
  
 target:x86-geode:
-  <<: *target
+  extends: .target
+  only: 
+    - tags
+    - schedules
+    - web
   variables:
     GLUON_TARGET: x86-geode
  
 target:x86-64:
-  <<: *target
+  extends: .target
   variables:
     GLUON_TARGET: x86-64
 
 package:
   stage: package
-  dependencies:
-    - target:ar71xx-generic
-    - target:ar71xx-tiny
-    - target:ar71xx-nand
-    - target:brcm2708-bcm2708
-    - target:brcm2708-bcm2709
-    - target:ipq40xx
-    - target:mpc85xx-generic
-    - target:ramips-mt7621
-    - target:x86-generic
-    - target:x86-geode
-    - target:x86-64
   script:
     - make -C gluon update GLUON_SITEDIR="$CI_PROJECT_DIR"
     - make -C gluon manifest GLUON_BRANCH=nightly GLUON_SITEDIR="$CI_PROJECT_DIR" V=1
-- 
GitLab