Skip to content

Commit

Permalink
Add SQLite database tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Bramjetten committed Oct 8, 2024
1 parent 2cd81df commit 00c6f23
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 3 deletions.
45 changes: 42 additions & 3 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ on:
branches: [ main ]

jobs:
test:
test-postgresql:
name: Test on PostgreSQL
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['3.2']
ruby-version: ['3.3']

services:
postgres:
Expand Down Expand Up @@ -50,7 +51,7 @@ jobs:
env:
RAILS_ENV: test
run: |
cp test/dummy/config/database.yml.ci test/dummy/config/database.yml
cp test/dummy/config/database.yml.postgresql test/dummy/config/database.yml
bin/rails db:setup
- name: Compile assets
Expand All @@ -66,3 +67,41 @@ jobs:
GIT_BRANCH: ${GITHUB_REF/refs\/heads\//}
run: ./cc-test-reporter after-build -r ${{ secrets.CodeClimate }}
if: github.ref == 'refs/heads/main'

test-sqlite:
name: Test on SQLite
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['3.3']
steps:
- uses: actions/checkout@v2

- name: Install libvips
run: sudo apt-get install -y libvips

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true

- name: Install dependencies
run: bundle install

- name: Create DB
env:
RAILS_ENV: test
run: |
cp test/dummy/config/database.yml.sqlite test/dummy/config/database.yml
bin/rails db:setup
- name: Compile assets
env:
RAILS_ENV: test
run: bin/rails app:assets:precompile

- name: Run tests
env:
RAILS_ENV: test
run: bin/rails test test/*
File renamed without changes.
8 changes: 8 additions & 0 deletions test/dummy/config/database.yml.sqlite
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
default: &default
adapter: sqlite3
pool: 5
timeout: 5000

test:
<<: *default
database: db/test.sqlite3

0 comments on commit 00c6f23

Please sign in to comment.