-
Notifications
You must be signed in to change notification settings - Fork 2
124 lines (105 loc) · 3.36 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
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
name: Ruby
on:
pull_request:
paths:
- .github/workflows/ruby.yml
- '**.rb'
- '**.rake'
- '**.ru'
- 'Gemfile'
- 'Gemfile.lock'
- '**.js'
- '**.jsx'
- '**.ts'
- '**.tsx'
- 'package.json'
- 'yarn.lock'
- '**.html.erb'
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
env:
RAILS_ENV: test
DD_TRACE_ENABLED: false
TEST_COVERAGE: true
DATABASE_URL: 'postgres://postgres:test-password@localhost:5432/hotseat_test'
SEARCH_CLIENT: 'elasticsearch'
NOTIFICATION_TOKENS_PRICE: "price_12345"
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_DB: hotseat_test
POSTGRES_PASSWORD: 'test-password'
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
- name: Setup Elasticsearch
uses: ankane/setup-elasticsearch@v1
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
- name: Get system info
id: sysinfo
run: |
echo "::set-output name=yarn-cache-dir::$(yarn cache dir)"
echo "::set-output name=node-version::$(node --version | sed 's/\..*//')"
if cat /etc/*release 2>/dev/null
then
echo "::set-output name=os-version::$(cat /etc/*release | grep DISTRIB_RELEASE | sed 's/.*=//')"
else
echo "::set-output name=os-version::"
fi
- name: Ruby gem cache
uses: actions/cache@v1
with:
path: ../vendor/bundle
key: ${{ runner.os }}-${{ steps.sysinfo.outputs.os-version }}-ruby-${{ hashFiles('**/Gemfile.lock') }}
- name: Install gems
run: |
# We have to put it outside the repo file structure due to
# https://github.com/sorbet/sorbet/issues/1744.
bundle config path ../vendor/bundle
jobs=$(($(nproc)+2))
echo "$(nproc) processors available; using $jobs"
bundle install --jobs $jobs --retry 3
- name: JS package cache
uses: actions/cache@v1
with:
path: ${{ steps.sysinfo.outputs.yarn-cache-dir }}
key: ${{ runner.os }}-${{ steps.sysinfo.outputs.node-version }}-${{ steps.sysinfo.outputs.os-version }}-yarn-${{ hashFiles('**/yarn.lock') }}
- name: Install Yarn packages
run: |
yarn install --pure-lockfile
- name: Create database
run: bin/rails db:create
- name: Set up database schema
run: bin/rails db:schema:load
- name: Run RuboCop
run: bundle exec rubocop --parallel
- name: Run erblint
run: bundle exec erblint --lint-all
- name: Verify Tapioca gems
run: bin/tapioca gems --verify
- name: Verify Tapioca DSLs
run: bin/tapioca dsl --verify
- name: Run Sorbet
run: bundle exec srb tc
- name: Compile Assets
run: bundle exec rake assets:precompile
- name: Run tests
run: bin/rails test:all
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3