Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/matrix-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Matrix Build Workflow

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ["3.0.3"]
# ruby: ["3.0.3", "3.1.0"]

services:
postgres:
image: postgres:16
env:
POSTGRES_USER: ${{ secrets.DATABASE_USERNAME }}
POSTGRES_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
POSTGRES_DB: myapp_test
options: >-
--mount type=tmpfs,destination=/var/lib/postgresql/data
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- name: Checkout code
uses: actions/checkout@v2

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

# Install dependencies
- name: Install dependencies
run: |
gem install bundler
bundle install

# Set environment variables for database connection
- name: Set database connection environment variables
run: |
echo "DATABASE_URL=postgres://${{ secrets.DATABASE_USERNAME }}:${{ secrets.DATABASE_PASSWORD }}@localhost:5432/myapp_test" >> $GITHUB_ENV
echo "RAILS_ENV=test" >> $GITHUB_ENV

# Create the database
- name: Create the database
run: |
bin/rails db:create

# Run migrations
- name: Run migrations
run: |
bin/rails db:migrate

# Run Tests
- name: Run tests
run: |
bin/rails test
Loading