mirror of
https://github.com/ryankazokas/turbovault-app.git
synced 2026-04-16 22:12:53 +00:00
125 lines
2.8 KiB
YAML
125 lines
2.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, develop ]
|
|
pull_request:
|
|
branches: [ main, develop ]
|
|
|
|
jobs:
|
|
lint:
|
|
name: Linting & Security
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Ruby
|
|
uses: ruby/setup-ruby@v1
|
|
with:
|
|
ruby-version: '3.3'
|
|
bundler-cache: true
|
|
|
|
- name: Run RuboCop (style/linting)
|
|
run: bundle exec rubocop --parallel --format progress
|
|
|
|
- name: Run Brakeman (security scan)
|
|
run: bundle exec brakeman -q --no-pager
|
|
continue-on-error: true # Security warnings shouldn't block PRs
|
|
|
|
typecheck:
|
|
name: Type Checking
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Ruby
|
|
uses: ruby/setup-ruby@v1
|
|
with:
|
|
ruby-version: '3.3'
|
|
bundler-cache: true
|
|
|
|
- name: Generate Sorbet RBI files
|
|
run: |
|
|
bundle exec tapioca gems --no-doc --workers 1
|
|
bundle exec tapioca dsl
|
|
|
|
- name: Run Sorbet type checker
|
|
run: bundle exec srb tc
|
|
|
|
test:
|
|
name: Tests
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:15
|
|
env:
|
|
POSTGRES_USER: turbovault
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: turbovault_test
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
|
|
env:
|
|
DATABASE_HOST: localhost
|
|
DATABASE_USERNAME: turbovault
|
|
DATABASE_PASSWORD: postgres
|
|
DATABASE_NAME: turbovault_test
|
|
RAILS_ENV: test
|
|
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Ruby
|
|
uses: ruby/setup-ruby@v1
|
|
with:
|
|
ruby-version: '3.3'
|
|
bundler-cache: true
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libpq-dev
|
|
|
|
- name: Setup database
|
|
run: |
|
|
bundle exec rails db:create
|
|
bundle exec rails db:schema:load
|
|
|
|
- name: Run tests
|
|
run: bundle exec rails test
|
|
|
|
- name: Report test results
|
|
if: always()
|
|
run: echo "✅ Tests completed"
|
|
|
|
build-test:
|
|
name: Docker Build
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build Docker image (test)
|
|
run: docker build -t turbovault:test .
|
|
|
|
- name: Test Docker image
|
|
run: |
|
|
docker run --rm turbovault:test bundle exec ruby --version
|
|
echo "✅ Docker image builds successfully"
|