An open API service indexing awesome lists of open source software.

https://github.com/nutcas3/simple-ci-ruby


https://github.com/nutcas3/simple-ci-ruby

ci-cd ruby-on-rails security

Last synced: 2 months ago
JSON representation

Awesome Lists containing this project

README

          

# Rails CI/CD Demo

A modern Ruby on Rails application demonstrating CI/CD best practices, automated testing, and deployment workflows.

## ๐Ÿš€ Features

### Application
- Basic blog functionality with posts
- Modern, responsive UI
- PostgreSQL database
- RESTful API design

### Development
- ๐Ÿ›  Ruby 3.2.2 + Rails 7.1
- ๐Ÿ“ฆ Docker + Docker Compose configuration
- ๐Ÿงช Comprehensive RSpec test suite
- ๐ŸŽจ RuboCop for code style enforcement

### CI/CD Pipeline
- ๐Ÿ”„ GitHub Actions workflow
- โšก๏ธ Parallel test execution with Knapsack
- ๐Ÿ” Security scanning (Brakeman, Bundler Audit)
- ๐Ÿš€ Automated deployments to Heroku
- ๐Ÿ‘€ Preview environments for PRs

## ๐Ÿ›  Prerequisites

- Ruby 3.2.2
- PostgreSQL 14+
- Docker & Docker Compose
- Node.js 18+

## ๐Ÿš€ Quick Start

1. Clone the repository:
```bash
git clone https://github.com/yourusername/rails-cicd-demo.git
cd rails-cicd-demo
```

2. Install dependencies:
```bash
bundle install
```

3. Set up the database:
```bash
rails db:create db:migrate
```

4. Start the server:
```bash
rails server
```

5. Visit http://localhost:3000

## ๐Ÿณ Docker Setup

1. Build the containers:
```bash
docker-compose build
```

2. Start the services:
```bash
docker-compose up
```

3. Create and migrate the database:
```bash
docker-compose exec web rails db:setup
```

## ๐Ÿงช Testing

Run the test suite:
```bash
rspec
```

Run specific tests:
```bash
rspec spec/models/post_spec.rb
```

## ๐Ÿ”„ CI/CD Pipeline

The GitHub Actions workflow includes:

1. **Lint & Security**
- RuboCop style checking
- Brakeman security analysis
- Bundler Audit dependency checks

2. **Test**
- Parallel test execution
- Coverage reporting

3. **Build**
- Docker image building
- Image pushing to registry

4. **Deploy**
- Preview environment for PRs
- Production deployment for main branch

## ๐Ÿ“š Documentation

- [Setup Guide](docs/setup.md)
- [Contributing Guidelines](CONTRIBUTING.md)
- [Deployment Guide](docs/deployment.md)

## ๐Ÿ“„ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.