Skip to content

Add Docker test environment for gem install verification#84

Merged
fs0414 merged 2 commits intoissue70-magnos-support-upgradefrom
feature/test-env-docker
Jan 25, 2026
Merged

Add Docker test environment for gem install verification#84
fs0414 merged 2 commits intoissue70-magnos-support-upgradefrom
feature/test-env-docker

Conversation

@fs0414
Copy link
Owner

@fs0414 fs0414 commented Jan 25, 2026

📋 Overview

Add a Docker environment to verify gem install works across multiple Ruby versions.

This allows us to detect build errors that only occur on specific Ruby versions (like Issue #70) locally before release.

🔧 Main Changes

🐳 Docker Environment

  • Dockerfile.test: Dockerfile for verifying gem install and native extension builds

    • Installs Rust toolchain and LLVM/Clang
    • Automated flow: gem build → install → require verification → CLI test
    • Supports version switching via RUBY_VERSION ARG
  • compose.test.yml: For building multiple versions simultaneously

    • Service definitions for Ruby 3.4 and 4.0
    • Run docker compose -f docker/compose.test.yml build for batch testing

📝 Scripts

  • test-gem-install.sh: Test execution script
    • Tests all versions (3.4, 4.0) when run without arguments
    • Supports specific version (e.g., ./scripts/test-gem-install.sh 4.0)
    • Color-coded output for readability
    • Summary of pass/fail results

⚙️ Build Optimization

  • .dockerignore: Optimizes build context
    • Excludes .nix-* cache directories (3GB+)
    • Reduces context transfer from 3GB to 1.6MB
    • Significantly faster build startup

🗂️ Changed Files

  • Docker: docker/Dockerfile.test, docker/compose.test.yml
  • Scripts: scripts/test-gem-install.sh
  • Build: .dockerignore

🧪 Testing

How to Run Tests

# Test all versions (3.4, 4.0)
./scripts/test-gem-install.sh

# Test specific version only
./scripts/test-gem-install.sh 4.0

# Build with docker compose
docker compose -f docker/compose.test.yml build

Test Results

  • Ruby 3.4.8: ✅ gem install success, require success
  • Ruby 4.0.1: ✅ gem install success, require success

Verification Checklist

  • gem install on Ruby 3.4
  • gem install on Ruby 4.0
  • require 'rfmt' works correctly
  • .dockerignore speeds up builds

📦 Breaking Changes

None

Related Issue

Related to #70

@fs0414 fs0414 changed the title Docker検証環境の追加 - gem installテスト Add Docker test environment for gem install verification Jan 25, 2026
- Multi-stage build (builder/runtime/test stages)
- Minimal Rust profile for faster installs
- YAML anchors for DRY compose config
- Simplified test script with modern bash

Co-Authored-By: Claude <noreply@anthropic.com>
@fs0414 fs0414 merged commit e05c5c7 into issue70-magnos-support-upgrade Jan 25, 2026
2 checks passed
@fs0414 fs0414 deleted the feature/test-env-docker branch January 25, 2026 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant