Skip to content

Commit bb7cc36

Browse files
authored
Add workflow to run tests on PR
1 parent 1598461 commit bb7cc36

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

.github/workflows/tests.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Run Tests
2+
on:
3+
pull_request:
4+
branches:
5+
- 'master'
6+
jobs:
7+
tests:
8+
name: Tests
9+
runs-on: ubuntu-latest
10+
services:
11+
postgres:
12+
image: postgres:11.5
13+
ports: ["5432:5432"]
14+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
15+
redis:
16+
image: redis
17+
ports: ["6379:6379"]
18+
options: --entrypoint redis-server
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v2
23+
- name: Setup Ruby 2.6.5
24+
uses: ruby/setup-ruby@v1
25+
with:
26+
ruby-version: 2.6.5
27+
28+
- name: Install PostgreSQL 11 client
29+
run: |
30+
sudo apt update
31+
sudo bash -c "echo deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main >> /etc/apt/sources.list.d/pgdg.list"
32+
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
33+
sudo apt-get update
34+
sudo apt-get -yqq install libpq-dev postgresql-client-11
35+
36+
- name: Build App
37+
env:
38+
PGHOST: localhost
39+
PGUSER: postgres
40+
run: |
41+
rm *.lock
42+
gem install bundler
43+
yarn
44+
bundle install --jobs 4 --retry 3
45+
bin/rails db:setup
46+
47+
- name: Run Tests
48+
env:
49+
PGHOST: localhost
50+
PGUSER: postgres
51+
RAILS_ENV: test
52+
run: |
53+
bundle exec rake test

0 commit comments

Comments
 (0)