Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub Actions for CI and pushing to RubyGems #6

Merged
merged 1 commit into from Oct 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,69 @@
name: CI

on:
pull_request:
push:
branches:
- master
tags:
- v*

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
ruby:
- 2.5
- 2.6
- 2.7

steps:
- uses: actions/checkout@v2

- name: Setup Redis
uses: shogo82148/actions-setup-redis@v1
with:
redis-version: '5.x'

- name: Set up Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
architecture: 'x64'

- name: Setup bundler
run: |
gem install bundler --no-doc
bundle config path vendor/bundle
- name: Bundler cache
uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Setup gems
run: bundle install --jobs 4

- name: Rubocop
run: bundle exec rubocop

- name: RSpec
run: bundle exec rspec

publish:
if: contains(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Release Gem
uses: CvX/publish-rubygems-action@master
env:
RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
2 changes: 0 additions & 2 deletions .gitignore
Expand Up @@ -9,5 +9,3 @@
Gemfile.lock
.DS_Store
*.swp

.rubocop-https---raw-githubusercontent-com-discourse-discourse-master--rubocop-yml
3 changes: 2 additions & 1 deletion .rubocop.yml
@@ -1 +1,2 @@
inherit_from: https://raw.githubusercontent.com/discourse/discourse/master/.rubocop.yml
inherit_gem:
rubocop-discourse: default.yml
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

1 change: 1 addition & 0 deletions Gemfile
@@ -1,3 +1,4 @@
# frozen_string_literal: true
source 'https://rubygems.org'

git_source(:github) { 'https://github.com/discourse/mini_scheduler' }
Expand Down
1 change: 1 addition & 0 deletions Guardfile
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# A sample Guardfile
# More info at https://github.com/guard/guard#readme

Expand Down
17 changes: 15 additions & 2 deletions Rakefile
@@ -1,6 +1,19 @@
require "bundler/gem_tasks"
#!/usr/bin/env rake
# frozen_string_literal: true

require "rspec/core/rake_task"
require 'bundler'

begin
Bundler.setup :default, :development
Bundler::GemHelper.install_tasks
rescue Bundler::BundlerError => error
$stderr.puts error.message
$stderr.puts "Run `bundle install` to install missing gems"
exit error.status_code
end

RSpec::Core::RakeTask.new(:spec)

task default: :spec
desc "Default: run tests"
task default: [ :spec ]
7 changes: 2 additions & 5 deletions mini_scheduler.gemspec
Expand Up @@ -15,11 +15,7 @@ Gem::Specification.new do |spec|
spec.homepage = "https://github.com/discourse/mini_scheduler"
spec.license = "MIT"

# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
end
spec.files = `git ls-files`.split($/).reject { |s| s =~ /^(spec|\.)/ }
spec.require_paths = ["lib"]

spec.add_dependency "sidekiq"
Expand All @@ -32,4 +28,5 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "guard-rspec"
spec.add_development_dependency "mock_redis"
spec.add_development_dependency "rake"
spec.add_development_dependency 'rubocop-discourse'
end