Skip to content

Commit

Permalink
Merge pull request #38 from apiology/update-from-cookiecutter-2022-11…
Browse files Browse the repository at this point in the history
…-25-2100

Update from upstream
  • Loading branch information
apiology authored Nov 26, 2022
2 parents b640ca5 + 4ad1902 commit 8f651de
Show file tree
Hide file tree
Showing 12 changed files with 118 additions and 56 deletions.
18 changes: 7 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ commands:
sed -E -e 's/bigfiles \([[:digit:]]+.[[:digit:]]+.[[:digit:]]+\)/bigfiles (0.1.0)/g' \
Gemfile.lock > Gemfile.lock.deversioned
- restore_cache:
key: gems-v1-{{ checksum "Gemfile.lock.deversioned" }}
key: gems-v2-{{ checksum "Gemfile.lock.deversioned" }}
- restore_cache:
key: wheels-v1-{{ checksum "requirements_dev.txt" }}
key: wheels-v2-{{ checksum "requirements_dev.txt" }}
- run:
name: Initialize packages
command: |
Expand All @@ -54,11 +54,11 @@ commands:
exit 1
fi
- save_cache:
key: gems-v1-{{ checksum "Gemfile.lock.deversioned" }}
key: gems-v2-{{ checksum "Gemfile.lock.deversioned" }}
paths:
- "vendor/bundle"
- save_cache:
key: wheels-v1-{{ checksum "requirements_dev.txt" }}
key: wheels-v2-{{ checksum "requirements_dev.txt" }}
paths:
- "/home/circleci/.cache/pip/wheels"
- run:
Expand All @@ -83,6 +83,7 @@ commands:
jobs:
overcommit:
working_directory: ~/bigfiles
docker:
- image: apiology/circleci-ruby:latest
steps:
Expand All @@ -103,13 +104,8 @@ jobs:
steps:
- set_up_environment
- run_with_languages:
label: Test
command: |
bundle exec rake citest
# https://github.com/bluelabsio/records-mover/blob/master/Makefile#L25
git status --porcelain coverage/.last_run.json
git diff coverage/.last_run.json
test -z "$(git status --porcelain coverage/.last_run.json)"
label: test
command: make citest cicoverage
# This seemed to shave 5ish% of the build time off when added
resource_class: large

Expand Down
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,4 @@ requirements_dev.txt.installed
/pkg/
/spec/reports/
/tmp/
/coverage/.resultset.json
/coverage/.resultset.json.lock
/coverage/assets/
/coverage/index.html
/coverage/lcov/
/pkg
/coverage/
20 changes: 20 additions & 0 deletions .overcommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
# Uncomment the following lines to make the configuration take effect.

PreCommit:
# Extend default config at https://github.com/sds/overcommit/blob/master/config/default.yml
BrokenSymlinks:
enabled: true
description: 'Check for broken symlinks'
quiet: true
exclude:
# This is a symlink to sibling checkout of vincelifedaily, used
# only in local development
- config/env.1p
RuboCop:
enabled: true
on_warn: fail # Treat all warnings as failures
Expand All @@ -29,6 +38,10 @@ PreCommit:
- '**/Gemfile'
- '**/Rakefile'
- 'bin/*'
- 'script/*'
exclude:
- db/migrate/*.rb
- db/schema.rb
PythonFlake8:
enabled: true
on_warn: fail
Expand All @@ -37,6 +50,7 @@ PreCommit:
on_warn: fail
include:
- '.envrc'
- '**/*.sh'
YamlLint:
enabled: true
on_warn: fail
Expand All @@ -47,6 +61,12 @@ PreCommit:
- '.circleci/config.yml'
enabled: true

PrePush:
RSpec:
enabled: true
env:
RAILS_ENV: test

#PostCheckout:
# ALL: # Special hook name that customizes all hooks of this type
# quiet: true # Change all post-checkout hooks to only display output on failure
Expand Down
9 changes: 8 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ RSpec/MultipleExpectations:
Exclude:
- 'feature/**/*.rb'

# Ensure we reference constants on classes in instance_double() so
# that a renamed class is caught and doubles are always actually
# verified.
RSpec/VerifiedDoubleReference:
Enabled: true
EnforcedStyle: constant

