-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (85 loc) · 2.94 KB
/
ci.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
# 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: CI
on:
pull_request:
push:
branches: [main]
jobs:
test:
name: Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_DB: flyweight_test
POSTGRES_USER: flyweight
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- "5432:5432"
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- "6379:6379"
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
- name: Create test database
env:
POSTGRES_DB: flyweight_test
POSTGRES_USER: flyweight
POSTGRES_PASSWORD: postgres
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
run: |
sudo apt-get install libpq-dev
RAILS_ENV=test bin/rails db:setup
- name: Run unit tests
env:
POSTGRES_DB: flyweight_test
POSTGRES_USER: flyweight
POSTGRES_PASSWORD: postgres
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
run: bundle exec rspec spec
lint:
name: Linters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
- name: Run Rubocop
run: |
gem install rubocop-rails rubocop-rspec rubocop-performance rubocop-md rubocop-rake rubocop-graphql rubocop-rspec_rails rubocop-sidekiq rubocop-yard rubocop-factory_bot
git clone https://gist.github.com/65e21b9e8b0d1db285dcb4fc627b98fa.git .rubocop
cp .rubocop/.rubocop.yml .rubocop-ruby.yml
git clone https://gist.github.com/14cfa24d53c12bf385871e9b93b95c37.git .rubocop-rspec
cp .rubocop-rspec/.rubocop-rspec.yml .
git clone https://gist.github.com/9f3bb94ef794f92dd480cffa019e91a4.git .rubocop-rails
cp .rubocop-rails/.rubocop-rails.yml .
cat .rubocop.yml | sed -e 's/~\/.rubocop/.rubocop/' | sed -e 's/.rubocop.yml/.rubocop-ruby.yml/' > .rubocop2.yml
mv .rubocop2.yml .rubocop.yml
rubocop --parallel -f github
- name: Run Brakeman
run: bin/brakeman --no-pager