-
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.
- Loading branch information
1 parent
7d9d455
commit 618e76b
Showing
6 changed files
with
185 additions
and
150 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 |
---|---|---|
@@ -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 | ||
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
Oops, something went wrong.