Skip to content

Commit

Permalink
Replace Semaphore with GitHub Actions; update README badges (#158)
Browse files Browse the repository at this point in the history
* Replace Semaphore with GitHub Actions; update README badges

* Switch Code Climate badge to shields.io
  • Loading branch information
mattbrictson authored Jul 12, 2023
1 parent 6cc619a commit e37d204
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 55 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CI
on:
pull_request:
push:
branches:
- main
jobs:
test:
name: "Test / Ruby ${{ matrix.ruby }}"
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ["3.0", "3.1", "3.2"]
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle exec rake test
rubocop:
name: "Rubocop"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: "3.2"
- run: bundle exec rubocop
39 changes: 0 additions & 39 deletions .semaphore/semaphore.yml

This file was deleted.

7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# tomo-plugin-nvm

[![Gem Version](https://badge.fury.io/rb/tomo-plugin-nvm.svg)](https://rubygems.org/gems/tomo-plugin-nvm)
[![Build Status](https://mattbrictson.semaphoreci.com/badges/tomo-plugin-nvm/branches/main.svg?style=shields)](https://mattbrictson.semaphoreci.com/projects/tomo-plugin-nvm)
[![Code Climate](https://codeclimate.com/github/mattbrictson/tomo-plugin-nvm/badges/gpa.svg)](https://codeclimate.com/github/mattbrictson/tomo-plugin-nvm)
[![Gem Version](https://img.shields.io/gem/v/tomo-plugin-nvm)](https://rubygems.org/gems/tomo-plugin-nvm)
[![Gem Downloads](https://img.shields.io/gem/dt/tomo-plugin-nvm)](https://www.ruby-toolbox.com/projects/tomo-plugin-nvm)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/mattbrictson/tomo-plugin-nvm/ci.yml)](https://github.com/mattbrictson/tomo-plugin-nvm/actions/workflows/ci.yml)
[![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/mattbrictson/tomo-plugin-nvm)](https://codeclimate.com/github/mattbrictson/tomo-plugin-nvm)

This is a [tomo](https://github.com/mattbrictson/tomo) plugin to manage node and yarn via nvm (instead of using the [nodenv tasks](https://tomo-deploy.com/plugins/nodenv/) that are built into tomo). The `nvm:install` task is a drop-in replacement for tomo’s `nodenv:install` task.

Expand Down
22 changes: 9 additions & 13 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,10 @@ namespace :bump do
end

task :ruby do
lowest_minor = RubyVersions.lowest_supported_minor
latest = RubyVersions.latest
latest_patches = RubyVersions.latest_supported_patches

replace_in_file "tomo-plugin-nvm.gemspec", /ruby_version = .*">= (.*)"/ => lowest_minor
replace_in_file ".rubocop.yml", /TargetRubyVersion: (.*)/ => lowest_minor
replace_in_file ".semaphore/semaphore.yml", /SEM_RUBY:-([\d.]+)/ => latest
replace_in_file ".semaphore/semaphore.yml", /values: (\[.+\])/ => latest_patches.inspect
replace_in_file "tomo-plugin-nvm.gemspec", /ruby_version = .*">= (.*)"/ => RubyVersions.lowest_supported
replace_in_file ".rubocop.yml", /TargetRubyVersion: (.*)/ => RubyVersions.lowest_supported
replace_in_file ".github/workflows/ci.yml", /ruby-version: "([\d.]+)"/ => RubyVersions.latest
replace_in_file ".github/workflows/ci.yml", /ruby: (\[.+\])/ => RubyVersions.all_supported.inspect
end

task :year do
Expand Down Expand Up @@ -91,17 +87,17 @@ end

module RubyVersions
class << self
def lowest_supported_minor
latest_supported_patches.first[/\d+\.\d+/]
def lowest_supported
all_supported.first[/\d+\.\d+/]
end

def latest
latest_supported_patches.last
all_supported.last
end

def latest_supported_patches
def all_supported
patches = versions.values_at(:stable, :security_maintenance).compact.flatten
patches.map { |p| Gem::Version.new(p) }.sort.map(&:to_s)
patches.map { |p| p[/\d+\.\d+/] }.sort_by(&:to_f)
end

private
Expand Down

0 comments on commit e37d204

Please sign in to comment.