Adjust groups to reduce test dependencies (#1748)

Switch around the groups defined in the Gemfile to allow execution
without installing additional tools that are useful for development but
not needed for testing or packaging.
This commit is contained in:
Darragh Bailey 2023-08-15 12:19:09 +01:00 committed by GitHub
parent 284b52f57c
commit 1ebfacf979
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 50 deletions

View File

@ -13,6 +13,9 @@ jobs:
matrix: ${{ steps.generate-matrix.outputs.matrix }}
env:
# skip installing development group gems to save time
BUNDLE_WITHOUT: 'development'
BUNDLE_JOBS: 4
NOKOGIRI_USE_SYSTEM_LIBRARIES: true
VAGRANT_VERSION: v2.2.14
@ -27,20 +30,11 @@ jobs:
libvirt-dev \
libz-dev \
;
- uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6.6
- name: Run bundler using cached path
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
bundler-cache: true
- name: Generate matrix
id: generate-matrix
run: |
@ -59,6 +53,9 @@ jobs:
test_name: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
env:
# skip installing development group gems to save time
BUNDLE_WITHOUT: 'development'
BUNDLE_JOBS: 4
NOKOGIRI_USE_SYSTEM_LIBRARIES: true
VAGRANT_VERSION: v2.2.14
@ -91,26 +88,11 @@ jobs:
# add user to group
sudo usermod -a -G libvirt $USER
- uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- uses: actions/cache@v3
with:
path: ~/.vagrant.d/boxes
key: ${{ runner.os }}-${{ env.VAGRANT_VERSION }}
restore-keys: |
${{ runner.os }}-
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6.6
- name: Run bundler using cached path
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
bundler-cache: true
- name: Run tests
run: |
mkdir -p $HOME/.vagrant.d/

View File

@ -25,6 +25,9 @@ jobs:
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
env:
BUNDLE_GEMFILE: ./docs/Gemfile
- name: Install and Build 🔧
# don't allow a close to execute anything from the source code
if: ${{ github.event.action == 'labeled' }}
@ -41,8 +44,7 @@ jobs:
plugin_script_base_path: /${REPO_NAME}/pr-preview/pr-${PR_NUMBER}
EOF
BUNDLE_GEMFILE=./docs/Gemfile bundle install
BUNDLE_GEMFILE=./docs/Gemfile bundle exec jekyll build --source docs/ --baseurl="/${REPO_NAME}/pr-preview/pr-${PR_NUMBER}" --destination build
bundle exec jekyll build --source docs/ --baseurl="/${REPO_NAME}/pr-preview/pr-${PR_NUMBER}" --destination build
- name: Set action
run: |
event_type=$(jq -r ".action" "$GITHUB_EVENT_PATH")

View File

@ -63,20 +63,6 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install libvirt-dev
- uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Set up rubygems
run: |
gem update --system --conservative || (gem i "rubygems-update:~>2.7" --no-document && update_rubygems)
gem update bundler --conservative
- name: Ensure bundle uses https instead of insecure git
run: |
git config --global url."https://github.com/".insteadOf git://github.com/
@ -92,17 +78,22 @@ jobs:
cp .deps/libvirt-ruby/pkg/ruby-libvirt-*.gem vendor/bundle/ruby/3.0.0/cache/
# need the following to allow the local provided gem to be used instead of the
# one from rubygems
bundle config set --local disable_checksum_validation true
- name: Run bundler using cached path
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
echo "BUNDLE_DISABLE_CHECKSUM_VALIDATION=true" >> ${GITHUB_ENV}
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
env:
# skip installing development group gems to save time
BUNDLE_WITHOUT: 'development'
BUNDLE_JOBS: 4
VAGRANT_VERSION: ${{ matrix.vagrant }}
- name: Run tests
run: |
bundle exec rspec --color --format documentation
bundle exec parallel_test spec --type rspec
env:
BUNDLE_WITHOUT: 'development'
VAGRANT_VERSION: ${{ matrix.vagrant }}
- name: Coveralls Parallel
uses: coverallsapp/github-action@master

View File

@ -2,7 +2,7 @@
source 'https://rubygems.org'
group :development do
group :test do
# We depend on Vagrant for development, but we don't add it as a
# gem dependency because we expect to be installed within the
# Vagrant environment itself using `vagrant plugin`.
@ -46,10 +46,11 @@ group :plugins do
gemspec
end
group :test do
group :development do
gem "test-prof", require: false
gem "ruby-prof", ">= 0.17.0", require: false
gem 'stackprof', '>= 0.2.9', require: false
gem 'rubocop', require: false
end
gem 'parallel_tests', group: [:development, :test], require: false

View File

@ -2,6 +2,9 @@
require 'log4r'
require 'vagrant-libvirt/util/erb_template'
require 'vagrant-libvirt/util/storage_util'
module VagrantPlugins
module ProviderLibvirt
module Action

View File

@ -1,5 +1,7 @@
# frozen_string_literal: true
require 'rexml/document'
require_relative '../../spec_helper'
require 'vagrant-libvirt/util/network_util'