-
Notifications
You must be signed in to change notification settings - Fork 2
/
common.yml
87 lines (79 loc) · 2.2 KB
/
common.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
spec:
inputs:
platform:
description: 'The Ruby platform to use'
type: string
options:
- 'ruby'
- 'jruby'
default: 'ruby'
---
stages:
- prepare
- lint
- test
- compile
- build
- scan
- deploy
- release
variables:
NODE_VERSION: 18.16.0
NODE_PACKAGE_REQUIRED: 'yes'
.common-node-cache: &common-node-cache
key:
files:
- yarn.lock
- package-lock.json
prefix: node-$CI_COMMIT_REF_NAME
paths:
- node_modules
policy: pull
.ruby-cache: &ruby-cache
key:
files:
- Gemfile.lock
prefix: ruby-$CI_COMMIT_REF_NAME
paths:
- vendor/ruby
policy: pull
.ruby:
image: $[[ inputs.platform ]]:$RUBY_VERSION
before_script:
- export LANG=C.UTF-8
- export LC_ALL=C.UTF-8
- echo -e "\e[0Ksection_start:`date +%s`:bundle_install[collapsed=true]\r\e[0KBundle Install"
- gem install bundler -v ${BUNDLER_VERSION:-2.3.20}
- bundle config set path 'vendor'
- bundle install # Ensure Gem installed
- echo -e "\e[0Ksection_end:`date +%s`:bundle_install\r\e[0K"
cache:
- <<: *ruby-cache
.webdrivers-cache: &webdrivers-cache
paths:
- tmp/webdrivers
policy: pull
.install_node:
# TODO: Improve Node.js install in Ruby image
- if [[ "$NODE_PACKAGE_REQUIRED" == "yes" ]];
then echo -e "\e[0Ksection_start:`date +%s`:setup_node[collapsed=true]\r\e[0KSetup Node.js"
&& curl -SLO https://nodejs.org/dist/v$NODE_VERSION/node-v${NODE_VERSION}-linux-x64.tar.xz
&& tar -xJf node-v${NODE_VERSION}-linux-x64.tar.xz -C /usr/local --strip-components=1
&& curl -o- -L https://yarnpkg.com/install.sh | bash
&& export PATH=$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH
&& echo -e "\e[0Ksection_end:`date +%s`:setup_node\r\e[0K";
fi
.rails:
extends: .ruby
before_script:
- !reference [.install_node]
- if [[ "$NODE_PACKAGE_REQUIRED" == "yes" ]];
then echo -e "\e[0Ksection_start:`date +%s`:yarn_install[collapsed=true]\r\e[0KYarn Install"
&& yarn install
&& echo -e "\e[0Ksection_end:`date +%s`:yarn_install\r\e[0K";
fi
- !reference [.ruby, before_script]
cache:
- <<: *ruby-cache
- <<: *common-node-cache
- <<: *webdrivers-cache