mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Bundler for older ruby versions uses anonymous git to clone ruby dependencies directly from repos. Ensure these all use https by configuring git to replace the URL automatically.
136 lines
4.2 KiB
YAML
136 lines
4.2 KiB
YAML
# This workflow uses actions that are not certified by GitHub.
|
|
# They are provided by a third-party and are governed by
|
|
# separate terms of service, privacy policy, and support
|
|
# documentation.
|
|
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
|
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
|
|
|
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
|
|
jobs:
|
|
test:
|
|
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
VAGRANT_LIBVIRT_REQUIRE_SIMPLECOV: "true"
|
|
continue-on-error: ${{ matrix.allow_fail }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
# need to define one entry with a single entry for each of the options
|
|
# to allow include to expand the matrix correctly.
|
|
ruby: [2.6.6]
|
|
vagrant: [main]
|
|
allow_fail: [true]
|
|
include:
|
|
- ruby: 2.2.10
|
|
vagrant: v2.0.4
|
|
allow_fail: false
|
|
- ruby: 2.3.5
|
|
vagrant: v2.1.5
|
|
allow_fail: false
|
|
- ruby: 2.4.10
|
|
vagrant: v2.2.4
|
|
allow_fail: false
|
|
- ruby: 2.6.6
|
|
vagrant: v2.2.14
|
|
allow_fail: false
|
|
- ruby: 3.0.0
|
|
vagrant:
|
|
allow_fail: false
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Clone vagrant for ruby 3.0 support
|
|
if: ${{ matrix.ruby == '3.0.0' }}
|
|
uses: actions/checkout@v2
|
|
with:
|
|
repository: hashicorp/vagrant
|
|
path: .deps/vagrant
|
|
ref: f7973f00edb9438d0b36085f210c80af71cfe5c5
|
|
- name: Clone ruby-libvirt for ruby 3.0 support
|
|
if: ${{ matrix.ruby == '3.0.0' }}
|
|
uses: actions/checkout@v2
|
|
with:
|
|
repository: libvirt/libvirt-ruby
|
|
path: .deps/libvirt-ruby
|
|
ref: 43444be184e4d877c5ce110ee5475c952d7590f7
|
|
- name: Set up libvirt
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install libvirt-dev
|
|
- uses: actions/cache@v2
|
|
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/
|
|
- name: Handle additional ruby 3.0 setup
|
|
if: ${{ matrix.ruby == '3.0.0' }}
|
|
run: |
|
|
# ensure vagrant gemspec allows ruby 3.0
|
|
pushd .deps/vagrant/
|
|
# ensure main branch exists
|
|
git checkout -b main
|
|
sed -i -e 's@s.required_ruby_version.*=.*@s.required_ruby_version = "~> 3.0"@' vagrant.gemspec
|
|
popd
|
|
|
|
bundle config local.vagrant ${PWD}/.deps/vagrant/
|
|
|
|
# build gem of latest bindings that contain fix for ruby include path
|
|
pushd .deps/libvirt-ruby
|
|
rake gem
|
|
popd
|
|
|
|
mkdir -p vendor/bundle/ruby/3.0.0/cache/
|
|
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
|
|
env:
|
|
VAGRANT_VERSION: ${{ matrix.vagrant }}
|
|
- name: Run tests
|
|
run: |
|
|
bundle exec rspec --color --format documentation
|
|
env:
|
|
VAGRANT_VERSION: ${{ matrix.vagrant }}
|
|
- name: Coveralls Parallel
|
|
uses: coverallsapp/github-action@master
|
|
with:
|
|
github-token: ${{ secrets.github_token }}
|
|
parallel: true
|
|
path-to-lcov: ./coverage/lcov.info
|
|
|
|
finish:
|
|
needs: test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Coveralls Finished
|
|
uses: coverallsapp/github-action@master
|
|
with:
|
|
github-token: ${{ secrets.github_token }}
|
|
parallel-finished: true
|