Skip to content

Commit

Permalink
Add GitHub CI
Browse files Browse the repository at this point in the history
  • Loading branch information
calebhearth committed Oct 26, 2023
1 parent ea23bf1 commit 8896cf7
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI

"on":
push:
branches:
- main
pull_request:
branches: "*"

jobs:
build:
name: Ruby ${{ matrix.ruby }}, Rails ${{ matrix.rails }}

strategy:
fail-fast: false
matrix:
ruby: ["3.0", "3.1", "3.2", "3.3"]
rails: ["6.1", "7.0", "7.1", "main"]
continue-on-error: [false]

env:
RAILS_VERSION: ${{ matrix.rails }}

runs-on: "ubuntu-latest"

steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}

- name: Generate lockfile
run: bundle lock

- name: Cache dependencies
uses: actions/cache@v3
with:
path: vendor/bundle
key: bundle-${{ hashFiles('Gemfile.lock') }}

- run: bundle check || bundle install

- name: Run rspec tests
run: bundle exec rspec
continue-on-error: ${{ matrix.continue-on-error }}
10 changes: 10 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
source 'https://rubygems.org'

rails_version = ENV.fetch("RAILS_VERSION", "7.1")

if rails_version == "main"
rails_constraint = { github: "rails/rails" }
else
rails_constraint = "~> #{rails_version}.0"
end

gem "rails", rails_constraint

# Specify your gem's dependencies in title.gemspec
gemspec

0 comments on commit 8896cf7

Please sign in to comment.