Skip to content

Commit

Permalink
Merge pull request #7 from kickstarter/github-actions
Browse files Browse the repository at this point in the history
GitHub actions
  • Loading branch information
amancevice committed Sep 6, 2023
2 parents 66026fb + 8830935 commit 3fdb91d
Show file tree
Hide file tree
Showing 11 changed files with 126 additions and 34 deletions.
25 changes: 25 additions & 0 deletions .github/actions/setup-rubygems/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Setup RubyGems
description: Setup RubyGems credentials
inputs:
ruby-version:
description: Ruby version
required: true
rubygems_api_key:
description: RubyGems API key
required: true
runs:
using: composite
steps:
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ inputs.ruby-version }}
- run: mkdir -p ~/.gem
shell: bash
- run: |
cat <<-YAML > ~/.gem/credentials
---
:rubygems_api_key: ${{ inputs.rubygems_api_key }}
YAML
shell: bash
- run: chmod 0600 ~/.gem/credentials
shell: bash
21 changes: 21 additions & 0 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Test
description: Run tests
inputs:
ruby-version:
description: Ruby version
required: true
activesupport-version:
description: ActiveSupport version constraint
required: true
runs:
using: composite
steps:
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ inputs.ruby-version }}
- run: gem install activesupport -v "~> ${{ inputs.activesupport-version }}"
shell: bash
- run: bundle install
shell: bash
- run: bundle exec rake
shell: bash
42 changes: 42 additions & 0 deletions .github/workflows/test-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Test and Release
on:
pull_request:
push:
release:
types:
- published
jobs:
test:
name: >-
Ruby ${{ matrix.ruby }}, ActiveSupport ~> ${{ matrix.activesupport }}
runs-on: ubuntu-latest
strategy:
matrix:
activesupport:
- "3.2"
- "4.0"
- "5.0"
- "6.0"
- "7.0"
ruby:
- "3.1"
- "3.2"
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/test
with:
ruby-version: ${{ matrix.ruby }}
activesupport-version: ${{ matrix.activesupport }}
push:
if: ${{ github.event.release }}
needs:
- test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-rubygems
with:
ruby-version: "3.2"
rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }}
- run: bundle install
- run: bundle exec rake gem:push
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*.rbc
.bundle
.config
.ruby-version
.yardoc
Gemfile.lock
InstalledFiles
Expand Down
1 change: 0 additions & 1 deletion .ruby-version

This file was deleted.

9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Configs

[![Test and Release](https://github.com/kickstarter/configs/actions/workflows/test-release.yml/badge.svg)](https://github.com/kickstarter/configs/actions/workflows/test-release.yml)

Loads and manages config/*.yml files.

Searches through a few locations to find the right environment config:
Expand All @@ -9,9 +11,6 @@ Searches through a few locations to find the right environment config:
3. config/$name/default.yml
3. config/$name.yml (with 'default' key)

[![Build
Status](https://travis-ci.org/kickstarter/configs.png?branch=master)](https://travis-ci.org/kickstarter/configs)

## Installation

Add this line to your application's Gemfile:
Expand Down
28 changes: 24 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
#!/usr/bin/env rake
require "bundler/gem_tasks"
require 'bundler/gem_tasks'

task :default => :test

require 'rake/testtask'
Rake::TestTask.new do |t|
t.libs << "test"
t.libs << 'test'
t.test_files = FileList['test/*test.rb']
t.verbose = true
t.verbose = true
end

task :default => :test
namespace :gem do
require 'bundler/gem_tasks'

@gem = "pkg/configs-#{ Configs::VERSION }.gem"

desc "Push #{ @gem } to rubygems.org"
task :push => %i[test build git:check] do
sh %{gem push #{ @gem }}
end
end

namespace :git do
desc 'Check git workspace'
task :check do
sh %{git diff HEAD --quiet} do |ok|
abort "\e[31mRefusing to continue - git workspace is dirty\e[0m" unless ok
end
end
end
19 changes: 11 additions & 8 deletions configs.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,23 @@
require File.expand_path('../lib/configs/version', __FILE__)

Gem::Specification.new do |gem|
gem.authors = ["Lance Ivy"]
gem.email = ["[email protected]"]
gem.authors = ['Lance Ivy']
gem.email = ['[email protected]']
gem.description = "Easy (easier?) management of config/*.yml files. Defines a lookup priority for the current environment's settings."
gem.summary = "Easy (easier?) management of config/*.yml files."
gem.homepage = "http://github.com/kickstarter/configs"
gem.summary = 'Easy (easier?) management of config/*.yml files.'
gem.homepage = 'http://github.com/kickstarter/configs'

gem.files = `git ls-files`.split($\)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.name = "configs"
gem.require_paths = ["lib"]
gem.name = 'configs'
gem.require_paths = ['lib']
gem.version = Configs::VERSION
gem.license = 'MIT'

gem.add_dependency 'activesupport', '>3.0'
gem.add_development_dependency "rake"
gem.add_dependency 'activesupport', '> 3.0'
gem.add_development_dependency 'minitest', '~> 4.0'
gem.add_development_dependency 'rake'

gem.required_ruby_version = '~> 3.1'
end
5 changes: 0 additions & 5 deletions gemfiles/activesupport3.2

This file was deleted.

4 changes: 0 additions & 4 deletions gemfiles/activesupport4.0

This file was deleted.

0 comments on commit 3fdb91d

Please sign in to comment.