Skip to content

Commit

Permalink
Update the gem to work with ruby 3.3 and switch to github actions
Browse files Browse the repository at this point in the history
Fix `File.exists?` error -> `File.exist?` is now used
  • Loading branch information
bliof-fc committed Mar 28, 2024
1 parent 80b7e16 commit bdf06e8
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 92 deletions.
86 changes: 0 additions & 86 deletions .circleci/config.yml

This file was deleted.

38 changes: 38 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build & Test
run-name: Build & Test - ${{ github.ref_name }}

on:
push:
branches: [ master ]
pull_request:

jobs:
version-check:
runs-on: ubuntu-latest
if: "!contains(github.ref, 'master')"
steps:
- name: Checkout commit
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Gem versioned correctly
shell: sh
run: |
CHANGED=$(git diff origin/master HEAD --name-only | grep 'lib/hellgrid') || exit 0
[[ -z "$CHANGED" ]] || (echo "$CHANGED" | grep 'version.rb') || exit 1
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
bundler-cache: true

- name: Run tests
run: bundle exec rspec
28 changes: 28 additions & 0 deletions .github/workflows/publish-gem.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Deploy to RubyGems
run-name: ${{ github.actor }} is publishing a new version

on:
release:
types: [published]

jobs:
publish-gem:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true

- name: Build gem
run: gem build hellgrid.gemspec

- name: Publish gem
env:
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
run: |
gem push hellgrid-*.gem
1 change: 0 additions & 1 deletion hellgrid.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'bundler', '>= 1.11.0', '< 3'

s.add_development_dependency 'rspec', '~> 3.8.0'
s.add_development_dependency 'simplecov', '~> 0.16.0'
end
2 changes: 1 addition & 1 deletion lib/hellgrid/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def start
matrix = Hellgrid::Matrix.new

Find.find(folder) do |path|
if File.directory?(path) && File.exists?(File.join(path, 'Gemfile.lock'))
if File.directory?(path) && File.exist?(File.join(path, 'Gemfile.lock'))
matrix.add_project(Hellgrid::Project.new(folder, path))
Find.prune unless recursive_search
end
Expand Down
2 changes: 1 addition & 1 deletion lib/hellgrid/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Hellgrid
VERSION = '0.3.5'
VERSION = '0.4.0'
end
3 changes: 0 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
require 'simplecov'
SimpleCov.start

require 'fileutils'
require 'hellgrid'
require 'hellgrid/project'
Expand Down

0 comments on commit bdf06e8

Please sign in to comment.