Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update project to new build and documentation standards (#22)
* Add CI build with Github Actions * Add a Github codeowners file * Update dependencies * Update rubocop configuration * Fix new Rubocop offenses * Use semverify instead of bump * Update Rakefile to standard for my projects * Update spec_helper to standard for my projects * Update YARD documentation to new standards * Update README.md project badges * Document the arg passed to the initialization block * Remove bundler as a direct dev dependency
- Loading branch information
Showing
10 changed files
with
510 additions
and
170 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Defines who must review pull requests. | ||
# See https://help.github.com/articles/about-codeowners/ for details. | ||
|
||
* @jcouball @main-branch/github_pages_rake_tasks-codeowners |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: CI Build | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
continue-on-error: true | ||
|
||
strategy: | ||
matrix: | ||
ruby: ['3.0', '3.2', head, jruby-head] | ||
operating-system: [ubuntu-latest] | ||
include: | ||
- ruby: '3.0' | ||
operating-system: windows-latest | ||
- ruby: jruby-head | ||
operating-system: windows-latest | ||
|
||
name: Ruby ${{ matrix.ruby }} on ${{ matrix.operating-system }} | ||
runs-on: ${{ matrix.operating-system }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Initialize Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ matrix.ruby }} | ||
bundler-cache: true | ||
|
||
- name: Run rake | ||
run: bundle exec rake | ||
|
||
coverage: | ||
needs: [ build ] | ||
runs-on: ubuntu-latest | ||
|
||
name: Report test coverage to CodeClimate | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Initialize Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 3.1 | ||
bundler-cache: true | ||
|
||
- name: Run tests | ||
run: bundle exec rake spec | ||
|
||
- name: Report test coverage | ||
uses: paambaati/codeclimate-action@v3.2.0 | ||
env: | ||
CC_TEST_REPORTER_ID: 997ddf9df5b99897b448d7a7a13e332d57f0e29754d9b9d1414aaee611759422 | ||
with: | ||
coverageLocations: ${{github.workspace}}/coverage/lcov/*.lcov:lcov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,86 @@ | ||
# Copyright (c) 2019 James Couball | ||
# frozen_string_literal: true | ||
|
||
require 'bundler/gem_tasks' | ||
CLOBBER << 'Gemfile.lock' | ||
desc 'Run the same tasks that the CI build will run' | ||
if RUBY_PLATFORM == 'java' | ||
task default: %w[spec rubocop bundle:audit build] | ||
else | ||
task default: %w[spec rubocop yard yard:audit yard:coverage bundle:audit build] | ||
end | ||
|
||
require 'rspec/core/rake_task' | ||
RSpec::Core::RakeTask.new(:spec) | ||
CLEAN << '.rspec_status' | ||
CLEAN << 'coverage' | ||
# Bundler Audit | ||
|
||
require 'bundler/audit/task' | ||
Bundler::Audit::Task.new | ||
|
||
require 'bump/tasks' | ||
# Bundler Gem Build | ||
|
||
require 'bundler' | ||
require 'bundler/gem_tasks' | ||
|
||
begin | ||
Bundler.setup(:default, :development) | ||
rescue Bundler::BundlerError => e | ||
warn e.message | ||
warn 'Run `bundle install` to install missing gems' | ||
exit e.status_code | ||
end | ||
|
||
CLEAN << 'pkg' | ||
CLEAN << 'Gemfile.lock' | ||
|
||
# RSpec | ||
|
||
require 'rspec/core/rake_task' | ||
|
||
RSpec::Core::RakeTask.new do | ||
if RUBY_PLATFORM == 'java' | ||
ENV['JAVA_OPTS'] = '-Djdk.io.File.enableADS=true' | ||
ENV['JRUBY_OPTS'] = '--debug' | ||
ENV['NOCOV'] = 'TRUE' | ||
end | ||
end | ||
|
||
CLEAN << 'coverage' | ||
CLEAN << '.rspec_status' | ||
CLEAN << 'rspec-report.xml' | ||
|
||
# Rubocop | ||
|
||
require 'rubocop/rake_task' | ||
|
||
RuboCop::RakeTask.new do |t| | ||
t.options = %w[--format progress --format json --out rubocop-report.json] | ||
t.options = %w[ | ||
--format progress | ||
--format json --out rubocop-report.json | ||
] | ||
end | ||
|
||
CLEAN << 'rubocop-report.json' | ||
|
||
require 'yard' | ||
YARD::Rake::YardocTask.new | ||
CLEAN << '.yardoc' | ||
CLEAN << 'doc' | ||
unless RUBY_PLATFORM == 'java' | ||
# YARD | ||
|
||
require 'yardstick/rake/verify' | ||
require 'yaml' | ||
Yardstick::Rake::Verify.new('yardstick:verify') | ||
require 'yard' | ||
YARD::Rake::YardocTask.new do |t| | ||
t.files = %w[lib/**/*.rb examples/**/*] | ||
end | ||
|
||
require 'yardstick/rake/measurement' | ||
Yardstick::Rake::Measurement.new('yardstick:measure') | ||
CLEAN << 'measurements' | ||
CLEAN << '.yardoc' | ||
CLEAN << 'doc' | ||
|
||
desc 'Run yardstick to check yard docs' | ||
task :yardstick do | ||
sh "yardstick 'lib/**/*.rb'" | ||
end | ||
# Yardstick | ||
|
||
desc 'Run yardstick to show missing YARD doc elements' | ||
task :'yard:audit' do | ||
sh "yardstick 'lib/**/*.rb'" | ||
end | ||
|
||
task default: [:spec, 'bundle:audit', :rubocop, :yard, :build] | ||
# Yardstick coverage | ||
|
||
require 'yardstick/rake/verify' | ||
|
||
Yardstick::Rake::Verify.new(:'yard:coverage') do |verify| | ||
verify.threshold = 100 | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,8 +70,5 @@ def initialize | |
# | ||
# @return [String] the output of the command | ||
# | ||
def `(cmd) | ||
super | ||
end | ||
end | ||
end |
Oops, something went wrong.