Skip to content

Commit

Permalink
CI (#1)
Browse files Browse the repository at this point in the history
* GH workflow

* GH workflow

* Migration versions

* fix
  • Loading branch information
mbajur authored Dec 10, 2024
1 parent 517cd21 commit 3827f83
Show file tree
Hide file tree
Showing 9 changed files with 196 additions and 361 deletions.
157 changes: 157 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
name: CI

on:
push:
branches:
- main
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest

services:
postgresql:
image: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
POSTGRES_DB: inner_plan_gem_test
POSTGRES_USER: inner_plan
POSTGRES_PASSWORD: inner_plan

mysql2:
image: mysql:8.0
env:
MYSQL_ROOT_HOST: "%"
MYSQL_DATABASE: inner_plan_gem_test
MYSQL_USER: inner_plan
MYSQL_PASSWORD: inner_plan
MYSQL_ROOT_PASSWORD: inner_plan
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 3
ports:
- "3306:3306"

strategy:
fail-fast: false
matrix:
ruby: ["3.2", "3.3"]
rails_version: ["7.2", "8.0"]
db: [sqlite3, postgresql, mysql2]
exclude:
# Not needed version combinations (just to cut down on noise)
# 3.1 on 7.0 mainly
- ruby: 3.1
rails_version: 7.2
db: sqlite3
- ruby: 3.1
rails_version: 7.1
db: sqlite3
- ruby: 3.1
rails_version: 7.1
db: mysql2
- ruby: 3.1
rails_version: 7.2
db: mysql2

# 3.2 on 7.1 and 7.2 mainly
- ruby: 3.2
rails_version: 7.0
db: sqlite3
- ruby: 3.2
rails_version: 7.0
db: mysql2
- ruby: 3.2
rails_version: 7.0
db: sqlite3
- ruby: 3.2
rails_version: 8.0
db: sqlite3
- ruby: 3.2
rails_version: 8.0
db: mysql2
- ruby: 3.3
rails_version: edge

# 3.3 on 8.0/edge mainly
- ruby: 3.3
rails_version: 7.0
- ruby: 3.3
rails_version: 7.1
- ruby: 3.3
rails_version: 7.2
db: sqlite3
- ruby: 3.3
rails_version: 7.2
db: mysql2

# Not supported version combinations
- ruby: 3.1
rails_version: 8.0
- ruby: 3.1
rails_version: edge

env:
RAILS_ENV: test
COVERAGE: 1
FERRUM_DEFAULT_TIMEOUT: 20
BUNDLE_GEMFILE: "spec/gemfiles/rails_${{ matrix.rails_version }}.gemfile"
DB: ${{ matrix.db }}
DB_HOST: 127.0.0.1
DB_POOL: 5
DB_USERNAME: inner_performance
DB_PASSWORD: inner_performance

steps:
- uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # install gems and cache

- uses: browser-actions/setup-chrome@v1

- name: Setup DB
run: |
bundle exec rake db:create db:schema:load
- name: "Run Tests"
run: |
bundle exec rspec --force-color --format d
# - name: Test & publish code coverage
# uses: paambaati/[email protected]
# env:
# CC_TEST_REPORTER_ID: <code_climate_reporter_id>

# rubocop:
# runs-on: ubuntu-latest

# env:
# BUNDLE_GEMFILE: spec/gemfiles/rubocop.gemfile

# steps:
# - uses: actions/checkout@v4

# - uses: ruby/setup-ruby@v1
# with:
# ruby-version: 3.1
# bundler-cache: true

# - name: Rubocop
# run: |
# bundle exec rubocop -c rubocop.yml
8 changes: 1 addition & 7 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,9 @@ gemspec

gem "puma"

gem "sqlite3"

gem "sprockets-rails"

# Start debugger with binding.b [https://github.com/ruby/debug]
# gem "debug", ">= 1.0.0"

gem "devise"

group :development do
gem "web-console", ">= 3.3.0"
end
eval_gemfile File.expand_path("spec/gemfiles/rails_8.0.gemfile", __dir__)
Loading

0 comments on commit 3827f83

Please sign in to comment.