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

Bump actions/setup-node from 3 to 4 #8

Closed
Closed
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
63 changes: 63 additions & 0 deletions .github/workflows/foreman.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
name: Foreman

on:
- pull_request

env:
RAILS_ENV: test
DATABASE_URL: postgresql://postgres:password@localhost/test
DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL: true
BUNDLE_WITHOUT: "console:development:journald"

jobs:
test:
name: "Foreman develop with Ruby ${{ matrix.ruby }} and Node ${{ matrix.node }}"
runs-on: ubuntu-latest
services:
postgres:
image: 'postgres:12'
ports: ['5432:5432']
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
env:
POSTGRES_PASSWORD: password
strategy:
fail-fast: false
matrix:
ruby:
- "2.7"
- "3.0"
node:
- "12"
steps:
- run: sudo apt-get update
- run: sudo apt-get install build-essential libcurl4-openssl-dev zlib1g-dev libpq-dev libvirt-dev
- name: "Check out Foreman develop"
uses: actions/checkout@v4
with:
repository: ofedoren/foreman
ref: "develop"
- name: "Set up Ruby ${{ matrix.ruby }}"
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Archive Gemfile.lock
uses: actions/upload-artifact@v3
with:
name: Gemfile.lock
path: Gemfile.lock
- name: "Set up Node ${{ matrix.node }}"
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Prepare test env
run: |
bundle exec rake db:create
bundle exec rake db:migrate
- name: Run unit tests
run: bundle exec rake test:units
- name: Run functional tests
run: bundle exec rake test:functionals
- name: Run graphql tests
run: bundle exec rake test:graphql
2 changes: 1 addition & 1 deletion .github/workflows/js_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
with:
ruby-version: 2.7
- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Generate npm dependencies package-lock
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/plugins_react_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
org: theforeman
steps:
- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '12.x'
# We could update the postinstall action for foreman to look for an environment variable for plugin webpack dirs
Expand Down
6 changes: 5 additions & 1 deletion app/models/host.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ def self.method_missing(method, *args, &block)
end
end
if type.constantize.respond_to?(method, true)
type.constantize.send(method, *args, &block)
if method.to_s =~ /\Afind_in_(.*)\Z/ && args.size == 1 && args[0].is_a?(Hash)
type.constantize.send(method, **args[0], &block)
else
type.constantize.send(method, *args, &block)
end
else
super
end
Expand Down
8 changes: 4 additions & 4 deletions db/migrate/20150525081931_remove_duplicate_tokens.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
class RemoveDuplicateTokens < ActiveRecord::Migration[4.2]
def up
remove_foreign_key :tokens, :column => :host_id if foreign_key_exists?(:tokens, { :name => "tokens_host_id_fk" })
remove_foreign_key :tokens, :column => :host_id if foreign_key_exists?(:tokens, name: "tokens_host_id_fk")
remove_index :tokens, :host_id if index_exists? :tokens, :host_id
add_index :tokens, :host_id, :unique => true
add_foreign_key :tokens, :hosts, :name => "tokens_host_id_fk" unless foreign_key_exists?(:tokens, { :name => "tokens_host_id_fk" })
add_foreign_key :tokens, :hosts, :name => "tokens_host_id_fk" unless foreign_key_exists?(:tokens, name: "tokens_host_id_fk")
end

