-
Notifications
You must be signed in to change notification settings - Fork 26
/
.gitlab-ci.yml
113 lines (100 loc) · 3.21 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
102
103
104
105
106
107
108
109
110
111
112
113
image: "registry.gitlab.com/vglist/vglist:latest"
services:
- postgres:14
variables:
BUNDLE_PATH: vendor/bundle
DB_HOST: postgres
POSTGRES_DB: ci_test
POSTGRES_USER: runner
POSTGRES_PASSWORD: ""
POSTGRES_HOST_AUTH_METHOD: trust
RAILS_ENV: test
RACK_ENV: test
NODE_ENV: test
CI: 'true'
BUNDLER_VERSION: '2.5.9'
# Cache gems and node_modules in between builds
cache:
key: '$BUNDLER_VERSION'
paths:
- vendor/bundle
- node_modules
# By default, only pull. We don't need every job to update the cache.
policy: pull
before_script:
- ruby -v
- node -v
- gem install bundler:$BUNDLER_VERSION
- echo -e "section_start:`date +%s`:bundle_install[collapsed=true]\r\e[0Kbundle install"
- bundle install -j $(nproc)
- echo -e "section_end:`date +%s`:bundle_install\r\e[0K"
- echo -e "section_start:`date +%s`:yarn_install[collapsed=true]\r\e[0Kyarn install"
- yarn install --frozen-lockfile
- echo -e "section_end:`date +%s`:yarn_install\r\e[0K"
- cp config/database.yml.ci config/database.yml
- echo -e "section_start:`date +%s`:db_create[collapsed=true]\r\e[0Kbundle exec rails db:create"
- bundle exec rails db:create
- echo -e "section_end:`date +%s`:db_create\r\e[0K"
- echo -e "section_start:`date +%s`:db_schema_load[collapsed=true]\r\e[0Kbundle exec rails db:schema:load"
- bundle exec rails db:schema:load --trace
- echo -e "section_end:`date +%s`:db_schema_load\r\e[0K"
.no_db_template:
before_script: &no_db_necessary
- ruby -v
- gem install bundler:$BUNDLER_VERSION
- echo -e "section_start:`date +%s`:bundle_install[collapsed=true]\r\e[0Kbundle install"
- bundle install -j $(nproc)
- echo -e "section_end:`date +%s`:bundle_install\r\e[0K"
- echo -e "section_start:`date +%s`:yarn_install[collapsed=true]\r\e[0Kyarn install"
- yarn install --frozen-lockfile
- echo -e "section_end:`date +%s`:yarn_install\r\e[0K"
# A simple hack to make it so the package cache is updated independently of any
# other jobs, to prevent unnecessary time spent pushing the cache for more than
# one job.
cacher:
before_script: *no_db_necessary
script:
- bundle clean --force
cache:
key: '$BUNDLER_VERSION'
paths:
- vendor/bundle
- node_modules
policy: pull-push
sorbet:tc:
before_script: *no_db_necessary
script:
- bundle exec srb tc .
typescript:tsc:
before_script: *no_db_necessary
script:
- yarn run tsc --noEmit
rubocop:
before_script: *no_db_necessary
script:
- bundle exec rubocop
factory_bot_lint:
script:
- bundle exec rake factory_bot:lint
rspec:
script:
- bundle exec rails zeitwerk:check
- echo -e "section_start:`date +%s`:assets_precompile[collapsed=true]\r\e[0Kbundle exec rake assets:precompile"
- bundle exec rake assets:precompile
- echo -e "section_end:`date +%s`:assets_precompile\r\e[0K"
- bundle exec rspec
coverage: '/\(\d+.\d+\%\) covered/'
# Save the artifacts from simplecov's code coverage output.
artifacts:
when: always
paths:
- coverage
expire_in: 10 days
name: "Code Coverage Report"
db:seed:
script:
- bundle exec rails db:seed
graphql:lint:
script:
- bundle exec rake graphql:schema:idl
- yarn graphql-schema-linter schema.graphql