-
Notifications
You must be signed in to change notification settings - Fork 35
146 lines (141 loc) · 3.92 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
env:
RUBY_VERSION: 3.3
DB_USER: postgres
DB_PASSWORD: postgres
DB_NAME: sugar_test
name: Build
on:
push:
branches:
- main
- develop
pull_request:
jobs:
eslint:
name: ESLint
runs-on: ubuntu-latest
timeout-minutes: 10
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
run_install: true
- name: Check code
run: pnpm lint
prettier:
name: Prettier
runs-on: ubuntu-latest
timeout-minutes: 10
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
run_install: true
- name: Check code
run: pnpm prettier
rubocop:
name: Rubocop
runs-on: ubuntu-latest
timeout-minutes: 10
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v4
- 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 --format github
rspec:
name: RSpec
runs-on: ubuntu-latest
timeout-minutes: 15
if: "!contains(github.event.head_commit.message, '[ci skip]')"
services:
postgres:
image: postgres:latest
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@v4
- uses: pnpm/action-setup@v4
with:
version: 9
run_install: true
- 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: Install system dependencies
run: |
sudo apt-get install -y libvips42
- name: Build frontend
run: |
pnpm build
pnpm 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
typescript:
name: TypeScript
runs-on: ubuntu-latest
timeout-minutes: 10
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
run_install: true
- name: Check code
run: pnpm tsc --noEmit