Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/rake_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Rake CI
on:
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:

jobs:
Rake-CI:
strategy:
matrix:
os: [ubuntu-latest]
ruby: ["3.4"]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
ruby-version: "${{ matrix.ruby }}"
bundler-cache: true
- name: Install NodeJS 18.x
uses: actions/setup-node@v4
with:
node-version: "18.x"
- name: Run all Rake tasks
shell: bash
run: bundle exec rake ci
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ AllCops:
- "integration/**/*"
- "spec/**/*"
- "test/**/*"
- "vendor/**/*"
Metrics/BlockLength:
Exclude:
- "googleauth.gemspec"
Expand Down
2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ruby 3.4.9
nodejs 25.9.0
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ gem "logging", "~> 2.0"
gem "minitest", "~> 5.14"
gem "minitest-focus", "~> 1.1"
gem "rack-test", "~> 2.0"
gem "rake", "~> 13.0"
gem "redcarpet", "~> 3.0"
gem "redis", ">= 4.0", "< 6"
gem "rspec", "~> 3.0"
gem "rubocop-rspec"
gem "webmock", "~> 3.8"
gem "yard", "~> 0.9"
105 changes: 105 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

require "rake/testtask"
require "rspec/core/rake_task"
require "rubocop/rake_task"
require "yard"
require "multi_json"

# Helper to print files
def print_files pattern
files = Dir.glob pattern
puts "Matched #{files.size} files."
files.each { |f| puts " #{f}" } if Rake.application.options.trace
end

Rake::TestTask.new :minitest_run do |t|
t.libs << "test"
t.pattern = "test/**/*_test.rb"
t.warning = true
end

desc "Run Minitest tests"
task :test do
puts "--- Starting Minitest tests ---"
print_files "test/**/*_test.rb"
Rake::Task[:minitest_run].invoke
puts "--- Finished Minitest tests ---"
end

RSpec::Core::RakeTask.new :rspec_run do |t|
t.rspec_opts = "-Ilib -Ispec"
end

desc "Run RSpec specs"
task :spec do
puts "--- Starting RSpec specs ---"
print_files "spec/**/*_spec.rb"
Rake::Task[:rspec_run].invoke
puts "--- Finished RSpec specs ---"
end

RuboCop::RakeTask.new :rubocop_run

desc "Run RuboCop checks"
task :rubocop do
puts "--- Starting RuboCop checks ---"
Rake::Task[:rubocop_run].invoke
puts "--- Finished RuboCop checks ---"
end

Rake::TestTask.new :integration_run do |t|
t.libs << "integration"
t.pattern = "integration/**/*_test.rb"
t.warning = true
end

desc "Run integration tests"
task :integration do
puts "--- Starting integration tests ---"
print_files "integration/**/*_test.rb"
Rake::Task[:integration_run].invoke
puts "--- Finished integration tests ---"
end

desc "Build the gem"
task :build do
puts "--- Starting gem build ---"
sh "gem build googleauth.gemspec"
puts "--- Finished gem build ---"
end

YARD::Config.options[:generate_output_flag] = true
YARD::Rake::YardocTask.new :yardoc_run

desc "Generate documentation"
task :yardoc do
puts "--- Starting documentation generation ---"
Rake::Task[:yardoc_run].invoke
puts "--- Finished documentation generation ---"
end

desc "Run Link checks"
task linkinator: :yardoc do
puts "--- Starting link checks ---"
sh "npx -y linkinator ./doc --skip stackoverflow.com"
puts "--- Finished link checks ---"
end

desc "Run all CI tasks"
task ci: [:test, :spec, :rubocop, :integration, :build, :yardoc, :linkinator]

# Default task
task default: [:test, :spec, :rubocop]
Loading