-
Notifications
You must be signed in to change notification settings - Fork 1
94 lines (81 loc) · 2.3 KB
/
ruby.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
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
name: Ruby
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master", "develop" ]
permissions:
contents: read
jobs:
rubocop:
name: RuboCop
runs-on: ubuntu-latest
timeout-minutes: 8
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Ruby 3.0
id: ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
bundler-cache: true
- name: Run rubocop
run: |
bundle exec rubocop
unit_tests:
name: Unit Tests
runs-on: ubuntu-latest
timeout-minutes: 10
services:
postgres:
image: postgres:11.1
env:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
ports: ["5432:5432"]
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Ruby 3.0
id: ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
bundler-cache: true
- name: Install required package
run: |
sudo apt-get update
sudo apt-get -yqq install libpq-dev
- name: Create DB
env:
RACK_ENV: test
DATABASE_URL: postgres://[email protected]
run: |
bundle exec rake db:drop
bundle exec rake db:create
bundle exec rake db:migrate
- name: Run specs
run: bundle exec rspec -f j -o tmp/rspec_results.json -f p
- name: RSpec Report
uses: SonicGarden/rspec-report-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: 'Unit tests'
json-path: tmp/rspec_results.json
if: always()