Skip to content

Commit

Permalink
DEV: update CI workflow and bumped versions (#17)
Browse files Browse the repository at this point in the history
* bump actions/checkout version, use ruby 3.2 and add stree
* fix linting errors
* update dependencies
  • Loading branch information
tyb-talks authored Jul 18, 2024
1 parent 0fa2540 commit 7176797
Show file tree
Hide file tree
Showing 14 changed files with 371 additions and 322 deletions.
23 changes: 9 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,38 @@ on:
pull_request:
push:
branches:
- master
- main

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
ruby:
- 2.5
- 2.6
- 2.7
- 3.0

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
ruby-version: "3.2"
bundler-cache: true

- name: Lint
- name: Rubocop
run: bundle exec rubocop

- name: Syntax Tree
run: |
set -E
bundle exec stree check Gemfile discourse_mail_receiver.gemspec $(git ls-files '*.rb')
- name: Tests
run: bundle exec rake test

publish:
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Release Gem
uses: discourse/publish-rubygems-action@v2-beta
Expand Down
5 changes: 4 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
inherit_gem:
rubocop-discourse: default.yml
rubocop-discourse: stree-compat.yml

Discourse:
Enabled: false
2 changes: 2 additions & 0 deletions .streerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--print-width=100
--plugins=plugin/trailing_comma,disable_ternary
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

source 'https://rubygems.org'
source "https://rubygems.org"

# Specify your gem's dependencies in onebox.gemspec
gemspec
131 changes: 90 additions & 41 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,68 +1,117 @@
PATH
remote: .
specs:
discourse_mail_receiver (4.0.7)
discourse_mail_receiver (4.0.8)
mail (~> 2.7.1)

GEM
remote: https://rubygems.org/
specs:
activesupport (7.1.3.4)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
ast (2.4.2)
diff-lcs (1.4.4)
base64 (0.2.0)
bigdecimal (3.1.8)
concurrent-ruby (1.3.3)
connection_pool (2.4.1)
diff-lcs (1.5.1)
drb (2.2.1)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
json (2.7.2)
language_server-protocol (3.17.0.3)
mail (2.7.1)
mini_mime (>= 0.1.1)
mini_mime (1.1.0)
parallel (1.20.1)
parser (3.0.1.1)
mini_mime (1.1.5)
minitest (5.24.1)
mutex_m (0.2.0)
parallel (1.25.1)
parser (3.3.4.0)
ast (~> 2.4.1)
rainbow (3.0.0)
rake (13.0.3)
regexp_parser (2.1.1)
rexml (3.2.8)
strscan (>= 3.0.9)
rspec (3.10.0)
rspec-core (~> 3.10.0)
rspec-expectations (~> 3.10.0)
rspec-mocks (~> 3.10.0)
rspec-core (3.10.1)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.1)
racc
prettier_print (1.2.1)
racc (1.8.0)
rack (3.1.7)
rainbow (3.1.1)
rake (13.2.1)
regexp_parser (2.9.2)
rexml (3.3.2)
strscan
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-mocks (3.10.2)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-support (3.10.2)
rubocop (1.15.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rubocop (1.65.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.0.0.0)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.5.0, < 2.0)
regexp_parser (>= 2.4, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.5.0)
parser (>= 3.0.1.1)
rubocop-discourse (2.4.1)
rubocop (>= 1.1.0)
rubocop-rspec (>= 2.0.0)
rubocop-rspec (2.3.0)
rubocop (~> 1.0)
rubocop-ast (>= 1.1.0)
ruby-progressbar (1.11.0)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.3)
parser (>= 3.3.1.0)
rubocop-capybara (2.21.0)
rubocop (~> 1.41)
rubocop-discourse (3.8.1)
activesupport (>= 6.1)
rubocop (>= 1.59.0)
rubocop-capybara (>= 2.0.0)
rubocop-factory_bot (>= 2.0.0)
rubocop-rails (>= 2.25.0)
rubocop-rspec (>= 3.0.1)
rubocop-rspec_rails (>= 2.30.0)
rubocop-factory_bot (2.26.1)
rubocop (~> 1.61)
rubocop-rails (2.25.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (3.0.3)
rubocop (~> 1.61)
rubocop-rspec_rails (2.30.0)
rubocop (~> 1.61)
rubocop-rspec (~> 3, >= 3.0.1)
ruby-progressbar (1.13.0)
strscan (3.1.0)
unicode-display_width (2.0.0)
syntax_tree (6.2.0)
prettier_print (>= 1.2.0)
syntax_tree-disable_ternary (1.0.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)

PLATFORMS
ruby

DEPENDENCIES
bundler (~> 2.0)
discourse_mail_receiver!
rake (~> 13.0)
rspec (~> 3.10)
rubocop-discourse (~> 2.4.1)
rake
rspec
rubocop-discourse
syntax_tree
syntax_tree-disable_ternary

BUNDLED WITH
2.1.4
37 changes: 19 additions & 18 deletions discourse_mail_receiver.gemspec
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
# frozen-string-literal: true

# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) if !$LOAD_PATH.include?(lib)

Gem::Specification.new do |spec|
spec.name = 'discourse_mail_receiver'
spec.version = '4.0.7'
spec.authors = ['Discourse Team']
spec.email = ['[email protected]']
spec.description = %q{A gem used to package the core .rb files of the mail-receiver.}
spec.summary = spec.description
spec.homepage = 'https://github.com/discourse/mail-receiver'
spec.license = 'MIT'
spec.name = "discourse_mail_receiver"
spec.version = "4.0.8"
spec.authors = ["Discourse Team"]
spec.email = ["[email protected]"]
spec.description = "A gem used to package the core .rb files of the mail-receiver."
spec.summary = spec.description
spec.homepage = "https://github.com/discourse/mail-receiver"
spec.license = "MIT"

spec.required_ruby_version = '>= 2.5.0'
spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")

spec.files = Dir['lib/**/*.rb']
spec.require_paths = ['lib']
spec.files = Dir["lib/**/*.rb"]
spec.require_paths = ["lib"]

spec.add_runtime_dependency 'mail', '~> 2.7.1'
spec.add_development_dependency 'bundler', '~> 2.0'
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rspec', '~> 3.10'
spec.add_development_dependency 'rubocop-discourse', '~> 2.4.1'
spec.add_runtime_dependency "mail", "~> 2.7.1"
spec.add_development_dependency "rake"
spec.add_development_dependency "rspec"
spec.add_development_dependency "rubocop-discourse"
spec.add_development_dependency "syntax_tree"
spec.add_development_dependency "syntax_tree-disable_ternary"
end
12 changes: 5 additions & 7 deletions lib/mail_receiver/discourse_mail_receiver.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# frozen_string_literal: true
require 'syslog'
require 'json'
require "syslog"
require "json"
require "uri"
require "net/http"
require_relative 'mail_receiver_base'
require_relative "mail_receiver_base"

class DiscourseMailReceiver < MailReceiverBase

def initialize(env_file = nil, recipient = nil, mail = nil)
super(env_file)

Expand All @@ -23,8 +22,8 @@ def endpoint

@endpoint = @env["DISCOURSE_MAIL_ENDPOINT"]

if @env['DISCOURSE_BASE_URL']
@endpoint = "#{@env['DISCOURSE_BASE_URL']}/admin/email/handle_mail"
if @env["DISCOURSE_BASE_URL"]
@endpoint = "#{@env["DISCOURSE_BASE_URL"]}/admin/email/handle_mail"
end
@endpoint
end
Expand Down Expand Up @@ -55,5 +54,4 @@ def process
logger.err "Failed to POST the e-mail to %s: %s", endpoint, response.code
:failure
end

end
Loading

0 comments on commit 7176797

Please sign in to comment.