-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
89 lines (79 loc) · 1.75 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
---
image: "ruby:3.2"
services:
- mysql:8.0
variables:
RAILS_ENV: test
MYSQL_DATABASE: thape_pp_test
MYSQL_HOST: mysql
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
CACHE_FALLBACK_KEY: "$CI_COMMIT_REF_SLUG"
before_script:
# Setup Node.js
- curl -fsSL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh
- bash nodesource_setup.sh
- apt-get install -y nodejs
# Install Yarn
- npm config set registry https://registry.npmmirror.com/ --global
- npm install --global yarn
# Verify installations
- node -v
- yarn -v
- ruby -v
- which ruby
# Setup Bundler
- gem install bundler --no-document
- bundle config set path 'vendor' # Install dependencies into ./vendor/ruby
- bundle install --jobs $(nproc)
# Install JavaScript dependencies
- yarn install --cache-folder .yarn-cache
stages:
- test
- deploy
test:
stage: test
services:
- mysql:8.0
variables:
MYSQL_DATABASE: thape_pp_test
MYSQL_HOST: mysql
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
cache:
- key:
files:
- Gemfile.lock
paths:
- vendor/ruby
- key:
files:
- yarn.lock
paths:
- .yarn-cache/
script:
- bin/rails db:drop RAILS_ENV=test
- bin/rails db:setup RAILS_ENV=test
- bundle exec standardrb
- bin/rails test
- bin/rails test:system
only:
- main
- merge_requests
deploy_staging:
stage: deploy
cache:
- key:
files:
- Gemfile.lock
paths:
- vendor/ruby
script:
- bundle install -j $(nproc)
- mkdir ~/.ssh
- mv "$SSH_ID_RSA" ~/.ssh/id_rsa
- mv "$SSH_CONFIG_FILE" ~/.ssh/config
- bundle exec cap staging deploy
environment:
name: staging
url: https://starter.redwoodjs.cn
only:
- main