Skip to content

Commit

Permalink
Add CI for Rspec
Browse files Browse the repository at this point in the history
  • Loading branch information
binhpt-1239 committed Apr 1, 2024
1 parent 7ef55b0 commit 87a2499
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 7 deletions.
41 changes: 34 additions & 7 deletions .sun-ci.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,42 @@
workspace: true

stages:
- rubocop
- build
- test

jobs:
- name: build:prepare
stage: build
image: cimg/ruby:3.2.0
script:
- sudo cp database-ci.yml config/database.yml
- bundle config set path 'vendor/bundle'
- sudo gem update --system
- sudo bundle install
cache:
- key: vendor_$CI_BRANCH
paths:
- vendor/bundle
- name: test:rubocop
stage: rubocop
stage: test
image: cimg/ruby:3.2.0
script:
- gem install rubocop
- gem install rubocop-rails
- gem install rubocop-performance
- gem install rubocop-rspec
- rubocop
- name: test:rspec
stage: test
image: cimg/ruby:3.2.0
services:
- image: mysql:5.7.22
name: mysql-test
environment:
MYSQL_DATABASE: db-test
MYSQL_USER: user-test
MYSQL_PASSWORD: password-test
MYSQL_ROOT_PASSWORD: password-test
script:
- gem install rubocop
- gem install rubocop-rails
- gem install rubocop-performance
- gem install rubocop-rspec
- rubocop
- sudo RAILS_ENV=test bundle exec rails db:drop db:create db:migrate
- bundle exec rspec
14 changes: 14 additions & 0 deletions database-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
default: &default
adapter: mysql2
encoding: utf8mb4
collation: utf8mb4_unicode_ci
host: mysql-test
ssl_mode: disabled
port: 3306
pool: 5

test:
<<: *default
database: db-test
username: user-test
password: password-test

0 comments on commit 87a2499

Please sign in to comment.