Switching from travis to github actions for testing

This commit is contained in:
Alexander Meindl
2020-12-01 07:49:38 +01:00
parent d3cdce03d0
commit 9823c578a5
17 changed files with 240 additions and 103 deletions

View File

@@ -1,10 +1,12 @@
name: Run RuboCop
on: [push]
name: Run Linters
on:
push:
pull_request:
schedule:
- cron: '30 5 * * *'
jobs:
build:
test:
runs-on: ubuntu-latest
steps:
@@ -19,10 +21,12 @@ jobs:
run: |
echo "">> Gemfile
echo "group :test do">> Gemfile
echo " gem 'pandoc-ruby', require: false" >> Gemfile
echo " gem 'rubocop', require: false" >> Gemfile
echo " gem 'rubocop-performance', require: false" >> Gemfile
echo " gem 'rubocop-rails', require: false" >> Gemfile
echo "end">> Gemfile
echo " gem 'slim_lint', require: false" >> Gemfile
echo "end" >> Gemfile
- name: Setup gems
run: |
@@ -32,3 +36,8 @@ jobs:
- name: Run RuboCop
run: |
bundle exec rubocop -S
- name: Run Slim-Lint
run: |
bundle exec slim-lint app/views
if: always()

View File

@@ -1,4 +1,4 @@
name: Run Tests
name: Tests
on:
push:
pull_request:
@@ -7,25 +7,125 @@ on:
jobs:
test:
name: ${{ matrix.redmine }} ${{ matrix.db }} ruby-${{ matrix.ruby }}
runs-on: ubuntu-latest
strategy:
matrix:
redmine:
- v4.0
- v4.1
- trunk
ruby:
- v2.4
- v2.6
database:
- sqlite3
- postgres
ruby: ['2.6', '2.4']
redmine: ['4.1-stable', 'master']
db: ['postgres', 'mysql']
fail-fast: false
services:
postgres:
image: postgres:13
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
mysql:
image: mysql:5.7
env:
MYSQL_USER: root
MYSQL_PASSWORD: ''
MYSQL_ALLOW_EMPTY_PASSWORD: yes
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- name: Redmine plugin test
uses: two-pack/redmine-plugin-test-action@v2
- name: Verify MySQL connection from host
run: |
mysql --host 127.0.0.1 --port 3306 -uroot -e "SHOW DATABASES"
if: matrix.db == 'mysql'
- name: Checkout Redmine
uses: actions/checkout@v2
with:
plugin_name: redmine_messenger
redmine_version: ${{ matrix.redmine }}
ruby_version: ${{ matrix.ruby }}
repository: redmine/redmine
ref: ${{ matrix.redmine }}
path: redmine
- name: Checkout redmine_messenger
uses: actions/checkout@v2
with:
repository: AlphaNodes/redmine_messenger
path: redmine/plugins/redmine_messenger
- name: Update package archives
run: sudo apt-get update --yes --quiet
- name: Install package dependencies
run: >
sudo apt-get install --yes --quiet
build-essential
cmake
libicu-dev
libpq-dev
libmysqlclient-dev
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
architecture: 'x64'
- name: Setup Cache
uses: actions/cache@v1
with:
path: vendor
key: v1-ruby-${{ matrix.ruby }}-redmine-${{ matrix.redmine }}
- name: Setup Bundler
run: |
gem install bundler -v '~> 1.0'
bundle config path "$(pwd)/vendor/bundle"
- name: Prepare Redmine source
working-directory: redmine
run: |
sed -i '/rubocop/d' Gemfile
rm -f .rubocop*
cp plugins/redmine_messenger/test/support/database-${{ matrix.db }}.yml config/database.yml
cp plugins/redmine_messenger/test/support/configuration.yml config/configuration.yml
- name: Install Ruby dependencies
working-directory: redmine
run: |
bundle install --jobs=4 --retry=3 --without development
- name: Run Redmine rake tasks
env:
RAILS_ENV: test
working-directory: redmine
run: |
bundle exec rake generate_secret_token
bundle exec rake db:create db:migrate redmine:plugins:migrate
bundle exec rake db:test:prepare
- name: Run tests
env:
RAILS_ENV: test
REDMINE_VERSION: ${{ matrix.redmine }}
working-directory: redmine
run: bundle exec rake redmine:plugins:test NAME=redmine_messenger RUBYOPT="-W0"
- name: Run uninstall test
env:
RAILS_ENV: test
REDMINE_VERSION: ${{ matrix.redmine }}
working-directory: redmine
run: bundle exec rake redmine:plugins:migrate NAME=redmine_messenger VERSION=0

View File

