-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add RuboCop and Rspec GH action workflow
- Loading branch information
Showing
9 changed files
with
452 additions
and
65 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,78 @@ | ||
env: | ||
RUBY_VERSION: 3.2.1 | ||
RAILS_ENV: test | ||
|
||
HEALTHKEEPER_TEST_DATABASE_USERNAME: postgres | ||
HEALTHKEEPER_TEST_DATABASE_PASSWORD: postgres | ||
HEALTHKEEPER_TEST_DATABASE: healthkeeper_test | ||
|
||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DB: healthkeeper_test | ||
POSTGRES_HOST: localhost | ||
|
||
name: Rails tests | ||
on: [pull_request] | ||
jobs: | ||
rubocop-test: | ||
name: Rubocop | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ env.RUBY_VERSION }} | ||
bundler-cache: true | ||
- name: Install Rubocop | ||
run: gem install rubocop | ||
- name: Install Rubocop Performance | ||
run: gem install rubocop-performance | ||
- name: Install Rubocop Rails | ||
run: gem install rubocop-rails | ||
- name: Install Rubocop Rspec | ||
run: gem install rubocop-rspec | ||
- name: Install Rubocop Rspec Rails | ||
run: gem install rubocop-rspec_rails | ||
- name: Install Rubocop Factory Bot | ||
run: gem install rubocop-factory_bot | ||
- name: Check code | ||
run: rubocop | ||
rspec-test: | ||
name: RSpec | ||
needs: rubocop-test | ||
runs-on: ubuntu-latest | ||
services: | ||
postgres: | ||
image: postgres:17.1-alpine | ||
env: | ||
POSTGRES_USER: ${{ env.POSTGRES_USER }} | ||
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }} | ||
POSTGRES_DB: ${{ env.POSTGRES_DB }} | ||
ports: | ||
- 5432:5432 | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ env.RUBY_VERSION }} | ||
bundler-cache: true | ||
- name: Install postgres client | ||
run: sudo apt-get install libpq-dev | ||
- name: Install dependencies | ||
run: | | ||
gem install bundler | ||
bundler install | ||
- name: Create database | ||
env: | ||
RAILS_ENV: test | ||
# DATABASE_URL: postgres://postgres:postgres@localhost:5432/healthkeeper_test | ||
run: | | ||
bundler exec rails db:create | ||
bundler exec rails db:migrate | ||
- name: Run tests | ||
run: bundler exec rspec |
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 |
---|---|---|
@@ -1 +1,18 @@ | ||
inherit_from: .rubocop_todo.yml | ||
|
||
inherit_mode: | ||
merge: | ||
- Exclude | ||
|
||
require: | ||
- rubocop-performance | ||
- rubocop-rails | ||
- rubocop-rspec | ||
- rubocop-rspec_rails | ||
- rubocop-factory_bot | ||
|
||
AllCops: | ||
NewCops: enable | ||
|
||
RSpec/FilePath: | ||
Enabled: false |
Oops, something went wrong.