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

Switch to GitHub Actions #31

Merged
merged 1 commit into from
Apr 6, 2022
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
48 changes: 48 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: CI

on:
push:
pull_request:
schedule:
- cron: '0 0 * * 0'

jobs:
ci:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version:
- '2.5'
- '2.6'
- '2.7'
- '3.0'
rails-version:
- '6.0'
- '6.1'
services:
postgres:
image: manageiq/postgresql:10
env:
POSTGRESQL_USER: root
POSTGRESQL_PASSWORD: smartvm
POSTGRESQL_DATABASE: vmdb_test
options: --health-cmd pg_isready --health-interval 2s --health-timeout 5s --health-retries 5
ports:
- 5432:5432
env:
PGHOST: localhost
TEST_RAILS_VERSION: ${{ matrix.rails-version }}
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- name: Run tests
run: bundle exec rake
- name: Report code coverage
if: ${{ github.ref == 'refs/heads/master' && matrix.ruby-version == '3.0' && matrix.rails-version == '6.1' }}
continue-on-error: true
uses: paambaati/codeclimate-action@v3.0.0
1 change: 0 additions & 1 deletion .rspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
--require spec_helper
--color
--order random
--format documentation
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @carbonin
* @Fryguy
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ManageIQ::PostgresHaAdmin

[![Gem Version](https://badge.fury.io/rb/manageiq-postgres_ha_admin.svg)](http://badge.fury.io/rb/manageiq-postgres_ha_admin)
[![Build Status](https://travis-ci.org/ManageIQ/manageiq-postgres_ha_admin.svg)](https://travis-ci.org/ManageIQ/manageiq-postgres_ha_admin)
[![CI](https://github.com/ManageIQ/manageiq-postgres_ha_admin/actions/workflows/ci.yaml/badge.svg)](https://github.com/ManageIQ/manageiq-postgres_ha_admin/actions/workflows/ci.yaml)
[![Code Climate](https://codeclimate.com/github/ManageIQ/manageiq-postgres_ha_admin.svg)](https://codeclimate.com/github/ManageIQ/manageiq-postgres_ha_admin)
[![Test Coverage](https://codeclimate.com/github/ManageIQ/manageiq-postgres_ha_admin/badges/coverage.svg)](https://codeclimate.com/github/ManageIQ/manageiq-postgres_ha_admin/coverage)

Expand Down
5 changes: 2 additions & 3 deletions manageiq-postgres_ha_admin.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency "pg-dsn_parser", "~> 0.1"

spec.add_development_dependency "bundler"
spec.add_development_dependency "codeclimate-test-reporter", "~> 1.0.0"
spec.add_development_dependency "manageiq-style"
spec.add_development_dependency "rake"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "simplecov"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "simplecov", ">= 0.21.2"
end
6 changes: 1 addition & 5 deletions spec/failover_monitor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,7 @@ def active_databases_conninfo
context "private" do
describe "#database_in_recovery?" do
before do
begin
@connection = PG::Connection.open(:dbname => 'travis', :user => 'travis')
rescue PG::ConnectionBad
skip "travis database does not exist"
end
@connection = ConnectionHelper.connection_for('vmdb_test')
end

after do
Expand Down
8 changes: 1 addition & 7 deletions spec/server_store_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@
end

before do
# @connection = PG::Connection.open(:dbname => 'vmdb_test')
begin
@connection = PG::Connection.open(:dbname => 'travis', :user => 'travis')
rescue PG::ConnectionBad
skip "travis database does not exist"
end

@connection = ConnectionHelper.connection_for('vmdb_test')
@connection.exec("START TRANSACTION")
@connection.exec("CREATE SCHEMA repmgr")
@connection.exec(<<-SQL)
Expand Down
7 changes: 7 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
if ENV['CI']
require 'simplecov'
SimpleCov.start
end

Dir[File.join(__dir__, "support/**/*.rb")].each { |f| require f }

RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
Expand Down
14 changes: 14 additions & 0 deletions spec/support/connection_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module ConnectionHelper
def self.connection_for(dbname)
require "pg"

options = {
:host => ENV["PGHOST"],
:user => ENV.fetch("PGUSER", "root"),
:password => ENV.fetch("PGPASSWORD", "smartvm"),
:dbname => dbname
}.compact

PG::Connection.new(options)
end
end