@@ -1,3 +1,40 @@
linters:
LineLength:
max: 140
RuboCop:
ignored_cops:
- Layout/ArgumentAlignment
- Layout/ArrayAlignment
- Layout/BlockEndNewline
- Layout/EmptyLineAfterGuardClause
- Layout/HashAlignment
- Layout/IndentationConsistency
- Layout/IndentationWidth
- Layout/IndentFirstArgument
- Layout/IndentFirstArrayElement
- Layout/IndentFirstHashElement
- Layout/MultilineArrayBraceLayout
- Layout/MultilineAssignmentLayout
- Layout/MultilineBlockLayout
- Layout/MultilineHashBraceLayout
- Layout/MultilineMethodCallBraceLayout
- Layout/MultilineMethodCallIndentation
- Layout/MultilineMethodDefinitionBraceLayout
- Layout/MultilineOperationIndentation
- Layout/TrailingBlankLines
- Layout/TrailingEmptyLines
- Layout/TrailingWhitespace
- Lint/BlockAlignment
- Lint/EndAlignment
- Lint/Void
- Metrics/BlockLength
- Metrics/BlockNesting
- Metrics/LineLength
- Naming/FileName
- Rails/OutputSafety
- Style/ConditionalAssignment
- Style/FrozenStringLiteralComment
- Style/IdenticalConditionalBranches
- Style/IfUnlessModifier
- Style/Next
- Style/WhileUntilModifier

View File

@@ -1,47 +0,0 @@
language: ruby
os: linux
dist: xenial
rvm:
- 2.6.6
- 2.5.8
- 2.4.10
services:
- mysql
- postgresql
env:
- REDMINE_VER=4.0-stable DB=postgresql
- REDMINE_VER=master DB=postgresql
- REDMINE_VER=4.0-stable DB=mysql
- REDMINE_VER=master DB=mysql
notifications:
webhooks:
urls:
secure: "lwJzu9BU7AVhHnROzEA6agagwsqVAaTzgtvwTlw4CwSUv0ypNXNi9kjJUvOgSit3BnkSccC9xYlYNOYw5OOmsmjyUDU4/LUVqd0DRQjW3FXU9EFFPGQq9srJikHOHobfnutxGwMYFE4ftLI08PzsL7bYEg39Ps3pwwWsiIKnKKI0DPmdQH5PzC63jF/EByrLZsfqGHOirgXDnxmwgmrQ14vOpp3lHjgNgx9wNALpSgAztKeK1Wd8KayLYXweu+LQx9IwJfLqvk6hhWW15vjkIhvK7ooYSGXx+Hlwg3jyFSyX5jButUT4vwlWdJeAoNO/sWpdKXv4AifGXYsbcF/LMHCaaVgwBm/pe/YlK2LrqFlpm7MFuqyO1w4AnIA7rC8wZp/dUU5bJITZgN3sTAbLyTIbF8cbMfbDy3IWP8Oub7K/0ATUD7vNBVuyxfdGG61xOv/RDQhzrGwUArJ/xJfdU77MZkQUnaGb0vcwmRLIxyPdZWPz9ntzCbBxFblPWApCw+CWOeM3OuR6tdVqSVuZx3aG87TTzW+S9lLe8PJ5HYgA6+rPkc04zolJMftnFVlUl3LQIKvV2QkPSnr9bcePR5YSoJJKLBVofUsg/btVkQ1OxhWn53Td/nQp7u8qosmyQjCjMiP6Po1e9Enr89FY8Yxkw2dQba5sumQRbB39bj0="
on_success: change
on_failure: always
before_install:
- export PLUGIN_NAME=redmine_messenger
- export REDMINE_GIT_REPO=git://github.com/redmine/redmine.git
- export REDMINE_PATH=$HOME/redmine
- export BUNDLE_GEMFILE=$REDMINE_PATH/Gemfile
- export RAILS_ENV=test
- git clone $REDMINE_GIT_REPO $REDMINE_PATH
- cd $REDMINE_PATH
- if [[ "$REDMINE_VER" != "master" ]]; then git checkout -b $REDMINE_VER origin/$REDMINE_VER; fi
- if [[ "$REDMINE_VER" != "master" ]]; then cp $TRAVIS_BUILD_DIR/test/support/Gemfile.local $REDMINE_PATH; fi
- ln -s $TRAVIS_BUILD_DIR $REDMINE_PATH/plugins/$PLUGIN_NAME
- cp $TRAVIS_BUILD_DIR/test/support/additional_environment.rb $REDMINE_PATH/config/
- cp $TRAVIS_BUILD_DIR/test/support/database-$DB-travis.yml $REDMINE_PATH/config/database.yml
before_script:
- bundle exec rake db:create db:migrate redmine:plugins:migrate
script:
- if [[ "$REDMINE_VER" != "master" ]] && [[ "$DB" == "postgresql" ]]; then rubocop plugins/$PLUGIN_NAME; fi
- bundle exec rake redmine:plugins:test NAME=$PLUGIN_NAME RUBYOPT="-W0"
- bundle exec rake redmine:plugins:migrate NAME=$PLUGIN_NAME VERSION=0

