-
Notifications
You must be signed in to change notification settings - Fork 10
/
.gitlab-ci.yml
101 lines (88 loc) · 2.11 KB
/
.gitlab-ci.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
include:
- remote: https://github.com/elct9620/ruby-gitlab-ci/raw/main/rails.yml
- remote: https://github.com/elct9620/ruby-gitlab-ci/raw/main/swarm.yml
variables:
RUBY_VERSION: 2.7.8
ASSETS_PRECOMPILE: 'yes'
NODE_PACKAGE_REQUIRED: 'yes'
BUNDLER_VERSION: 2.2.33
UPLOAD_TO_S3: 'no'
INSTALL_CHROME: 'no'
DOCKER_VERSION: '23.0.6'
DOCKER_BUILDX_VERSION: '0.11.2'
POSTGRES_VERSION: 15-alpine
POSTGRES_USER: cfp
POSTGRES_DB: cfp
POSTGRES_PASSWORD: cfpcfp123
TZ: 'Asia/Taipei'
node_modules:
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $NODE_PACKAGE_REQUIRED == "yes"'
- if: '$CI_MERGE_REQUEST_ID && $NODE_PACKAGE_REQUIRED == "yes"'
bundler-audit:
when: manual
rules:
- if: $CI_MERGE_REQUEST_ID
bundler-leak:
when: manual
rules:
- if: $CI_MERGE_REQUEST_ID
yarn-audit:
when: manual
rules:
- if: $CI_MERGE_REQUEST_ID
rubygems:
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_MERGE_REQUEST_ID
rspec:
when: manual
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_MERGE_REQUEST_ID
rubocop:
when: manual
rules:
- if: $CI_MERGE_REQUEST_ID
brakeman:
when: manual
rules:
- if: $CI_MERGE_REQUEST_ID
assets:precompile:
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
# - if: $CI_MERGE_REQUEST_ID
script:
- bundle exec rails assets:precompile
docker:
needs:
- job: assets:precompile
artifacts: true
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
variables:
LATEST_IMAGE: 'yes'
# - if: $CI_MERGE_REQUEST_ID
trivy:
when: manual
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
production:deploy:
when: manual
extends: .deploy
variables:
DEPLOY_NAME: cfp-production
DEPLOY_DOMAIN: cfp.rubyconf.tw
stage: deploy
before_script:
- cat $SETTINGS_FILE > config/application.yml
- !reference [.deploy, before_script]
environment:
name: production
needs:
- docker
tags: # Ensure Run on Docker Swarm
- sosi-site-prod
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
# - if: $CI_MERGE_REQUEST_ID