Skip to content

Commit

Permalink
Update ruby.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
deepgits authored Dec 6, 2024
1 parent 4173c03 commit 5d0b551
Showing 1 changed file with 14 additions and 35 deletions.
49 changes: 14 additions & 35 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,64 +11,43 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['3.2', '3.1', '3.0']
ruby-version: ['3.0', '3.1', '3.2']

services:
postgres:
image: postgres:latest
image: postgres:15
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test_db
POSTGRES_USER: postgres
ports:
- 5432:5432
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v2

- name: Install libvips
run: sudo apt-get install -y libvips
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libvips postgresql-client

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true

- name: Verify Ruby setup
run: ruby -v

- name: Set execute permissions
run: chmod +x bin/*

- name: Setup Code Climate test-reporter
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
- name: Create DB
env:
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/postgres"
run: |
cp config/database.yml.ci config/database.yml
bin/rails db:setup
- name: Database configuration
run: cp config/database.yml.ci config/database.yml

- name: Compile assets
- name: Prepare database
env:
RAILS_ENV: test
run: bin/rails app:assets:precompile
run: bin/rails db:setup

- name: Run tests
run: bin/rails test

- name: Publish Code Coverage
env:
GIT_BRANCH: ${GITHUB_REF/refs/heads/}
run: ./cc-test-reporter after-build -r ${{ secrets.CodeClimate }}
if: startsWith(github.ref, 'refs/heads/main')
RAILS_ENV: test
run: bin/rails test

0 comments on commit 5d0b551

Please sign in to comment.