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

Update CI #124

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
27 changes: 11 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
name: CI

env:
BUNDLE_WITHOUT: development

on:
push:
branches:
- $default-branch
- master
paths-ignore:
- '**.md'
pull_request:
branches:
- $default-branch
- master
paths-ignore:
- '**.md'

Expand Down Expand Up @@ -54,20 +57,12 @@ jobs:
ZBX_SERVER_HOST: zabbix-server
PHP_TZ: "US/Eastern"
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1 # actions/setup-ruby@v1
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ matrix.ruby }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ matrix.ruby }}-gems-
- name: Bundle install
run: |
gem list --silent -i bundler -v '~> 2' || gem install bundler -v '~> 2' --no-document
bundle config path vendor/bundle
bundle install --without development --jobs 4 --retry 3
bundler-cache: true
- name: Run tests
run: bundle exec rspec ./spec/*
run: bundle exec rake spec
env:
ZABBIX_RUN_ACCEPTANCE: true
24 changes: 15 additions & 9 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,20 @@ RuboCop::RakeTask.new
require 'yard'
YARD::Rake::YardocTask.new

require 'yardstick/rake/measurement'
Yardstick::Rake::Measurement.new do |measurement|
measurement.output = 'measurement/report.txt'
end
task default: [:spec, :rubocop]

require 'yardstick/rake/verify'
Yardstick::Rake::Verify.new do |verify|
verify.threshold = 67.1
end
begin
require 'yardstick/rake/measurement'
Yardstick::Rake::Measurement.new do |measurement|
measurement.output = 'measurement/report.txt'
end

task default: [:spec, :rubocop, :verify_measurements]
require 'yardstick/rake/verify'
Yardstick::Rake::Verify.new do |verify|
verify.threshold = 67.1
end

Rake::Task[:default].enhance(:verify_measurements)
rescue LoadError
# yardstick not present
end
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
require 'zabbixapi'

RSpec.configure do |config|
config.define_derived_metadata(file_path: %r{/spec/acceptance/}) do |metadata|
metadata[:type] = :acceptance
end

# Don't run acceptance tests unless a host is provided
unless (ENV.key?('ZABBIX_HOST_URL') || ENV.key?('ZABBIX_RUN_ACCEPTANCE'))
config.filter_run_excluding type: :acceptance
end
end

def zbx
# settings
@api_url = ENV['ZABBIX_HOST_URL'] || 'http://localhost:8080/api_jsonrpc.php'
Expand Down