Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow GH actions and drop travis #357

Merged
merged 3 commits into from
Aug 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ engines:
enabled: true
rubocop:
enabled: true
channel: rubocop-0-87
checks:
Rubocop/Style/PercentLiteralDelimiters:
enabled: false # it's outdated vs rubocop
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/js_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: JavaScript Testing
on:
pull_request:
paths:
- 'webpack/**'
- 'package.json'
- '.github/workflows/js_tests.yml'

jobs:
test_js:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [10, 12]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
repository: theforeman/foreman
ref: develop
path: foreman
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Foreman npm install
working-directory: './foreman'
run: npm install
- name: Plugin npm install
run: npm install
- name: Run plugin linter
run: npm run lint
- name: Run plugin tests
run: npm run test
78 changes: 78 additions & 0 deletions .github/workflows/ruby_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Ruby Testing
on: [pull_request]
env:
RAILS_ENV: test
DATABASE_URL: postgresql://postgres:@localhost/test
DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL: true
jobs:
rubocop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
- name: Setup
run: |
gem install bundler
bundle install --jobs=3 --retry=3
- name: Run rubocop
run: bundle exec rubocop
test_ruby:
runs-on: ubuntu-latest
needs: rubocop
services:
postgres:
image: postgres:12.1
ports: ['5432:5432']
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
strategy:
fail-fast: false
matrix:
foreman-core-branch: [develop]
ruby-version: [2.5, 2.6]
node-version: [12]
steps:
- name: Install build packages
run: |
sudo apt-get update
sudo apt-get install build-essential libcurl4-openssl-dev zlib1g-dev libpq-dev
- uses: actions/checkout@v2
with:
repository: theforeman/foreman
ref: ${{ matrix.foreman-core-branch }}
- uses: actions/checkout@v2
with:
path: foreman_ansible
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-fgems-${{ matrix.ruby-version }}-${{ hashFiles('Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-fgems-${{ matrix.ruby-version }}-
- name: Setup Bundler
run: |
echo "gem 'foreman_ansible', path: './foreman_ansible'" > bundler.d/foreman_ansible.local.rb
echo "gem 'foreman_ansible_core', path: './foreman_ansible'" >> bundler.d/foreman_ansible.local.rb
gem install bundler
bundle config set without journald development console libvirt
bundle config set path vendor/bundle
- name: Prepare test env
run: |
bundle install --jobs=3 --retry=3
bundle exec rake db:create
bundle exec rake db:migrate
bundle exec rake db:test:prepare
- name: Run plugin tests
run: |
bundle exec rake test:foreman_ansible
bundle exec rake test TEST="test/unit/foreman/access_permissions_test.rb"
47 changes: 29 additions & 18 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
inherit_from:
- .rubocop_todo.yml

Rails:
Enabled: true
require:
- rubocop-performance
- rubocop-rails
- rubocop-minitest

AllCops:
TargetRubyVersion: 2.5
Expand All @@ -13,32 +15,41 @@ AllCops:
- 'node_modules/**/*'

# Just so it looks like core Foreman
Style/HashSyntax:
EnforcedStyle: no_mixed_keys

Layout/DotPosition:
EnforcedStyle: 'trailing'

Layout/EmptyLineAfterGuardClause:
Enabled: false

Layout/LineLength:
Enabled: false

Metrics:
Enabled: false

Performance/RegexpMatch:
Enabled: false

Rails:
Enabled: true

Rails/ActionFilter:
EnforcedStyle: action

Style/RaiseArgs:
EnforcedStyle: compact
Rails/ContentTag:
Enabled: false

Style/SymbolArray:
EnforcedStyle: brackets
Rails/SkipsModelValidations:
Enabled: false

Style/FormatStringToken:
EnforcedStyle: template

Rails/SkipsModelValidations:
Enabled: false

Metrics:
Enabled: false
Style/HashSyntax:
EnforcedStyle: no_mixed_keys

Layout/LineLength:
Enabled: false
Style/RaiseArgs:
EnforcedStyle: compact

Performance/RegexpMatch:
Enabled: false
Style/SymbolArray:
EnforcedStyle: brackets
Loading