Skip to content

Commit

Permalink
Added GitHub Action
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Dec 8, 2020
1 parent d2a87a5 commit d43d7d8
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 7 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@

# See https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions

name: CI

on: [push, pull_request]

jobs:
Tests:
runs-on: ubuntu-latest
container: registry.opensuse.org/yast/head/containers/yast-ruby:latest

steps:

- name: Git Checkout
uses: actions/checkout@v2

- name: Install Dependencies
run: zypper --non-interactive install --no-recommends yast2-dns-server

# just for easier debugging...
- name: Inspect Installed Packages
run: rpm -qa | sort

- name: Unit Tests
run: rake test:unit
# enable code coverage reporting
env:
COVERAGE: 1

# send the coverage report to coveralls.io
- name: Coveralls Report
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

# FIXME: Rubocop not used
# Rubocop:
# runs-on: ubuntu-latest
# container: registry.opensuse.org/yast/head/containers/yast-ruby:latest

# steps:

# - name: Git Checkout
# uses: actions/checkout@v2

# - name: Rubocop
# run: rake check:rubocop

Package:
runs-on: ubuntu-latest
container: registry.opensuse.org/yast/head/containers/yast-ruby:latest

steps:

- name: Git Checkout
uses: actions/checkout@v2

- name: Package Build
run: yast-ci-ruby -o package

Yardoc:
runs-on: ubuntu-latest
container: registry.opensuse.org/yast/head/containers/yast-ruby:latest

steps:

- name: Git Checkout
uses: actions/checkout@v2

- name: Yardoc
# FIXME: fix the yardoc warnings and use "rake check:doc" here
run: yardoc

# downloading the Docker image takes some time so bundling several fast
# checks into one job avoids that overhead
Checks:
runs-on: ubuntu-latest
container: registry.opensuse.org/yast/head/containers/yast-ruby:latest

steps:

- name: Git Checkout
uses: actions/checkout@v2

- name: Perl Syntax
run: yast-ci-ruby -o perl_syntax

- name: POT Check
run: rake check:pot
28 changes: 21 additions & 7 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@
# Ensure the tests runs with english locales
ENV["LC_ALL"] = "en_US.UTF-8"

RSpec.configure do |c|
c.extend Yast::I18n # available in context/describe
c.include Yast::I18n
RSpec.configure do |config|
config.extend Yast::I18n # available in context/describe
config.include Yast::I18n

config.mock_with :rspec do |c|
# make sure we mock only the existing methods
# https://relishapp.com/rspec/rspec-mocks/v/3-0/docs/verifying-doubles/partial-doubles
c.verify_partial_doubles = true
end
end

if ENV["COVERAGE"]
Expand All @@ -22,12 +28,20 @@
# track all ruby files under src
SimpleCov.track_files("#{srcdir}/**/*.rb")

# use coveralls for on-line code coverage reporting at Travis CI
if ENV["TRAVIS"]
require "coveralls"
# additionally use the LCOV format for on-line code coverage reporting at CI
if ENV["CI"] || ENV["COVERAGE_LCOV"]
require "simplecov-lcov"

SimpleCov::Formatter::LcovFormatter.config do |c|
c.report_with_single_file = true
# this is the default Coveralls GitHub Action location
# https://github.com/marketplace/actions/coveralls-github-action
c.single_report_path = "coverage/lcov.info"
end

SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
SimpleCov::Formatter::LcovFormatter
]
end
end

0 comments on commit d43d7d8

Please sign in to comment.