Skip to content
Closed
Show file tree
Hide file tree
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
35 changes: 35 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Git
.git
.gitignore
.github

# Claude/AI configuration
.claude
.serena
CLAUDE.md

# Documentation
*.md
!README.md

# Test artifacts
coverage/
test_db
*.sqlite3
.last_run.json
.resultset.json

# Ruby/bundler
.bundle
vendor/bundle

# OS files
.DS_Store
Thumbs.db

# Editor files
.vscode
.idea
*.swp
*.swo
*~
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Gemfile.lock
InstalledFiles
_yardoc
coverage
coverage/
doc/
lib/bundler/man
pkg
Expand All @@ -17,7 +17,6 @@ spec/reports
test/tmp
test/version_tmp
tmp
coverage
test/log
test_db
test_db-journal
Expand Down
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Dockerfile for testing jsonapi-resources with multiple Rails versions

FROM ruby:3.2

# Install dependencies
RUN apt-get update -qq && \
apt-get install -y build-essential libpq-dev nodejs && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /app

# Copy Gemfile and gemspec
COPY Gemfile jsonapi-resources.gemspec ./
COPY lib/jsonapi/resources/version.rb ./lib/jsonapi/resources/

# Install bundler
RUN gem install bundler

# Note: bundle install will happen at runtime with specific RAILS_VERSION
# This allows testing multiple Rails versions without rebuilding the image
39 changes: 39 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
services:
# Base service definition
test-base: &test-base
build:
context: .
dockerfile: Dockerfile
volumes:
- .:/app
- bundle-cache:/usr/local/bundle
working_dir: /app
stdin_open: true
tty: true

# Rails 6.1.7
rails-6.1:
<<: *test-base
container_name: jsonapi-rails-6.1
environment:
- RAILS_VERSION=6.1.7
command: bash -c "bundle update && bundle exec rake test"

# Rails 7.0.4
rails-7.0:
<<: *test-base
container_name: jsonapi-rails-7.0
environment:
- RAILS_VERSION=7.0.4
command: bash -c "bundle update && bundle exec rake test"

# Interactive shell for debugging (defaults to Rails 6.1)
shell:
<<: *test-base
container_name: jsonapi-shell
environment:
- RAILS_VERSION=${RAILS_VERSION:-6.1.7}
command: /bin/bash

volumes:
bundle-cache:
1 change: 1 addition & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require 'logger'
require 'simplecov'
require 'database_cleaner'

Expand Down
Loading