rerun yarn in each job in the CI pipeline
authorDan Allen <dan@opendevise.com>
Thu, 11 Jan 2018 03:53:42 +0000 (20:53 -0700)
committerDan Allen <dan@opendevise.com>
Thu, 11 Jan 2018 03:53:42 +0000 (20:53 -0700)
- only rely on .yarn-cache, not node_modules

.gitlab-ci.yml

index 87076f4..f2fa9f2 100644 (file)
@@ -7,26 +7,27 @@ yarn:
   stage: setup
   cache:
     paths:
-    - node_modules/
     - .yarn-cache/
   script:
-  - yarn --cache-folder=.yarn-cache
+  - &run_yarn
+    yarn --cache-folder=.yarn-cache --no-progress --pure-lockfile
 lint:
   stage: verify
-  cache:
+  cache: &pull_cache
     policy: pull
     paths:
-    - node_modules/
-  script: node_modules/.bin/gulp lint
+    - .yarn-cache/
+  script:
+  - *run_yarn
+  - node_modules/.bin/gulp lint
 bundle-stable:
   stage: deploy
   only:
   - master@antora/antora-ui-default
-  cache:
-    policy: pull
-    paths:
-    - node_modules/
-  script: node_modules/.bin/gulp pack
+  cache: *pull_cache
+  script:
+  - *run_yarn
+  - node_modules/.bin/gulp pack
   artifacts:
     paths:
     - build/ui-bundle.zip
@@ -34,25 +35,21 @@ bundle-dev:
   stage: deploy
   except:
   - master
-  cache:
-    policy: pull
-    paths:
-    - node_modules/
-  script: node_modules/.bin/gulp pack
+  cache: *pull_cache
+  script:
+  - *run_yarn
+  - node_modules/.bin/gulp pack
   artifacts:
-    # automatically expire unless marked "keep" from job page
-    expire_in: 1 day
+    expire_in: 1 day # unless marked as keep from job page
     paths:
     - build/ui-bundle.zip
 pages:
   stage: deploy
   only:
   - master@antora/antora-ui-default
-  cache:
-    policy: pull
-    paths:
-    - node_modules/
+  cache: *pull_cache
   script:
+  - *run_yarn
   - node_modules/.bin/gulp build:preview
   # FIXME figure out a way to avoid copying these files to preview site
   - rm -rf public/_/{helpers,layouts,partials}