From f18dec089cc3b85543c4defca4b56a50e52f960f Mon Sep 17 00:00:00 2001 From: Jason Frey Date: Sat, 5 Feb 2022 15:52:09 -0500 Subject: [PATCH] Switch to GitHub Actions --- .github/workflows/ci.yaml | 43 ++++++++++++++++++++++++++++++ .travis.yml | 12 --------- README.md | 2 +- bin/before_install | 19 +++++++++++++ bin/ci/after_failure | 3 --- bin/ci/after_script | 3 --- bin/setup | 19 +++---------- manageiq-automation_engine.gemspec | 2 +- 8 files changed, 68 insertions(+), 35 deletions(-) create mode 100644 .github/workflows/ci.yaml delete mode 100644 .travis.yml create mode 100755 bin/before_install delete mode 100755 bin/ci/after_failure delete mode 100755 bin/ci/after_script diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 000000000..6ac873347 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -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 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ff9c07f93..000000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -language: ruby -cache: bundler -rvm: -- 2.6.6 -- 2.7.2 -addons: - postgresql: '10' -install: bin/setup -after_script: bin/ci/after_script -after_failure: bin/ci/after_failure -dist: bionic diff --git a/README.md b/README.md index d2fd287f7..ccd04c935 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ManageIQ::AutomationEngine -[![Build Status](https://travis-ci.com/ManageIQ/manageiq-automation_engine.svg?branch=master)](https://travis-ci.com/github/ManageIQ/manageiq-automation_engine) +[![CI](https://github.com/ManageIQ/manageiq-automation_engine/actions/workflows/ci.yaml/badge.svg)](https://github.com/ManageIQ/manageiq-automation_engine/actions/workflows/ci.yaml) [![Maintainability](https://api.codeclimate.com/v1/badges/3833d6be49c4abc3e926/maintainability)](https://codeclimate.com/github/ManageIQ/manageiq-automation_engine/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/3833d6be49c4abc3e926/test_coverage)](https://codeclimate.com/github/ManageIQ/manageiq-automation_engine/test_coverage) diff --git a/bin/before_install b/bin/before_install new file mode 100755 index 000000000..03db5bfd8 --- /dev/null +++ b/bin/before_install @@ -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 diff --git a/bin/ci/after_failure b/bin/ci/after_failure deleted file mode 100755 index 51df43bb7..000000000 --- a/bin/ci/after_failure +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -cat ${TRAVIS_BUILD_DIR}/spec/manageiq/log/automation.log diff --git a/bin/ci/after_script b/bin/ci/after_script deleted file mode 100755 index c2a335bcc..000000000 --- a/bin/ci/after_script +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT diff --git a/bin/setup b/bin/setup index 7d8ae6b3c..a5b0a7f32 100755 --- a/bin/setup +++ b/bin/setup @@ -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) diff --git a/manageiq-automation_engine.gemspec b/manageiq-automation_engine.gemspec index 4a67723c6..50ad83922 100644 --- a/manageiq-automation_engine.gemspec +++ b/manageiq-automation_engine.gemspec @@ -21,5 +21,5 @@ Gem::Specification.new do |spec| spec.add_dependency "rubyzip", "~>2.0.0" spec.add_development_dependency "manageiq-style" - spec.add_development_dependency "simplecov" + spec.add_development_dependency "simplecov", ">= 0.21.2" end