-
Notifications
You must be signed in to change notification settings - Fork 1
77 lines (75 loc) · 1.98 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
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: dis_test
name: Build
on:
push:
branches:
- main
- develop
pull_request:
jobs:
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: 3.3
- name: Check code
run: bundle exec rubocop
rspec-test:
name: RSpec
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ['3.2', '3.3']
services:
postgres:
image: postgres:latest
ports:
- 5432:5432
env:
POSTGRES_USER: ${{ env.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
POSTGRES_DB: ${{ env.POSTGRES_DB }}
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v1
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Install system dependencies
run: sudo apt-get install -y libpq-dev libsqlite3-dev
- name: Create database
env:
DB: postgres
RAILS_ENV: test
PGHOST: localhost
PGUSER: ${{ env.POSTGRES_USER }}
PGPASSWORD: ${{ env.POSTGRES_PASSWORD }}
run: |
bundle exec rake db:migrate
- name: Run tests
env:
DB: postgres
PGHOST: localhost
PGUSER: ${{ env.POSTGRES_USER }}
PGPASSWORD: ${{ env.POSTGRES_PASSWORD }}
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