Skip to content

Commit

Permalink
Update CI set-up (#21)
Browse files Browse the repository at this point in the history
We stopped using Travis CI some time ago, but never replaced it. Set
up GitHub actions for automated CI build and pushing new versions to
rubygems.
  • Loading branch information
KevinBrowne authored Feb 23, 2024
1 parent 273d196 commit 05ef514
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 28 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: bundler
directory: "/"
schedule:
interval: weekly
pull-request-branch-name:
separator: "-"
24 changes: 24 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Publish Gem

on:
release:
types:
- "created"

jobs:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Publish to RubyGems
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
gem build sinject.gemspec
gem push sinject-*.gem
env:
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

on: [push]

jobs:
test:
strategy:
fail-fast: false
matrix:
# All the (nominally) supported Ruby versions
ruby: ['2.5', '2.6', '2.7', '3.0', '3.1', '3.2', '3.3']

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Run tests
run: bundle exec rspec

- name: Upload Coverage Report to CodeClimate
# No sense uploading coverage for each Ruby version tested
if: ${{matrix.ruby == '3.3'}}
uses: paambaati/codeclimate-action@v5
env:
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
26 changes: 0 additions & 26 deletions .travis.yml

This file was deleted.

3 changes: 2 additions & 1 deletion sinject.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'bundler', '>= 1.11'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'simplecov', '~> 0.21.2'
spec.add_development_dependency 'simplecov'
spec.add_development_dependency 'simplecov_json_formatter'
end
5 changes: 4 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
require 'simplecov'
require 'simplecov_json_formatter'

SimpleCov.formatter = SimpleCov::Formatter::JSONFormatter

SimpleCov.start do
add_filter 'spec/'
end
Expand Down Expand Up @@ -26,5 +30,4 @@
# `true` in RSpec 4.
mocks.verify_partial_doubles = true
end

end

0 comments on commit 05ef514

Please sign in to comment.