mirror of
https://github.com/ryankazokas/turbovault-app.git
synced 2026-04-17 05:22:51 +00:00
Moving to github
This commit is contained in:
100
.github/workflows/ci.yml
vendored
Normal file
100
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
pull_request:
|
||||
branches: [ main, develop ]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
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 (linting)
|
||||
run: bundle exec rubocop --parallel
|
||||
continue-on-error: true # Don't fail build on style issues
|
||||
|
||||
- name: Run Brakeman (security scan)
|
||||
run: bundle exec brakeman -q --no-pager
|
||||
continue-on-error: true
|
||||
|
||||
test:
|
||||
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 coverage
|
||||
if: always()
|
||||
run: echo "✅ Tests completed"
|
||||
|
||||
build-test:
|
||||
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"
|
||||
Reference in New Issue
Block a user