|
30 | 30 | variables_bundler: &variables_bundler |
31 | 31 | BUNDLE_CACHE_PATH: '${CI_PROJECT_DIR}/.cache/bundler' |
32 | 32 | BUNDLE_WITHOUT: 'production' |
33 | | - # `cache` |
34 | 33 | cache_bundler: &cache_bundler |
35 | | - key: '${CI_JOB_STAGE}' |
| 34 | + key: |
| 35 | + files: |
| 36 | + - 'Gemfile.lock' |
| 37 | + prefix: 'bundler' |
36 | 38 | paths: |
37 | 39 | - '${BUNDLE_CACHE_PATH}' |
| 40 | + # https://pre-commit.com/#gitlab-ci-example |
| 41 | + variables_pre-commit: &variables_pre-commit |
| 42 | + PRE_COMMIT_HOME: '${CI_PROJECT_DIR}/.cache/pre-commit' |
| 43 | + cache_pre-commit: &cache_pre-commit |
| 44 | + key: |
| 45 | + files: |
| 46 | + - '.pre-commit-config.yaml' |
| 47 | + prefix: 'pre-commit' |
| 48 | + paths: |
| 49 | + - '${PRE_COMMIT_HOME}' |
38 | 50 |
|
39 | 51 | ############################################################################### |
40 | 52 | # Define stages and global variables |
@@ -78,15 +90,8 @@ pre-commit: |
78 | 90 | stage: *stage_lint |
79 | 91 | image: *image_precommit |
80 | 92 | # https://pre-commit.com/#gitlab-ci-example |
81 | | - variables: |
82 | | - PRE_COMMIT_HOME: '${CI_PROJECT_DIR}/.cache/pre-commit' |
83 | | - cache: |
84 | | - key: |
85 | | - files: |
86 | | - - .pre-commit-config.yaml |
87 | | - prefix: pre-commit |
88 | | - paths: |
89 | | - - '${PRE_COMMIT_HOME}' |
| 93 | + variables: *variables_pre-commit |
| 94 | + cache: *cache_pre-commit |
90 | 95 | script: |
91 | 96 | - 'pre-commit run --all-files --color always --verbose' |
92 | 97 | - 'pre-commit run --color always --hook-stage manual commitlint-ci' |
@@ -137,8 +142,13 @@ rubocop: |
137 | 142 | stage: *stage_test |
138 | 143 | image: *image_dindrubybionic |
139 | 144 | services: *services_docker_dind |
140 | | - variables: *variables_bundler |
141 | | - cache: *cache_bundler |
| 145 | + variables: |
| 146 | + <<: [*variables_bundler, *variables_pre-commit] |
| 147 | + cache: |
| 148 | + - <<: *cache_bundler |
| 149 | + policy: 'pull' |
| 150 | + - <<: *cache_pre-commit |
| 151 | + policy: 'pull' |
142 | 152 | before_script: |
143 | 153 | - 'export CONVERTED=test-the-use_this_template-button' |
144 | 154 | - 'git clone . /tmp/"${CONVERTED}"-formula' |
|
0 commit comments