Skip to content

Commit

Permalink
Merge pull request #4 from eManPrague/feature/0.0.3
Browse files Browse the repository at this point in the history
👷 Added deploy and test script (yaml)
  • Loading branch information
Del-S authored Apr 22, 2022
2 parents 2fc24af + 1d8ebd5 commit 8814755
Show file tree
Hide file tree
Showing 11 changed files with 119 additions and 14 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Deploy

on:
workflow_dispatch:
branches: [ master ]

jobs:
test:
name: Publish gem
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- name: Run tests
run: bundle exec rake spec
- name: Publish gem
uses: dawidd6/action-publish-gem@v1
with:
api_key: ${{secrets.RUBYGEMS_API_KEY}}
- name: Create git tag
uses: duderman/gh-gem-tag-action@v1
id: release_info
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.release_info.outputs.tag }}
draft: false
file: '*.gem'
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Test

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:
name: Test with Ruby ${{ matrix.ruby }}
runs-on: ubuntu-latest
strategy:
matrix:
ruby: [ '2.5', '2.7', '3.0' ]
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run tests
run: bundle exec rake spec
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
pkg
.idea/
.yardoc

coverage/
.coverage
coverage.xml
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
## Changelog

### Version 0.0.3 (TBD)
### Version 0.0.3 (2022-04-22)

- Added deploy and test yaml for github workflow.
- Added deployment to Readme.
- Added codecov connection and dependency.
- Added Readme badges.
- Remove "Check: " hardcoded ext from warning message.
- Fixed tests.
- Updated Gemfile.lock.

### Version 0.0.2 (2022-04-21)

Expand Down
24 changes: 17 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
danger-logging_lint (0.0.1)
danger-logging_lint (0.0.3)
danger-plugin-api (~> 1.0)

GEM
Expand All @@ -15,11 +15,13 @@ GEM
cork
nap
open4 (~> 1.3)
codecov (0.5.2)
simplecov (>= 0.15, < 0.22)
coderay (1.1.3)
colored2 (3.1.2)
cork (0.3.0)
colored2 (~> 3.1)
danger (8.5.0)
danger (8.6.0)
claide (~> 1.0)
claide-plugins (>= 0.9.2)
colored2 (~> 3.1)
Expand All @@ -35,6 +37,7 @@ GEM
danger-plugin-api (1.0.0)
danger (> 2.0)
diff-lcs (1.5.0)
docile (1.4.0)
faraday (1.10.0)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
Expand Down Expand Up @@ -62,7 +65,7 @@ GEM
faraday-retry (1.0.3)
ffi (1.15.5)
formatador (1.1.0)
git (1.10.2)
git (1.11.0)
rchardet (~> 1.8)
guard (2.18.0)
formatador (>= 0.2.4)
Expand Down Expand Up @@ -99,12 +102,12 @@ GEM
sawyer (~> 0.8.0, >= 0.5.3)
open4 (1.3.4)
parallel (1.22.1)
parser (3.1.1.0)
parser (3.1.2.0)
ast (~> 2.4.1)
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (4.0.6)
public_suffix (4.0.7)
rainbow (3.1.1)
rake (10.5.0)
rb-fsevent (0.11.1)
Expand All @@ -126,13 +129,13 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-support (3.11.0)
rubocop (1.27.0)
rubocop (1.28.1)
parallel (~> 1.10)
parser (>= 3.1.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.16.0, < 2.0)
rubocop-ast (>= 1.17.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.17.0)
Expand All @@ -143,6 +146,12 @@ GEM
addressable (>= 2.3.5)
faraday (> 0.8, < 2.0)
shellany (0.0.1)
simplecov (0.21.2)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
thor (1.2.1)
Expand All @@ -156,6 +165,7 @@ PLATFORMS

DEPENDENCIES
bundler (~> 2.0)
codecov (~> 0.5.1)
danger-logging_lint!
guard (~> 2.14)
guard-rspec (~> 4.7)
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## logging_lint
## Logging Lint
[![Gem Version](https://badge.fury.io/rb/danger-logging_lint.svg)](https://badge.fury.io/rb/danger-logging_lint) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/eManPrague/danger-logging_lint/blob/master/LICENSE.txt) [![Test](https://github.com/eManPrague/danger-logging_lint/actions/workflows/test.yml/badge.svg)](https://github.com/eManPrague/danger-logging_lint/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/eManPrague/danger-logging_lint/branch/master/graph/badge.svg?token=Z2RZKYNBVI)](https://codecov.io/gh/eManPrague/danger-logging_lint)


This danger plugin can be used to check log lines in modified (added) files. It heavily relies on regex configuration which can be modified to search all kinds of parts of code in the files. Default configuration is set to support [Kotlin eMan Logger Library](https://github.com/eManPrague/logger-ktx). Ex: logInfo { "Info message $var" }.

Expand Down Expand Up @@ -75,6 +77,4 @@ If all of these checks pass then it will trigger linter on target files (filtere
## Deployment
1. Make sure you increased version in /lib/logging_lint/gem_version.rb
2. Run command `gem build danger-logging_lint` which should create file `danger-logging_lint-VERSION.gem`
3. Deploy to [RubyGems](https://rubygems.org/) using command `gem push danger-logging_lint-VERSION.gem`.
Gem is deployed manually from master branch using [Github Action](https://github.com/eManPrague/danger-logging_lint/actions/workflows/deploy.yml). Make sure you increased the gem version before triggering it.
20 changes: 20 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
codecov:
require_ci_to_pass: yes

coverage:
precision: 2
round: down
range: '70...100'

parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no

comment:
layout: 'reach,diff,flags,files,footer'
behavior: default
require_changes: no
1 change: 1 addition & 0 deletions danger-logging_lint.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "rake", "~> 10.0"

# Testing support
spec.add_development_dependency 'codecov', '~> 0.5.1'
spec.add_development_dependency "rspec", "~> 3.4"

# Linting code and docs
Expand Down
2 changes: 1 addition & 1 deletion lib/logging_lint/gem_version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module LoggingLint
VERSION = "0.0.2"
VERSION = "0.0.3"
end
2 changes: 1 addition & 1 deletion spec/logging_lint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ module Danger
allow(@logging_lint.git).to receive(:added_files).and_return(added_files)
allow(@logging_lint).to receive(:warning_description).and_return(warning_link)
@logging_lint.log_lint
expect(@dangerfile.status_report[:warnings][0]).to eq("#{warning_text} Check: #{warning_link}")
expect(@dangerfile.status_report[:warnings][0]).to eq("#{warning_text} #{warning_link}")
end

it "Log with variables is warned without link address" do
Expand Down
6 changes: 6 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# frozen_string_literal: true

require "simplecov"
SimpleCov.start

require "codecov"
SimpleCov.formatter = SimpleCov::Formatter::Codecov

require "pathname"
ROOT = Pathname.new(File.expand_path("..", __dir__))
$:.unshift("#{ROOT}lib".to_s)
Expand Down

0 comments on commit 8814755

Please sign in to comment.