def down
remove_foreign_key :tokens, :column => :host_id if foreign_key_exists?(:tokens, { :name => "tokens_host_id_fk" })
remove_foreign_key :tokens, :column => :host_id if foreign_key_exists?(:tokens, name: "tokens_host_id_fk")
remove_index :tokens, :host_id if index_exists? :tokens, :host_id
add_index :tokens, :host_id
add_foreign_key :tokens, :hosts, :name => "tokens_host_id_fk" unless foreign_key_exists?(:tokens, { :name => "tokens_host_id_fk" })
add_foreign_key :tokens, :hosts, :name => "tokens_host_id_fk" unless foreign_key_exists?(:tokens, name: "tokens_host_id_fk")
end
end
8 changes: 4 additions & 4 deletions db/migrate/20180613100703_add_type_to_token.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
class AddTypeToToken < ActiveRecord::Migration[5.1]
def up
remove_foreign_key :tokens, :column => :host_id if foreign_key_exists?(:tokens, { :name => "tokens_host_id_fk" })
remove_foreign_key :tokens, :column => :host_id if foreign_key_exists?(:tokens, name: "tokens_host_id_fk")
remove_index :tokens, :host_id if index_exists? :tokens, :host_id # was unique
add_index :tokens, :host_id
add_foreign_key :tokens, :hosts, :name => "tokens_host_id_fk" unless foreign_key_exists?(:tokens, { :name => "tokens_host_id_fk" })
add_foreign_key :tokens, :hosts, :name => "tokens_host_id_fk" unless foreign_key_exists?(:tokens, name: "tokens_host_id_fk")
add_column :tokens, :type, :string, default: 'Token::Build', null: false, index: true
change_column :tokens, :value, :text
end

def down
change_column :tokens, :value, :string, limit: 255
remove_column :tokens, :type
remove_foreign_key :tokens, :column => :host_id if foreign_key_exists?(:tokens, { :name => "tokens_host_id_fk" })
remove_foreign_key :tokens, :column => :host_id if foreign_key_exists?(:tokens, name: "tokens_host_id_fk")
remove_index :tokens, :host_id if index_exists? :tokens, :host_id
add_index :tokens, :host_id, :unique => true
add_foreign_key :tokens, :hosts, :name => "tokens_host_id_fk" unless foreign_key_exists?(:tokens, { :name => "tokens_host_id_fk" })
add_foreign_key :tokens, :hosts, :name => "tokens_host_id_fk" unless foreign_key_exists?(:tokens, name: "tokens_host_id_fk")
end
end
2 changes: 1 addition & 1 deletion test/controllers/home_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class HomeControllerTest < ActionController::TestCase
test "should get status without an error" do
get :status, {:format => "json"}
get :status, :format => "json"
assert_response :success
end
end
8 changes: 4 additions & 4 deletions test/models/lookup_key_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,10 @@ class LookupKeyTest < ActiveSupport::TestCase
:sc_type => 'hash',
:value => 'a:test',
},
{
:sc_type => 'yaml',
:value => '{a:test}',
},
# {
# :sc_type => 'yaml',
# :value => '{a:test}', # TODO: update test; apparently starting Ruby 2.7.8 this won't raise an Psych::SyntaxError. Apparently YAML/parser allows that. PKM (:
# },
{
:sc_type => 'json',
:value => RFauxFactory.gen_alpha,
Expand Down
2 changes: 1 addition & 1 deletion test/unit/setting_manager_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class SettingManagerTest < ActiveSupport::TestCase
default: '[email protected]',
description: 'This is nicely described foo setting',
full_name: 'Foo setting')
validates(:validfoo, email: true)
validates(:validfoo, { email: true })
end
end
Foreman::SettingManager.validations.setup!
Expand Down
6 changes: 3 additions & 3 deletions test/unit/tasks/interfaces_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class InterfacesTest < ActiveSupport::TestCase
end

assert_match /cleaned 0 interfaces/, stdout
encoded_hostname = URI.encode("(#{host.name})")
encoded_hostname = CGI.escape("(#{host.name})")
assert_match /#{encoded_hostname}/, stdout
assert_match /ignored interface set as primary/, stdout
end
Expand All @@ -49,9 +49,9 @@ class InterfacesTest < ActiveSupport::TestCase
end

assert_match /cleaned 0 interfaces/, stdout
encoded_hostname = URI.encode("(#{host.name})")
encoded_hostname = CGI.escape("(#{host.name})")
assert_match /#{encoded_hostname}/, stdout
query = URI.decode(stdout.match(/^.*search=(.*?%29)/)[1]).tr('+', ' ')
query = CGI.unescape(stdout.match(/^.*search=(.*?%29)/)[1]).tr('+', ' ')
assert_equal host.id, Host.search_for(query).first.id
assert_match /ignored interface set as provision/, stdout
end
Expand Down
Loading