-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from samvera-labs/add-circleci
Integrating a CircleCI configuration
- Loading branch information
Showing
7 changed files
with
220 additions
and
83 deletions.
There are no files selected for viewing
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,81 @@ | ||
version: 2.1 | ||
orbs: | ||
samvera: samvera/[email protected] | ||
jobs: | ||
ci: | ||
parameters: | ||
ruby_version: | ||
type: string | ||
bundler_version: | ||
type: string | ||
default: 2.3.11 | ||
ruby_type: | ||
type: string | ||
default: 'ruby' | ||
docker: | ||
- image: cimg/<< parameters.ruby_type >>:<< parameters.ruby_version >>-browsers | ||
environment: | ||
BUNDLE_PATH: vendor/bundle | ||
BUNDLE_JOBS: 4 | ||
BUNDLE_RETRY: 3 | ||
SPEC_OPTS: --profile 10 --format RspecJunitFormatter --out /tmp/test-results/rspec.xml --format progress | ||
steps: | ||
- samvera/cached_checkout | ||
- checkout | ||
- run: | ||
name: Check for 'master' branch | ||
command: | | ||
git fetch --all --quiet --prune --prune-tags | ||
if [[ -n "$(git branch --all --list master */master)" ]]; then | ||
echo "A branch named 'master' was found. Please remove it." | ||
echo "$(git branch --all --list master */master)" | ||
fi | ||
[[ -z "$(git branch --all --list master */master)" ]] | ||
- samvera/bundle_for_gem: | ||
ruby_version: << parameters.ruby_version >> | ||
bundler_version: << parameters.bundler_version >> | ||
project: 'huborg' | ||
|
||
- samvera/rubocop | ||
|
||
# RSpec tests have not been implemented | ||
# - samvera/parallel_rspec | ||
|
||
workflows: | ||
ci: | ||
jobs: | ||
# Ruby 3.3 releases | ||
- ci: | ||
name: ruby3-3 | ||
ruby_version: 3.3.4 | ||
# Ruby 3.2 releases | ||
- ci: | ||
name: ruby3-2 | ||
ruby_version: 3.2.5 | ||
# Ruby 3.1 releases | ||
- ci: | ||
name: ruby3-1 | ||
ruby_version: 3.1.6 | ||
|
||
nightly: | ||
triggers: | ||
- schedule: | ||
cron: "0 0 * * *" | ||
filters: | ||
branches: | ||
only: | ||
- main | ||
jobs: | ||
# Ruby 3.3 releases | ||
- ci: | ||
name: ruby3-3 | ||
ruby_version: 3.3.4 | ||
# Ruby 3.2 releases | ||
- ci: | ||
name: ruby3-2 | ||
ruby_version: 3.2.5 | ||
# Ruby 3.1 releases | ||
- ci: | ||
name: ruby3-1 | ||
ruby_version: 3.1.6 |
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,6 +1,8 @@ | ||
source "https://rubygems.org" | ||
# frozen_string_literal: true | ||
|
||
source 'https://rubygems.org' | ||
|
||
# Specify your gem's dependencies in huborg.gemspec | ||
gemspec | ||
|
||
gem "rake", "~> 12.0" | ||
gem 'rake', '~> 12.0' |
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,62 +1,67 @@ | ||
require "bundler/gem_tasks" | ||
# frozen_string_literal: true | ||
|
||
require 'bundler/gem_tasks' | ||
|
||
# rubocop:disable Metrics/BlockLength | ||
namespace :test do | ||
desc "Push template to organization (set ENV[GITHUB_ACCESS_TOKEN] and ENV[GITHUB_ORG_NAME])" | ||
desc 'Push template to organization (set ENV[GITHUB_ACCESS_TOKEN] and ENV[GITHUB_ORG_NAME])' | ||
task :push_template do | ||
require 'huborg' | ||
client = Huborg::Client.new( | ||
github_access_token: ENV.fetch("GITHUB_ACCESS_TOKEN"), | ||
org_names: ENV.fetch("GITHUB_ORG_NAME") | ||
github_access_token: ENV.fetch('GITHUB_ACCESS_TOKEN'), | ||
org_names: ENV.fetch('GITHUB_ORG_NAME') | ||
) | ||
client.push_template!( | ||
template: __FILE__, | ||
filename: "disposable-#{Time.now.utc.to_s.gsub(/\D+/,'')}.rake" | ||
filename: "disposable-#{Time.now.utc.to_s.gsub(/\D+/, '')}.rake" | ||
) | ||
end | ||
|
||
task :clone_and_rebase do | ||
require 'huborg' | ||
client = Huborg::Client.new( | ||
github_access_token: ENV.fetch("GITHUB_ACCESS_TOKEN"), | ||
org_names: ENV.fetch("GITHUB_ORG_NAME") | ||
github_access_token: ENV.fetch('GITHUB_ACCESS_TOKEN'), | ||
org_names: ENV.fetch('GITHUB_ORG_NAME') | ||
) | ||
directory = ENV.fetch("DIRECTORY") { File.join(ENV.fetch("HOME"), "git") } | ||
directory = ENV.fetch('DIRECTORY') { File.join(ENV.fetch('HOME'), 'git') } | ||
client.clone_and_rebase!(directory: directory) | ||
end | ||
|
||
task :audit_license do | ||
require 'huborg' | ||
client = Huborg::Client.new( | ||
github_access_token: ENV.fetch("GITHUB_ACCESS_TOKEN"), | ||
org_names: ENV.fetch("GITHUB_ORG_NAME") | ||
github_access_token: ENV.fetch('GITHUB_ACCESS_TOKEN'), | ||
org_names: ENV.fetch('GITHUB_ORG_NAME') | ||
) | ||
client.audit_license | ||
end | ||
|
||
task :mailmap do | ||
require 'huborg' | ||
client = Huborg::Client.new( | ||
github_access_token: ENV.fetch("GITHUB_ACCESS_TOKEN"), | ||
org_names: ENV.fetch("GITHUB_ORG_NAME") | ||
github_access_token: ENV.fetch('GITHUB_ACCESS_TOKEN'), | ||
org_names: ENV.fetch('GITHUB_ORG_NAME') | ||
) | ||
client.synchronize_mailmap!(template: ENV.fetch("MAILMAP_TEMPLATE_FILENAME")) | ||
client.synchronize_mailmap!(template: ENV.fetch('MAILMAP_TEMPLATE_FILENAME')) | ||
end | ||
end | ||
|
||
|
||
require 'github_changelog_generator/task' | ||
desc "Generate CHANGELOG.md based on lib/huborg/version.md (change that to the new version before you run rake changelog)" | ||
# rubocop:disable Metrics/LineLength | ||
desc 'Generate CHANGELOG.md based on lib/huborg/version.md (change that to the new version before you run rake changelog)' | ||
# rubocop:enable Metrics/LineLength | ||
GitHubChangelogGenerator::RakeTask.new :changelog do |config| | ||
begin | ||
ENV.fetch("CHANGELOG_GITHUB_TOKEN") | ||
ENV.fetch('CHANGELOG_GITHUB_TOKEN') | ||
rescue KeyError | ||
$stderr.puts %(To run `rake changelog` you need to have a CHANGELOG_GITHUB_TOKEN) | ||
$stderr.puts %(set in ENV. (`export CHANGELOG_GITHUB_TOKEN="«your-40-digit-github-token»"`)) | ||
warn %(To run `rake changelog` you need to have a CHANGELOG_GITHUB_TOKEN) | ||
warn %(set in ENV. (`export CHANGELOG_GITHUB_TOKEN="«your-40-digit-github-token»"`)) | ||
exit!(1) | ||
end | ||
config.user = 'samvera-labs' | ||
config.project = 'huborg' | ||
config.since_tag = 'v0.1.0' # The changes before v0.1.0 were not as helpful | ||
config.future_release = %(v#{ENV.fetch("FUTURE_RELEASE", Huborg::VERSION)}) | ||
config.future_release = %(v#{ENV.fetch('FUTURE_RELEASE', Huborg::VERSION)}) | ||
config.base = 'CHANGELOG.md' | ||
end | ||
# rubocop:enable Metrics/BlockLength |
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,31 +1,34 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative 'lib/huborg/version' | ||
|
||
Gem::Specification.new do |spec| | ||
spec.name = "huborg" | ||
spec.name = 'huborg' | ||
spec.version = Huborg::VERSION | ||
spec.authors = ["Jeremy Friesen"] | ||
spec.email = ["[email protected]"] | ||
spec.authors = ['Jeremy Friesen'] | ||
spec.email = ['[email protected]'] | ||
|
||
spec.summary = %q{Make changes to Organization Repositories en-masse.} | ||
spec.description = %q{Make changes to Organization Repositories en-masse.} | ||
spec.homepage = "https://github.com/samvera-labs/huborg/" | ||
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0") | ||
spec.summary = 'Make changes to Organization Repositories en-masse.' | ||
spec.description = 'Make changes to Organization Repositories en-masse.' | ||
spec.homepage = 'https://github.com/samvera-labs/huborg/' | ||
spec.required_ruby_version = Gem::Requirement.new('>= 2.7') | ||
|
||
spec.metadata["homepage_uri"] = spec.homepage | ||
spec.metadata["source_code_uri"] = "https://github.com/samvera-labs/huborg/" | ||
spec.metadata["changelog_uri"] = "https://github.com/samvera-labs/huborg/blob/master/CHANGELOG.md" | ||
spec.metadata["documentation_uri"] = "https://www.rubydoc.info/gems/huborg/" | ||
spec.metadata['homepage_uri'] = spec.homepage | ||
spec.metadata['source_code_uri'] = 'https://github.com/samvera-labs/huborg/' | ||
spec.metadata['changelog_uri'] = 'https://github.com/samvera-labs/huborg/blob/master/CHANGELOG.md' | ||
spec.metadata['documentation_uri'] = 'https://www.rubydoc.info/gems/huborg/' | ||
|
||
# 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 | ||
spec.files = Dir.chdir(File.expand_path(__dir__)) do | ||
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } | ||
end | ||
spec.bindir = "exe" | ||
spec.bindir = 'exe' | ||
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } | ||
spec.require_paths = ["lib"] | ||
spec.add_dependency "octokit", "~> 4.16" | ||
spec.add_dependency "git", "~> 1.6" | ||
spec.add_development_dependency "byebug" | ||
spec.add_development_dependency "github_changelog_generator" | ||
spec.require_paths = ['lib'] | ||
spec.add_dependency 'git', '~> 1.6' | ||
spec.add_dependency 'octokit', '~> 4.16' | ||
spec.add_development_dependency 'byebug' | ||
spec.add_development_dependency 'github_changelog_generator' | ||
spec.add_development_dependency 'rubocop' | ||
end |
Oops, something went wrong.