Skip to content

Commit

Permalink
update gems and CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
amtuannguyen committed Mar 31, 2024
1 parent 7d9d455 commit 618e76b
Show file tree
Hide file tree
Showing 6 changed files with 185 additions and 150 deletions.
55 changes: 42 additions & 13 deletions .github/workflows/rubyonrails.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,57 @@
# This workflow will install a prebuilt Ruby version, install dependencies, and
# run tests and linters.
name: "Ruby on Rails CI"
on:
push:
branches: [ "master" ]
branches: [ "*" ]
pull_request:
branches: [ "master" ]
branches: [ "*" ]
jobs:
test:
build_and_run_tests:
name: Build and run tests
runs-on: ubuntu-latest
env:
RAILS_ENV: test
DB_ADAPTER: sqlite3
DATABASE_URL: db/test.sqlite3
services:
mysql:
image: mysql
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: mysql
MYSQL_DATABASE: test
MYSQL_USER: test
MYSQL_PASSWORD: test
# Set health checks to wait until mysql has started
options: >-
--health-cmd "mysqladmin ping -h 127.0.0.1 -u root -p$$MYSQL_ROOT_PASSWORD"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Ruby and gems
uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
with:
bundler-cache: true
- name: Run tests
run: |
- name: Install libmariadb-dev
run:
sudo apt install -y libmariadb-dev-compat libmariadb-dev
- name: bundle install
env:
RAILS_ENV: test
run:
bundle install
bundle exec rails db:create
bundle exec rails test
- name: Run tests with mysql
env:
RAILS_ENV: test
DATABASE_URL: mysql2://test:[email protected]:3306/test
run: |
bundle exec rake db:reset
bundle exec rake test
- name: Run tests with sqlite3
env:
RAILS_ENV: test
DATABASE_URL: sqlite3:db/test.sqlite3
run: |
bundle exec rake db:reset
bundle exec rake test
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ gem 'puma', '~> 6.4', '>= 6.4.2'
gem 'rails', '~> 7.0', '>= 7.0.3.1'

## DATABASES ##
gem 'mysql2', '0.5.3'
gem 'mysql2'

## CSS AND JAVASCRIPT ##
gem 'actiontext', '~> 7.0', '>= 7.0.3.1'
Expand Down
Loading

0 comments on commit 618e76b

Please sign in to comment.