Skip to content

Commit 09106d0

Browse files
authored
Create ci.yml
1 parent a4544ff commit 09106d0

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/ci.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7+
8+
name: Blog CI
9+
10+
on:
11+
push:
12+
branches: [ master ]
13+
pull_request:
14+
branches: [ master ]
15+
16+
jobs:
17+
test:
18+
runs-on: ubuntu-latest
19+
services:
20+
postgres:
21+
image: postgres:10.8
22+
env:
23+
POSTGRES_USER: postgres
24+
POSTGRES_PASSWORD: postgres
25+
POSTGRES_DB: postgres
26+
ports:
27+
- 5432:5432
28+
# needed because the postgres container does not provide a healthcheck
29+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
30+
env:
31+
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
32+
RAILS_ENV: test
33+
34+
steps:
35+
- uses: actions/checkout@v2
36+
- name: Set up Ruby
37+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
38+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
39+
# uses: ruby/setup-ruby@v1
40+
uses: ruby/setup-ruby@v1
41+
with:
42+
ruby-version: 2.7
43+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
44+
- name: Run tests
45+
run: |
46+
bin/rails db:prepare
47+
bin/rails test

0 commit comments

Comments
 (0)