#
# Add 'XX X' to the standard list
#
Expand Down Expand Up @@ -105,7 +112,7 @@ Style/TrivialAccessors:

AllCops:
NewCops: enable
TargetRubyVersion: 2.6
TargetRubyVersion: 2.7
Exclude:
- 'bin/*'
- 'feature/samples/**/*'
Expand Down
38 changes: 26 additions & 12 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,22 @@ PATH
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
bump (0.10.0)
chef-utils (17.10.0)
concurrent-ruby
childprocess (4.1.0)
coderay (1.1.3)
concurrent-ruby (1.1.10)
crack (0.4.5)
rexml
diff-lcs (1.5.0)
docile (1.4.0)
fakeweb (1.3.0)
ffi (1.15.4-java)
hashdiff (1.0.1)
high_water_mark (0.1.0)
imagen (0.1.8)
parser (>= 2.5, != 2.5.1.1)
Expand Down Expand Up @@ -45,7 +51,7 @@ GEM
iniparse (~> 1.4)
rexml (~> 3.2)
parallel (1.22.1)
parser (3.1.2.0)
parser (3.1.3.0)
ast (~> 2.4.1)
pry (0.14.1)
coderay (~> 1.1)
Expand All @@ -54,9 +60,10 @@ GEM
coderay (~> 1.1)
method_source (~> 1.0)
spoon (~> 0.0)
public_suffix (5.0.0)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.5.0)
regexp_parser (2.6.1)
rexml (3.2.5)
rspec (3.11.0)
rspec-core (~> 3.11.0)
Expand All @@ -71,17 +78,17 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-support (3.11.0)
rubocop (1.31.2)
rubocop (1.39.0)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.1.0.0)
parser (>= 3.1.2.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.18.0, < 2.0)
rubocop-ast (>= 1.23.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.18.0)
rubocop-ast (1.23.0)
parser (>= 3.1.1.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
Expand All @@ -100,34 +107,41 @@ GEM
spoon (0.0.6)
ffi
tomlrb (2.0.3)
undercover (0.4.4)
undercover (0.4.5)
imagen (>= 0.1.8)
rainbow (>= 2.1, < 4.0)
rugged (>= 0.27, < 1.3)
unicode-display_width (2.2.0)
rugged (>= 0.27, < 1.6)
unicode-display_width (2.3.0)
webmock (3.18.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)

PLATFORMS
java
ruby
x86_64-darwin-19
x86_64-darwin-20
x86_64-darwin-21
x86_64-linux

DEPENDENCIES
bigfiles!
bump
bundler
fakeweb
mdl
overcommit (>= 0.58.0)
pry
rake (~> 13.0)
rspec (>= 3.4)
rubocop
rubocop (~> 1.36)
rubocop-rake
rubocop-rspec
rubocop-rspec (>= 2.10.0)
simplecov (>= 0.18.0)
simplecov-lcov
undercover
webmock

BUNDLED WITH
2.2.25
2.3.26
24 changes: 22 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,17 @@ export PRINT_HELP_PYSCRIPT
help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

default: localtest ## run default tests and quality
default: clean-coverage test coverage clean-typecoverage typecheck typecoverage quality ## run default typechecking, tests and quality

typecheck: ## validate types in code and configuration

citypecheck: typecheck ## Run type check from CircleCI

typecoverage: typecheck ## Run type checking and then ratchet coverage in metrics/

clean-typecoverage: ## Clean out type-related coverage previous results to avoid flaky results

citypecoverage: typecoverage ## Run type checking, ratchet coverage, and then complain if ratchet needs to be committed

requirements_dev.txt.installed: requirements_dev.txt
pip install -q --disable-pip-version-check -r requirements_dev.txt
Expand All @@ -41,7 +51,7 @@ clean: clear_metrics ## remove all built artifacts

test: spec ## run tests quickly

typecheck: ## validate types in code and configuration
citest: test ## Run unit tests from CircleCI

overcommit: ## run precommit quality checks
bundle exec overcommit --run
Expand All @@ -60,6 +70,16 @@ localtest: ## run default local actions
repl: ## Load up bigfiles in pry
@bundle exec rake repl

clean-coverage:
@bundle exec rake clear_metrics

coverage: test report-coverage ## check code coverage
@bundle exec rake undercover

report-coverage: test ## Report summary of coverage to stdout, and generate HTML, XML coverage report

cicoverage: coverage ## check code coverage

update_from_cookiecutter: ## Bring in changes from template project used to create this repo
bundle exec overcommit --uninstall
IN_COOKIECUTTER_PROJECT_UPGRADER=1 cookiecutter_project_upgrader || true
Expand Down
9 changes: 6 additions & 3 deletions bigfiles.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
spec.summary = 'Finds largest source files in a project'
spec.homepage = 'https://github.com/apiology/bigfiles'
spec.license = 'MIT license'
spec.required_ruby_version = '>= 2.6'
spec.required_ruby_version = '>= 2.7'

spec.files = Dir.chdir(File.expand_path(__dir__)) do
`git ls-files -z`.split("\x0").reject do |f|
Expand All @@ -29,6 +29,7 @@ Gem::Specification.new do |spec|

spec.add_development_dependency 'bump'
spec.add_development_dependency 'bundler'
spec.add_development_dependency 'fakeweb'
spec.add_development_dependency 'mdl'
# 0.58.0 and 0.57.0 don't seem super compatible with signatures, and
# magit doesn't seem to want to use the bundled version at the moment,
Expand All @@ -37,13 +38,15 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'pry'
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rspec', '>=3.4'
spec.add_development_dependency 'rubocop'
spec.add_development_dependency 'rubocop', ['~> 1.36']
spec.add_development_dependency 'rubocop-rake'
spec.add_development_dependency 'rubocop-rspec'
# ensure version with RSpec/VerifiedDoubleReference
spec.add_development_dependency 'rubocop-rspec', ['>=2.10.0']
# ensure version with branch coverage
spec.add_development_dependency 'simplecov', ['>=0.18.0']
spec.add_development_dependency 'simplecov-lcov'
spec.add_development_dependency 'undercover'
spec.add_development_dependency 'webmock'
spec.metadata = {
'rubygems_mfa_required' => 'true',
}
Expand Down
6 changes: 0 additions & 6 deletions coverage/.last_run.json

This file was deleted.

4 changes: 2 additions & 2 deletions feature/feature_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
# capture_exec.rb
def exec_io(*cmd)
cmd = cmd.flatten
out_err, _exit_code = Open3.capture2e(*cmd)
all_out, _exit_code = Open3.capture2e(*cmd)

out_err
all_out
end

RSpec.configure do |config|
Expand Down
25 changes: 22 additions & 3 deletions fix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,18 @@ ensure_rbenv() {

latest_ruby_version() {
major_minor=${1}
rbenv install --list 2>/dev/null | grep "^${major_minor}."

# Double check that this command doesn't error out under -e
rbenv install --list >/dev/null 2>&1

# not sure why, but 'rbenv install --list' below exits with error code
# 1...after providing the same output the previous line gave when it
# exited with error code 0.
#
# https://github.com/rbenv/rbenv/issues/1441
set +e
rbenv install --list 2>/dev/null | cat | grep "^${major_minor}."
set -e
}

ensure_dev_library() {
Expand All @@ -91,12 +102,20 @@ ensure_ruby_build_requirements() {
ensure_dev_library openssl/ssl.h openssl libssl-dev
}

ensure_latest_ruby_build_definitions() {
ensure_rbenv

git -C "$(rbenv root)"/plugins/ruby-build pull
}

# You can find out which feature versions are still supported / have
# been release here: https://www.ruby-lang.org/en/downloads/
ensure_ruby_versions() {
ensure_latest_ruby_build_definitions

# You can find out which feature versions are still supported / have
# been release here: https://www.ruby-lang.org/en/downloads/
ruby_versions="$(latest_ruby_version 2.6)"
ruby_versions="$(latest_ruby_version 2.7)"

echo "Latest Ruby versions: ${ruby_versions}"

Expand Down Expand Up @@ -169,7 +188,7 @@ ensure_bundle() {
#
# This affects nokogiri, which will try to reinstall itself in
# Docker builds where it's already installed if this is not run.
for platform in x86_64-darwin-20 x86_64-linux
for platform in x86_64-darwin-21 x86_64-linux
do
grep "${platform:?}" Gemfile.lock >/dev/null 2>&1 || bundle lock --add-platform "${platform:?}"
done
Expand Down
Loading

0 comments on commit 8f651de

Please sign in to comment.