Skip to content

Commit

Permalink
Switch to GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Fryguy committed Feb 5, 2022
1 parent 8060409 commit 3923064
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 33 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI

on: [push, pull_request]

jobs:
ci:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version:
- '2.6'
- '2.7'
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
PGPASSWORD: smartvm
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
steps:
- uses: actions/checkout@v2
- name: Set up system
run: bin/before_install
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- name: Prepare tests
run: bin/setup
- name: Run tests
run: bundle exec rake
- name: Report code coverage
if: ${{ github.ref == 'refs/heads/master' && matrix.ruby-version == '2.7' }}
continue-on-error: true
uses: paambaati/codeclimate-action@v3.0.0
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ManageIQ::Api

[![Build Status](https://travis-ci.com/ManageIQ/manageiq-api.svg?branch=master)](https://travis-ci.com/github/ManageIQ/manageiq-api)
[![CI](https://github.com/ManageIQ/manageiq-api/actions/workflows/ci.yaml/badge.svg)](https://github.com/ManageIQ/manageiq-api/actions/workflows/ci.yaml)
[![Maintainability](https://api.codeclimate.com/v1/badges/9105d34929af8f8ad103/maintainability)](https://codeclimate.com/github/ManageIQ/manageiq-api/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/9105d34929af8f8ad103/test_coverage)](https://codeclimate.com/github/ManageIQ/manageiq-api/test_coverage)

Expand Down
19 changes: 19 additions & 0 deletions bin/before_install
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

if [ -n "$CI" ]; then
echo "== Installing system packages =="
sudo apt-get install libcurl4-openssl-dev
echo
fi

gem_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." &>/dev/null && pwd)"
spec_manageiq="$gem_root/spec/manageiq"

if [ -n "$MANAGEIQ_REPO" ]; then
echo "== Symlinking spec/manageiq to $MANAGEIQ_REPO =="
rm -rf "$spec_manageiq"
ln -s "$(cd "$MANAGEIQ_REPO" &>/dev/null && pwd)" "$spec_manageiq"
elif [ ! -d "$spec_manageiq" ]; then
echo "== Cloning manageiq sample app =="
git clone https://github.com/ManageIQ/manageiq.git --branch master --depth 1 "$spec_manageiq"
fi
3 changes: 0 additions & 3 deletions bin/ci/after_script

This file was deleted.

19 changes: 4 additions & 15 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'

gem_root = Pathname.new(__dir__).join("..")
spec_manageiq = gem_root.join("spec/manageiq")

if ENV.key?("MANAGEIQ_REPO")
manageiq_repo = Pathname.new(ENV["MANAGEIQ_REPO"])
puts "== Symlinking spec/manageiq to #{manageiq_repo}"
require "pathname"

FileUtils.rm_rf(spec_manageiq.expand_path)
FileUtils.ln_s(manageiq_repo.expand_path, spec_manageiq.expand_path)
elsif !spec_manageiq.exist?
puts "== Cloning manageiq sample app =="
system "git clone https://github.com/ManageIQ/manageiq.git --branch master --depth 1 spec/manageiq"
end
gem_root = Pathname.new(__dir__).join("..")
system(gem_root.join("bin/before_install").to_s)

require gem_root.join("spec/manageiq/lib/manageiq/environment").to_s
require gem_root.join("spec/manageiq/lib/manageiq/environment")
ManageIQ::Environment.manageiq_plugin_setup(gem_root)
2 changes: 1 addition & 1 deletion manageiq-api.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ Gem::Specification.new do |spec|

spec.add_development_dependency "codeclimate-test-reporter", "~> 1.0.0"
spec.add_development_dependency "manageiq-style"
spec.add_development_dependency "simplecov"
spec.add_development_dependency "simplecov", ">= 0.21.2"
end

0 comments on commit 3923064

Please sign in to comment.