View File

@@ -1,6 +1,11 @@
Changelog
=========
1.0.8
-----
- Drop testing with travis - we use github actions
1.0.7
-----
- Added feature to send messages directly to users to be notified - thanks to @Ujifman

View File

@@ -3,7 +3,7 @@ Messenger plugin for Redmine
This plugin posts updates to issues in your Redmine installation to [Slack](https://slack.com/), [Rocket.Chat](https://rocket.chat/), [Discord](https://discordapp.com/) or [Mattermost](https://about.mattermost.com/) channel.
[![Rate at redmine.org](https://img.shields.io/badge/rate%20at-redmine.org-blue.svg?style=fla)](https://www.redmine.org/plugins/redmine_messenger) [![Build Status](https://travis-ci.org/AlphaNodes/redmine_messenger.svg?branch=master)](https://travis-ci.org/AlphaNodes/redmine_messenger) ![Run RuboCop](https://github.com/AlphaNodes/redmine_messenger/workflows/Run%20RuboCop/badge.svg) ![Run Tests](https://github.com/AlphaNodes/redmine_messenger/workflows/Run%20Tests/badge.svg)
[![Rate at redmine.org](https://img.shields.io/badge/rate%20at-redmine.org-blue.svg?style=fla)](https://www.redmine.org/plugins/redmine_messenger) [![Run Tests](https://github.com/AlphaNodes/redmine_messenger/workflows/Tests/badge.svg))](https://github.com/AlphaNodes/redmine_messenger/actions?query=workflow%3A"Run+Tests) [![Run Linters](https://github.com/AlphaNodes/redmine_messenger/workflows/Run%20Linters/badge.svg)](https://github.com/AlphaNodes/redmine_messenger/actions?query=workflow%3A%22Run+Linters%22)
Features
--------

View File

@@ -199,9 +199,10 @@ class Messenger
end
else
key = detail.prop_key.to_s.sub('_id', '')
title = if key == 'parent'
title = case key
when 'parent'
I18n.t "field_#{key}_issue"
elsif key == 'copied_from'
when 'copied_from'
I18n.t "label_#{key}"
else
I18n.t "field_#{key}"

View File

@@ -1,8 +1,5 @@
# Plugin's routes
# See: http://guides.rubyonrails.org/routing.html
# Don't create routes for repositories resources with only: []
# do not override Redmine's routes.
resources :projects, only: [] do
resource :messenger_setting, only: %i[show update]
Rails.application.routes.draw do
resources :projects, only: [] do
resource :messenger_setting, only: %i[show update]
end
end

View File

@@ -6,7 +6,7 @@ Redmine::Plugin.register :redmine_messenger do
url 'https://github.com/alphanodes/redmine_messenger'
author_url 'https://alphanodes.com/'
description 'Messenger integration for Slack, Discord, Rocketchat and Mattermost support'
version '1.0.7'
version RedmineMessenger::VERSION
requires_redmine version_or_higher: '4.0.0'

View File

@@ -0,0 +1,3 @@
module RedmineMessenger
VERSION = '1.0.8-master'.freeze
end

View File

@@ -1,3 +0,0 @@
gem 'rubocop', require: false
gem 'rubocop-performance', require: false
gem 'rubocop-rails', require: false

View File

@@ -1,4 +0,0 @@
# for travis debugging
# config.logger = Logger.new(STDOUT)
# config.logger.level = Logger::INFO
# config.log_level = :info

View File

@@ -0,0 +1,6 @@
# = Redmine configuration file
# default configuration options for all environments
default:
sudo_mode: false
sudo_mode_timeout: 1

View File

@@ -1,8 +0,0 @@
test:
adapter: mysql2
database: travis_ci_test
host: localhost
username: root
password:
pool: 5
encoding: utf8mb4

View File

@@ -0,0 +1,26 @@
production:
adapter: mysql2
database: redmine
host: 127.0.0.1
port: 3306
username: root
password:
encoding: utf8mb4
development:
adapter: mysql2
database: redmine
port: 3306
host: 127.0.0.1
username: root
password:
encoding: utf8mb4
test:
adapter: mysql2
database: redmine
port: 3306
host: 127.0.0.1
username: root
password:
encoding: utf8mb4

View File

@@ -0,0 +1,23 @@
production:
adapter: postgresql
host: localhost
database: redmine
username: postgres
password: postgres
encoding: utf8
development:
adapter: postgresql
host: localhost
database: redmine
username: postgres
password: postgres
encoding: utf8
test:
adapter: postgresql
host: localhost
database: redmine
username: postgres
password: postgres
encoding: utf8

View File

@@ -1,8 +0,0 @@
test:
adapter: postgresql
encoding: unicode
pool: 5
database: travis_ci_test
user: postgres