-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
To set this up I more or less followed an example I found online[1]. I decided to use the "alpine" postgres image as the author suggests to make the container creation quicker. I opted for the latest postgres 15, as this matches my development environment (and, I hope, production when we get there). [1] https://boringrails.com/articles/building-a-rails-ci-pipeline-with-github-actions/
- Loading branch information
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: CI | ||
on: [push] | ||
|
||
jobs: | ||
linters: | ||
name: Linters | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Ruby and install gems | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
bundler-cache: true | ||
|
||
- name: Run linters | ||
run: | | ||
bin/rake rubocop | ||
tests: | ||
name: Tests | ||
runs-on: ubuntu-latest | ||
services: | ||
postgres: | ||
image: postgres:15-alpine | ||
env: | ||
POSTGRES_USER: myapp | ||
POSTGRES_DB: myapp_test | ||
POSTGRES_PASSWORD: password | ||
ports: ["5432:5432"] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Ruby and install gems | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
bundler-cache: true | ||
|
||
- name: Setup test database | ||
env: | ||
RAILS_ENV: test | ||
PGHOST: localhost | ||
PGUSER: myapp | ||
PGPASSWORD: password | ||
run: | | ||
bin/rails db:setup | ||
- name: Run tests | ||
env: | ||
RAILS_ENV: test | ||
PGHOST: localhost | ||
PGUSER: myapp | ||
PGPASSWORD: password | ||
run: bin/rake test:all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters