Test using github actions #14
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
name: Run tests | |
on: push | |
jobs: | |
container-job: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
ruby-version: ['ruby:3.0', 'ruby:3.1', 'ruby:3.2'] | |
container: ${{ matrix.ruby-version }} | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: bundle install | |
- name: Prepare test database | |
run: bundle exec rake db:create db:migrate | |
working-directory: ./test/dummy | |
env: | |
DATABASE_URL: 'postgresql://postgres:postgres@postgres:5432/unconstrained_test' | |
- name: Run tests | |
run: bundle exec rake test | |
env: | |
DATABASE_URL: 'postgresql://postgres:postgres@postgres:5432/unconstrained_test' | |