From 4c6c53826dfed42b1a9d77f3ab41e110c477ef81 Mon Sep 17 00:00:00 2001 From: Jason Frey Date: Sun, 6 Feb 2022 11:23:55 -0500 Subject: [PATCH] Switch to GitHub Actions --- .github/workflows/ci.yaml | 62 ++++++++++++++++++++++++++++++++ .travis.yml | 46 ------------------------ README.md | 2 +- bin/ci/after_script.sh | 16 --------- bin/ci/before_install.sh | 7 ---- bin/ci/before_script.sh | 7 ---- bin/ci/dead_method_check.sh | 2 +- bin/setup | 22 +++++------- lib/tasks/manageiq/ui_tasks.rake | 4 +-- manageiq-ui-classic.gemspec | 2 +- 10 files changed, 75 insertions(+), 95 deletions(-) create mode 100644 .github/workflows/ci.yaml delete mode 100644 .travis.yml delete mode 100644 bin/ci/after_script.sh delete mode 100644 bin/ci/before_install.sh delete mode 100644 bin/ci/before_script.sh diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 000000000000..915a6d678be2 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,62 @@ +name: CI + +on: [push, pull_request] + +jobs: + ci: + runs-on: ubuntu-latest + strategy: + matrix: + ruby-version: + - '2.7' + node-version: + - 12 + test-suite: + - spec + - spec:routes + - spec:javascript + - spec:compile + - spec:jest + - spec:debride + include: + - ruby-version: '2.6' + node-version: 12 + test-suite: spec + 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: + TEST_SUITE: ${{ matrix.test-suite }} + 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: Set up Node + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + cache: yarn + registry-url: https://npm.manageiq.org/ + - 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 17923cc45cad..000000000000 --- a/.travis.yml +++ /dev/null @@ -1,46 +0,0 @@ ---- -language: ruby -python: '2.7' -rvm: -- 2.6.6 -- 2.7.2 -cache: - bundler: true - yarn: true - timeout: 600 -addons: - postgresql: '10' - chrome: beta -env: - matrix: - - TEST_SUITE=spec - - TEST_SUITE=spec:routes - - TEST_SUITE=spec:javascript - - TEST_SUITE=spec:compile - - TEST_SUITE=spec:jest - - TEST_SUITE=spec:debride -matrix: - exclude: - - rvm: 2.6.6 - env: TEST_SUITE=spec:routes - - rvm: 2.6.6 - env: TEST_SUITE=spec:javascript - - rvm: 2.6.6 - env: TEST_SUITE=spec:compile - - rvm: 2.6.6 - env: TEST_SUITE=spec:jest - - rvm: 2.6.6 - env: TEST_SUITE=spec:debride -bundler_args: "--no-deployment" -before_install: source bin/ci/before_install.sh -install: bin/setup -before_script: source bin/ci/before_script.sh -after_script: source bin/ci/after_script.sh -notifications: - webhooks: - urls: - - https://webhooks.gitter.im/e/9a9f972a1225d28e0f05 - on_success: change - on_failure: always - on_start: never -dist: bionic diff --git a/README.md b/README.md index db3e0c5dec12..acef7d036c50 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # ManageIQ::UI::Classic [![Gem Version](https://badge.fury.io/rb/manageiq-ui-classic.svg)](http://badge.fury.io/rb/manageiq-ui-classic) -[![Build Status](https://travis-ci.com/ManageIQ/manageiq-ui-classic.svg?branch=master)](https://travis-ci.com/github/ManageIQ/manageiq-ui-classic) +[![CI](https://github.com/ManageIQ/manageiq-ui-classic/actions/workflows/ci.yaml/badge.svg)](https://github.com/ManageIQ/manageiq-ui-classic/actions/workflows/ci.yaml) [![Code Climate](https://codeclimate.com/github/ManageIQ/manageiq-ui-classic.svg)](https://codeclimate.com/github/ManageIQ/manageiq-ui-classic) [![Test Coverage](https://codeclimate.com/github/ManageIQ/manageiq-ui-classic/badges/coverage.svg)](https://codeclimate.com/github/ManageIQ/manageiq-ui-classic/coverage) [![Coverage Status](https://coveralls.io/repos/github/ManageIQ/manageiq-ui-classic/badge.svg?branch=master)](https://coveralls.io/github/ManageIQ/manageiq-ui-classic?branch=master) diff --git a/bin/ci/after_script.sh b/bin/ci/after_script.sh deleted file mode 100644 index 193ba21943e8..000000000000 --- a/bin/ci/after_script.sh +++ /dev/null @@ -1,16 +0,0 @@ -# this is *not* used in cross-repo - -(cd spec/manageiq ; git log -1 --oneline) - -if [ "$TEST_SUITE" = "spec:compile" ]; then - # Collapse Travis output https://github.com/travis-ci/travis-ci/issues/2158 - echo "travis_fold:start:GEMFILE_LOCK" - bundle show - echo "travis_fold:end:GEMFILE_LOCK" -fi - -if [ "$TEST_SUITE" = "spec:javascript" ]; then - echo "travis_fold:start:YARN_LOCK" - yarn list - echo "travis_fold:end:YARN_LOCK" -fi diff --git a/bin/ci/before_install.sh b/bin/ci/before_install.sh deleted file mode 100644 index 6e9469adaf32..000000000000 --- a/bin/ci/before_install.sh +++ /dev/null @@ -1,7 +0,0 @@ -if [ "$TEST_SUITE" = "spec:javascript" -o "$TEST_SUITE" = "spec:jest" -o "$TEST_SUITE" = "spec:compile" ]; then - # Check if `nvm` is available as a command or bash function - type nvm >/dev/null 2>&1 - if [ $? -ne 0 ]; then . ~/.nvm/nvm.sh; fi - - nvm install 12 -fi diff --git a/bin/ci/before_script.sh b/bin/ci/before_script.sh deleted file mode 100644 index df36a7a5f3d8..000000000000 --- a/bin/ci/before_script.sh +++ /dev/null @@ -1,7 +0,0 @@ -if [ "$TEST_SUITE" = "spec:javascript" -o "$TEST_SUITE" = "spec:jest" -o "$TEST_SUITE" = "spec:compile" ]; then - # make sure yarn is installed, in the right version - bundle exec rake webpacker:check_yarn || npm install -g yarn - - # install & compile dependencies - bundle exec rake update:ui -fi diff --git a/bin/ci/dead_method_check.sh b/bin/ci/dead_method_check.sh index fe7e4f9a8227..8e4c0926f7b4 100644 --- a/bin/ci/dead_method_check.sh +++ b/bin/ci/dead_method_check.sh @@ -1,5 +1,5 @@ # Run only against PR that is based on master -if [ "$TRAVIS_PULL_REQUEST" != "false" -a "$TRAVIS_BRANCH" = "master" ]; then +if [ "$GITHUB_BASE_REF" = "master" ]; then OLD=`mktemp` NEW=`mktemp` diff --git a/bin/setup b/bin/setup index 7d8ae6b3cbb2..43bb13e7d1b8 100755 --- a/bin/setup +++ b/bin/setup @@ -1,20 +1,14 @@ #!/usr/bin/env ruby -require 'pathname' -require 'fileutils' + +require "pathname" gem_root = Pathname.new(__dir__).join("..") -spec_manageiq = gem_root.join("spec/manageiq") +system(gem_root.join("bin/before_install").to_s) -if ENV.key?("MANAGEIQ_REPO") - manageiq_repo = Pathname.new(ENV["MANAGEIQ_REPO"]) - puts "== Symlinking spec/manageiq to #{manageiq_repo}" +require gem_root.join("spec/manageiq/lib/manageiq/environment") +ManageIQ::Environment.manageiq_plugin_setup(gem_root) - 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" +if %w[spec:compile spec:javascript spec:jest].include?(ENV["TEST_SUITE"]) + puts "\n== Updating UI assets ==" + ManageIQ::Environment.update_ui end - -require gem_root.join("spec/manageiq/lib/manageiq/environment").to_s -ManageIQ::Environment.manageiq_plugin_setup(gem_root) diff --git a/lib/tasks/manageiq/ui_tasks.rake b/lib/tasks/manageiq/ui_tasks.rake index 7f592f1b61c6..5e7f32cd3419 100644 --- a/lib/tasks/manageiq/ui_tasks.rake +++ b/lib/tasks/manageiq/ui_tasks.rake @@ -85,7 +85,7 @@ end # compile and clobber when running assets:* tasks if Rake::Task.task_defined?("assets:precompile") Rake::Task["assets:precompile"].enhance do - Rake::Task["webpack:compile"].invoke unless ENV["TRAVIS"] + Rake::Task["webpack:compile"].invoke unless ENV["CI"] end Rake::Task["assets:precompile"].actions.each do |action| @@ -97,7 +97,7 @@ end if Rake::Task.task_defined?("assets:clobber") Rake::Task["assets:clobber"].enhance do - Rake::Task["webpack:clobber"].invoke unless ENV["TRAVIS"] + Rake::Task["webpack:clobber"].invoke unless ENV["CI"] end Rake::Task["assets:clobber"].actions.each do |action| diff --git a/manageiq-ui-classic.gemspec b/manageiq-ui-classic.gemspec index 284e6879d0f9..8ff9088696e3 100644 --- a/manageiq-ui-classic.gemspec +++ b/manageiq-ui-classic.gemspec @@ -32,7 +32,7 @@ Gem::Specification.new do |s| s.add_development_dependency "guard-rspec", '~> 4.7.3' s.add_development_dependency "manageiq-style" s.add_development_dependency "rails-controller-testing", '~> 1.0.2' - s.add_development_dependency "simplecov" + s.add_development_dependency "simplecov", ">= 0.21.2" # core because jasmine gem depends on major version only, meaning breakages when not the latest s.add_development_dependency "jasmine", "~> 3.4.0"