Skip to content

restrict fog-core version to ~> 2.5.0 #1

restrict fog-core version to ~> 2.5.0

restrict fog-core version to ~> 2.5.0 #1

name: Integration Tests
on:
push:
branches:
- main
pull_request:
paths-ignore:
- 'docs/**'
- '.github/workflows/publish-documentation*'
- '.github/workflows/deploy-docs*'
jobs:
generate-matrix:
runs-on: ubuntu-latest
outputs:
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
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up libvirt for test generation
run: |
sudo apt-get update
sudo apt-get install -y \
libvirt-dev \
libz-dev \
;
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6.6
bundler-cache: true
- name: Generate matrix
id: generate-matrix
run: |
bundle exec rspec --color --format json --fail-fast --dry-run --tag acceptance --out report.json
tests="$(jq -c '[.examples[].full_description]' report.json)"
echo "matrix=${tests}" >> ${GITHUB_OUTPUT}
run-tests:
needs: generate-matrix
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
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
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up libvirt
run: |
sudo apt-get update
sudo apt-get install -y \
bridge-utils \
dnsmasq-base \
ebtables \
libarchive-tools \
libguestfs-tools \
libvirt-clients \
libvirt-daemon \
libvirt-daemon-system \
qemu-kvm \
qemu-utils \
;
sudo apt-get install -y \
libvirt-dev \
libz-dev \
;
# start daemon
sudo systemctl start libvirtd
# add user to group
sudo usermod -a -G libvirt $USER
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6.6
bundler-cache: true
- name: Run tests
run: |
mkdir -p $HOME/.vagrant.d/
# use software emulation due to lack of nested emulation
cat <<EOF > $HOME/.vagrant.d/Vagrantfile
Vagrant.configure("2") do |config|
config.vm.provider :libvirt do |libvirt|
libvirt.driver = "qemu"
end
end
EOF
# tell integration tests to use boxes from the cached location
# and also to load the above Vagrantfile. This is done because
# sg will not inherit env vars, so it's necessary to set them
# in a script that sg runs before calling bundle.
cat <<EOF > script.bash
#!/bin/bash
#
export VAGRANT_LIBVIRT_VAGRANT_HOME=$HOME/.vagrant.d
bundle exec rspec --color --fail-fast --tag acceptance -e '${{ matrix.test_name }}'
EOF
chmod a+x script.bash
# run script under libvirt group
sg libvirt -c ./script.bash