-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (61 loc) · 1.91 KB
/
test.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
# 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 install a prebuilt Ruby version, install dependencies, and
# run tests and linters.
name: Linting & Testing
on:
pull_request:
branches: ["master"]
jobs:
lint-n-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
ports: ["5432:5432"]
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Setting up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
- name: Setup Node
uses: actions/setup-node@v4
- name: Install dependencies
run: |
sudo apt-get install -y -qq libvips
yarn install --frozen-lockfile
- name: Installing Bundler & Gems
run: |
gem install bundler
bundle install --jobs 4 --retry 3
- name: Scan for common Rails security vulnerabilities using static analysis
run: bin/brakeman
- name: Find linting errors
run: bundle exec erb_lint --lint-all
- name: Find rubocop errors
run: bin/rubocop
- name: Precompile assets
run: bin/rails assets:precompile
- name: Running Tests
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/test
RAILS_ENV: test
PG_USER: postgres
run: |
bin/rails db:create
bin/rails db:migrate
bundle exec rspec