-
Notifications
You must be signed in to change notification settings - Fork 35
168 lines (164 loc) · 4.78 KB
/
build.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
env:
RUBY_VERSION: 3.1
DB_USER: postgres
DB_PASSWORD: postgres
DB_NAME: sugar_test
name: Build
on:
push:
branches:
- main
- develop
pull_request:
jobs:
eslint-test:
name: ESLint
runs-on: ubuntu-latest
timeout-minutes: 10
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v1
- name: Node modules cache
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Node modules
run: |
yarn install
- name: Check code
run: yarn lint
prettier:
name: Prettier
runs-on: ubuntu-latest
timeout-minutes: 10
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v1
- name: Node modules cache
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Node modules
run: |
yarn install
- name: Check code
run: yarn prettier
rubocop-test:
name: Rubocop
runs-on: ubuntu-latest
timeout-minutes: 10
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v1
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: ${{ env.RUBY_VERSION }}
- name: Install system dependencies
run: |
sudo apt-get install -y libvips42
- name: Install Ruby gems
run: |
gem install bundler
bundle config path vendor/bundle
bundle install
- name: Check code
run: bundle exec rubocop
rspec-test:
name: RSpec
runs-on: ubuntu-latest
timeout-minutes: 15
if: "!contains(github.event.head_commit.message, '[ci skip]')"
services:
postgres:
image: postgres:14
ports:
- 5432:5432
env:
POSTGRES_USER: ${{ env.DB_USER }}
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }}
POSTGRES_DB: ${{ env.DB_NAME }}
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps port 6379 on service container to the host
- 6379:6379
steps:
- uses: actions/checkout@v1
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: ${{ env.RUBY_VERSION }}
- name: Start Solr
run: /usr/bin/docker run -d -v ${{ github.workspace }}/solr/init:/docker-entrypoint-initdb.d/ -p 8983:8983 --name solr solr:8
- name: Ruby gem cache
uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install system dependencies
run: |
sudo apt-get install -y libvips42
- name: Install Ruby gems
run: |
gem install bundler
bundle config path vendor/bundle
bundle install
- name: Node modules cache
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Node modules
run: |
yarn install
- name: Build frontend
run: |
yarn build
yarn build:css
- name: Create database
env:
# RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
RAILS_ENV: test
SUGAR_DB_HOST: 127.0.0.1
SUGAR_DB_USERNAME: ${{ env.DB_USER }}
SUGAR_DB_PASSWORD: ${{ env.DB_PASSWORD }}
REDIS_URL: redis://localhost:6379/1
run: |
bin/rails db:migrate
- name: Run tests
env:
# RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
SUGAR_DB_HOST: 127.0.0.1
SUGAR_DB_USERNAME: ${{ env.DB_USER }}
SUGAR_DB_PASSWORD: ${{ env.DB_PASSWORD }}
REDIS_URL: redis://localhost:6379/1
SOLR_HOST: localhost
SOLR_PORT: 8983
run: bundle exec rspec
- name: Send results to Code Climate
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageCommand: ls