Skip to content

Commit

Permalink
Merge to master - overwrite other solutions with PR
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandermeindl committed Dec 23, 2020
2 parents c27352b + daeb824 commit e8d97f9
Show file tree
Hide file tree
Showing 373 changed files with 5,372 additions and 11,781 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/brakeman.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Run Brakeman

on: [push]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Install package dependencies
run: >
sudo apt-get install --yes --quiet
pandoc
- name: Set up Ruby 2.6
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x

- name: Setup gems
run: |
echo "source 'https://rubygems.org'" > Gemfile
echo "group :test do" >> Gemfile
echo " gem 'brakeman', require: false" >> Gemfile
echo " gem 'pandoc-ruby', require: false" >> Gemfile
echo "end">> Gemfile
gem install bundler
bundle install --jobs 4 --retry 3
- name: Run Brakeman
run: |
bundle exec brakeman -5
44 changes: 44 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Run Linters

on: [push]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Install package dependencies
run: >
sudo apt-get install --yes --quiet
pandoc
- name: Set up Ruby 2.6
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x

- name: Setup gems
run: |
echo "source 'https://rubygems.org'" > 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 " gem 'rubocop-rspec', require: false" >> Gemfile
echo " gem 'slim_lint', require: false" >> Gemfile
echo "end" >> Gemfile
gem install bundler
bundle install --jobs 4 --retry 3
- name: Run RuboCop
run: |
bundle exec rubocop -S
- name: Run Slim-Lint
run: |
bundle exec slim-lint app/views
if: always()
162 changes: 162 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
name: Test
on:
push:
pull_request:

jobs:
test:
name: ${{ matrix.redmine }} ${{ matrix.db }} ruby-${{ matrix.ruby }}
runs-on: ubuntu-latest

strategy:
matrix:
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: 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:
repository: redmine/redmine
ref: ${{ matrix.redmine }}
path: redmine

- name: Checkout redmine_git_hosting
uses: actions/checkout@v2
with:
path: redmine/plugins/redmine_git_hosting

- name: Checkout additionals
uses: actions/checkout@v2
with:
repository: AlphaNodes/additionals
path: redmine/plugins/additionals

- name: Checkout redmine_sidekiq
uses: actions/checkout@v2
with:
repository: ogom/redmine_sidekiq
path: redmine/plugins/redmine_sidekiq

- name: Checkout gitolite
uses: actions/checkout@v2
with:
repository: sitaramc/gitolite
path: gitolite

- 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
libgpg-error-dev
libicu-dev
libpq-dev
libmysqlclient-dev
libssh2-1
libssh2-1-dev
subversion
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}

- 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_git_hosting/contrib/github/database-${{ matrix.db }}.yml config/database.yml
- name: Install admin ssh key
working-directory: redmine
run: |
ssh-keygen -N '' -f plugins/redmine_git_hosting/ssh_keys/redmine_gitolite_admin_id_rsa
- name: Install Gitolite
working-directory: redmine
run: |
sudo useradd --create-home git
sudo -n -u git -i mkdir bin
sudo -n -u git -i $GITHUB_WORKSPACE/gitolite/install -to /home/git/bin
sudo cp plugins/redmine_git_hosting/ssh_keys/redmine_gitolite_admin_id_rsa.pub /home/git/
sudo chown git.git /home/git/redmine_gitolite_admin_id_rsa.pub
sudo -n -u git -i bin/gitolite setup -pk redmine_gitolite_admin_id_rsa.pub
- 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: Install rspec file
working-directory: redmine
run: |
mkdir spec
cp plugins/redmine_git_hosting/spec/root_spec_helper.rb spec/spec_helper.rb
- name: Run tests
env:
RAILS_ENV: test
REDMINE_VERSION: ${{ matrix.redmine }}
working-directory: redmine
run: bundle exec rake redmine_git_hosting:ci:all
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ settings.yml
/coverage
/junit
custom_hooks.rb
/ssh_keys/redmine_gitolite_admin_id_rsa*
.DS_Store
coverage/
48 changes: 36 additions & 12 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
inherit_from: .rubocop_todo.yml

require:
- rubocop-rspec
- rubocop-performance
- rubocop-rails

Rails:
Enabled: true

AllCops:
TargetRubyVersion: 2.5
TargetRubyVersion: 2.4
TargetRailsVersion: 5.2
NewCops: enable
Include:
- '**/*.ruby'
- '**/*.rake'
Expand All @@ -17,44 +20,65 @@ AllCops:
- '**/Gemfile'

Metrics/AbcSize:
Max: 65
Enabled: false

Metrics/BlockLength:
Max: 60
Enabled: false

Metrics/ClassLength:
Enabled: false

Metrics/CyclomaticComplexity:
Max: 20
Enabled: false

Metrics/LineLength:
Layout/LineLength:
Max: 140

Metrics/MethodLength:
Max: 60
Enabled: false

Metrics/ModuleLength:
Enabled: false

Metrics/PerceivedComplexity:
Max: 25
Max: 45

Rails/SkipsModelValidations:
Rails/ApplicationJob:
Enabled: false

Rails/ApplicationRecord:
Enabled: false

Rails/CreateTableWithTimestamps:
Enabled: false

# app/model/application_record.rb is missing in redmine, we can't use ApplicationRecord
Rails/ApplicationRecord:
Rails/HelperInstanceVariable:
Enabled: false

Style/FrozenStringLiteralComment:
Rails/SkipsModelValidations:
Enabled: false

Performance/ChainArrayAllocation:
Enabled: true

Style/AutoResourceCleanup:
Enabled: true

Style/FrozenStringLiteralComment:
Enabled: false

Style/Documentation:
Enabled: false

# required for travis/ci (symbolic links problem)
Style/ExpandPathArguments:
Enabled: false

Style/HashTransformKeys:
Enabled: false

Style/HashTransformValues:
Enabled: false

Naming/VariableNumber:
Enabled: false
Loading

0 comments on commit e8d97f9

Please sign in to comment.