Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to GitHub Actions #27

Merged
merged 1 commit into from
Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI

on:
push:
pull_request:
schedule:
- cron: '0 0 * * 0'

jobs:
ci:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version:
- '2.5'
- '2.6'
- '2.7'
- '3.0'
vddk-version:
- '5.5.0'
- '6.7.0'
env:
LD_LIBRARY_PATH: spec/ext
VDDK_VERSION: ${{ matrix.vddk-version }}
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
steps:
- uses: actions/checkout@v2
- 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 == '3.0' }}
continue-on-error: true
uses: paambaati/codeclimate-action@v3.0.0
1 change: 0 additions & 1 deletion .rspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
--require spec_helper
--color
--order random
--format documentation
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# ffi-vix_disk_lib

[![Gem Version](https://badge.fury.io/rb/ffi-vix_disk_lib.svg)](http://badge.fury.io/rb/ffi-vix_disk_lib)
[![Code Climate](http://img.shields.io/codeclimate/github/ManageIQ/ffi-vix_disk_lib.svg)](https://codeclimate.com/github/ManageIQ/ffi-vix_disk_lib)
[![Dependency Status](https://gemnasium.com/ManageIQ/ffi-vix_disk_lib.svg)](https://gemnasium.com/ManageIQ/ffi-vix_disk_lib)
[![CI](https://github.com/ManageIQ/ffi-vix_disk_lib/actions/workflows/ci.yaml/badge.svg)](https://github.com/ManageIQ/ffi-vix_disk_lib/actions/workflows/ci.yaml)
[![Code Climate](https://codeclimate.com/github/ManageIQ/ffi-vix_disk_lib.svg)](https://codeclimate.com/github/ManageIQ/ffi-vix_disk_lib)
[![Test Coverage](https://codeclimate.com/github/ManageIQ/ffi-vix_disk_lib/badges/coverage.svg)](https://codeclimate.com/github/ManageIQ/ffi-vix_disk_lib/coverage)

Ruby FFI Binding to VMware VixDiskLib.

Expand Down
7 changes: 7 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)

echo "Building spec/ext/libvixDiskLib.so..."
make -C "$SCRIPT_DIR/../spec/ext"
echo "Building spec/ext/libvixDiskLib.so...Complete"
5 changes: 3 additions & 2 deletions ffi-vix_disk_lib.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ Gem::Specification.new do |spec|
spec.test_files = `git ls-files -- spec/*`.split("\n")
spec.require_paths = ["lib"]

spec.add_dependency "ffi"

spec.add_development_dependency "bundler"
spec.add_development_dependency "manageiq-style"
spec.add_development_dependency "rake"
spec.add_development_dependency "rspec"

spec.add_dependency "ffi"
spec.add_development_dependency "simplecov", ">= 0.21.2"
end
5 changes: 3 additions & 2 deletions lib/ffi-vix_disk_lib/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ def self.load_error
candidate_versions = %w[7.0.1 7.0.0 6.7.3 6.7.2 6.7.1 6.7.0 6.5.4 6.5.3 6.5.2 6.5.1 6.5.0 6.0.3 6.0.2 6.0.1 6.0.0 5.5.4 5.5.2 5.5.1 5.5.0 5.1.3 5.1.2 5.1.1 5.1.0 5.0.4 5.0.0 1.2.0 1.1.2]
candidate_libraries = candidate_versions.map { |v| "vixDiskLib.so.#{v}" }

# LD_LIBRARY_PATH is not honored on Mac, so build our own rudimentary version
if RbConfig::CONFIG["host_os"] =~ /darwin/ && (env = ENV["LD_LIBRARY_PATH"] || ENV["DYLD_LIBRARY_PATH"])
# LD_LIBRARY_PATH/DYLD_LIBRARY_PATH is not passed to child process on a Mac with SIP
# enabled, so build our own rudimentary version based on a different name
if RbConfig::CONFIG["host_os"] =~ /darwin/ && (env = ENV["LIBRARY_PATH"])
candidate_libraries = candidate_libraries.product(env.split(":")).flat_map do |n, p|
[
File.join(p, n),
Expand Down
11 changes: 10 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
ENV["LD_LIBRARY_PATH"] ||= File.expand_path("ext", __dir__)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line was here for the Mac, but on newer Mac versions, it doesn't do anything anyway because of the SIP stuff.

Even so, I expected this to work on Linux, and I have no idea why you need to pass LD_LIBRARY_PATH manually. I guess that's something we can solve another day.

if ENV['CI']
require 'simplecov'
SimpleCov.start
end

# LD_LIBRARY_PATH/DYLD_LIBRARY_PATH is not passed to child process on a Mac with SIP
# enabled, so build our own rudimentary version based on a different name
ENV["LIBRARY_PATH"] ||= File.expand_path("ext", __dir__) if RbConfig::CONFIG["host_os"] =~ /darwin/

require 'ffi-vix_disk_lib'
puts
puts "\e[93mUsing libvixDiskLib #{FFI::VixDiskLib::API::VERSION}\e[0m"

RSpec.configure do |config|
end