Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksii-leonov committed May 2, 2023
0 parents commit 5413b4a
Show file tree
Hide file tree
Showing 68 changed files with 2,428 additions and 0 deletions.
73 changes: 73 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ruby
{
"name": "Ruby",

"image": "mcr.microsoft.com/devcontainers/ruby:0-3.2",

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "bundle && bundle exec overcommit --install",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
"remoteUser": "root",

"customizations": {
"vscode": {
"settings": {
// Basic formatting settings.
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,

// Colorize and highlight bracket pairs.
"editor.guides.bracketPairs": true,
"editor.bracketPairColorization.enabled": true,

// Require to confirm exit when the terminal is active (helps a lot when accidentally Cmd-Q pressed).
"terminal.integrated.confirmOnExit": "hasChildProcesses",

// Controls the maximum amount of lines the terminal keeps in its buffer.
// Increase to 50000. Default 1000 is too low.
"terminal.integrated.scrollback": 50000,

// Ruby LSP settings
"rubyLsp.formatter": "rubocop",
"rubyLsp.enableExperimentalFeatures": true,

// Ruby LSP advanced semantic highlighting.
"workbench.colorTheme": "Spinel",

// Ruby settings.
"[ruby]": {
"editor.formatOnSave": true,
"editor.formatOnType": true,
"editor.defaultFormatter": "Shopify.ruby-lsp",
"editor.rulers": [
120
],
"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.semanticHighlighting.enabled": true
},
},

// Add the IDs of extensions you want installed when the container is created in the array below.
"extensions": [
"shopify.ruby-extensions-pack",
"eamodio.gitlens",
"ms-azuretools.vscode-docker",
"davidanson.vscode-markdownlint",
"bierner.markdown-preview-github-styles",
"github.vscode-github-actions"
]
}
}
}
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.bundle/*
.idea*
log/*
tmp/*
.ruby-lsp/*
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Defines the coding style for different editors and IDEs.
# http://editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners

* @oleksii-leonov
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: bundler
directory: "/"
schedule:
interval: "weekly"
75 changes: 75 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Test Suite

on:
pull_request:
push:
branches:
- main

jobs:
overcommit:
runs-on: ubuntu-latest
name: Overcommit checks
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true
- name: Overcommit checks
# NOTE: Set to make Overcommit's AuthorName and AuthorEmail checks happy.
env:
GIT_AUTHOR_NAME: example
GIT_AUTHOR_EMAIL: example@example.com
run: |
bundle exec overcommit --sign --force
SKIP=ForbiddenBranches bundle exec overcommit --run
specs:
needs: [overcommit]
runs-on: ${{ matrix.os }}
name: Ruby ${{ matrix.ruby }} on ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-22.04", "macos-12", "windows-2022"]
ruby: ["2.6", "2.7", "3.0", "3.1", "3.2"]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run the default task
env:
# NOTE: Using fixed console table width.
# TTY width in GitHub actions could be as small as "1" for Windows machines.
TTY_TABLE_WIDTH: fixed
run: bundle exec rake
build_and_test_docker_image:
needs: [overcommit]
runs-on: ubuntu-latest
name: Build and test docker image
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build docker image
uses: docker/build-push-action@v4
with:
load: true
tags: test
- name: Run image
run: |
mkdir -p /tmp/sample_data
cp spec/sample_data/system/input.csv /tmp/sample_data/input.csv
docker run -t --rm \
-v /tmp/sample_data:/tmp/sample_data \
test \
--input /tmp/sample_data/input.csv \
--output /tmp/sample_data/output.csv
- name: Check results
run: diff /tmp/sample_data/output.csv spec/sample_data/system/output.csv
47 changes: 47 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
*.gem
*.rbc
/.config
/coverage/
/spec/reports/
/spec/examples.txt
/tmp/

## Documentation cache and generated files:
/.yardoc/
/_yardoc/
/doc/
/rdoc/

## Environment normalization:
/.bundle/
/vendor/bundle
/lib/bundler/man/

# for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
Gemfile.lock
.ruby-version
.ruby-gemset

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

# RSpec
/.rspec_status

# Checksums folder
/checksums

# MacOS files
.DS_Store
.AppleDouble
.LSOverride
._*
.Spotlight-V100
.Trashes

# Ruby-LSP VSCode extension
/.ruby-lsp

# VSCode workspace settings
/.vscode
29 changes: 29 additions & 0 deletions .overcommit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
PreCommit:
ALL:
on_warn: fail
BundleCheck:
enabled: true
FileSize:
enabled: true
size_limit_bytes: 1_000_000
ForbiddenBranches:
enabled: true
LineEndings:
enabled: true
RuboCop:
enabled: true
TrailingWhitespace:
enabled: true
YamlSyntax:
enabled: true

CommitMsg:
ALL:
on_warn: fail
# Disable some default Overcommit checks to avoid collisions with commitlint.
TextWidth:
enabled: false
CapitalizedSubject:
enabled: false
SingleLineSubject:
enabled: false
3 changes: 3 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--format documentation
--color
--require spec_helper
27 changes: 27 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
require:
- rubocop-rspec

AllCops:
NewCops: enable
TargetRubyVersion: 2.6

Style/StringLiterals:
Enabled: true
EnforcedStyle: double_quotes

Style/StringLiteralsInInterpolation:
Enabled: true
EnforcedStyle: double_quotes

Layout/LineLength:
Max: 120

# Relax RSpec metrics
RSpec/ExampleLength:
Max: 20 # Defaut is 5

RSpec/MultipleExpectations:
Max: 3 # Defaut is 1

RSpec/MultipleMemoizedHelpers:
Max: 10 # Defaut is 5
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## [Unreleased]

## [0.1.0] - 2023-05-02

- Initial release
Loading

0 comments on commit 5413b4a

Please sign in to comment.