Skip to content

Commit 897eb1f

Browse files
authored
Merge pull request #3 from jspanjers/github-actions
GitHub actions
2 parents de2a026 + 42a6154 commit 897eb1f

File tree

8 files changed

+100
-48
lines changed

8 files changed

+100
-48
lines changed

.github/workflows/lint.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Linter
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout rubyzip-bzip2 code
10+
uses: actions/checkout@v2
11+
12+
- name: Install and set up ruby
13+
uses: ruby/setup-ruby@v1
14+
with:
15+
ruby-version: 2.4
16+
bundler-cache: true
17+
18+
- name: Rubocop
19+
run: bundle exec rubocop

.github/workflows/tests.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
strategy:
8+
fail-fast: false
9+
matrix:
10+
os: [ubuntu]
11+
ruby: [2.4, 2.5, 2.6, 2.7, '3.0', head, jruby, jruby-head, truffleruby, truffleruby-head]
12+
include:
13+
- os: macos
14+
ruby: 2.4
15+
- os: windows
16+
ruby: 2.4.10
17+
runs-on: ${{ matrix.os }}-latest
18+
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.os == 'windows' }}
19+
steps:
20+
- name: Checkout rubyzip-bzip2 code
21+
uses: actions/checkout@v2
22+
23+
- name: Install and set up ruby
24+
uses: ruby/setup-ruby@v1
25+
with:
26+
ruby-version: ${{ matrix.ruby }}
27+
bundler-cache: true
28+
29+
- name: Install bzip2 library
30+
if: matrix.os == 'windows'
31+
run: |
32+
wget https://github.com/philr/bzip2-windows/releases/download/v1.0.8.0/bzip2-dll-1.0.8.0-win-x64.zip
33+
Expand-Archive -Path bzip2-dll-1.0.8.0-win-x64.zip -DestinationPath C:\hostedtoolcache\windows\Ruby\${{ matrix.ruby }}\x64\bin
34+
35+
- name: Run the tests
36+
env:
37+
JRUBY_OPTS: --debug
38+
run: bundle exec rake
39+
40+
- name: Coveralls
41+
if: matrix.os == 'ubuntu' && !endsWith(matrix.ruby, 'head')
42+
uses: coverallsapp/github-action@master
43+
with:
44+
github-token: ${{ secrets.github_token }}
45+
flag-name: ${{ matrix.ruby }}
46+
parallel: true
47+
48+
finish:
49+
needs: test
50+
runs-on: ubuntu-latest
51+
steps:
52+
- name: Coveralls Finished
53+
uses: coverallsapp/github-action@master
54+
with:
55+
github-token: ${{ secrets.github_token }}
56+
parallel-finished: true

.simplecov

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
1-
require 'coveralls'
1+
# frozen_string_literal: true
2+
3+
require 'simplecov-lcov'
4+
5+
SimpleCov::Formatter::LcovFormatter.config do |c|
6+
c.output_directory = 'coverage'
7+
c.lcov_file_name = 'lcov.info'
8+
c.report_with_single_file = true
9+
c.single_report_path = 'coverage/lcov.info'
10+
end
11+
12+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
13+
[
14+
SimpleCov::Formatter::HTMLFormatter,
15+
SimpleCov::Formatter::LcovFormatter
16+
]
17+
)
218

3-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
4-
SimpleCov::Formatter::HTMLFormatter,
5-
Coveralls::SimpleCov::Formatter
6-
])
719
SimpleCov.start do
8-
add_filter '/test'
20+
# enable_coverage :branch <-- Re-enable this when we move to ruby ~> 2.5.
21+
add_filter ['/test/', '/samples/']
922
end

.travis.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# rubyzip-bzip2
22

33
[![Gem Version](https://badge.fury.io/rb/rubyzip-bzip2.svg)](http://badge.fury.io/rb/rubyzip-bzip2)
4-
[![Build Status](https://secure.travis-ci.org/rubyzip/rubyzip-bzip2.svg)](http://travis-ci.org/rubyzip/rubyzip-bzip2)
4+
[![Tests](https://github.com/rubyzip/rubyzip-bzip2/actions/workflows/tests.yml/badge.svg)](https://github.com/rubyzip/rubyzip-bzip2/actions/workflows/tests.yml)
5+
[![Linter](https://github.com/rubyzip/rubyzip-bzip2/actions/workflows/lint.yml/badge.svg)](https://github.com/rubyzip/rubyzip-bzip2/actions/workflows/lint.yml)
56
[![Code Climate](https://codeclimate.com/github/rubyzip/rubyzip-bzip2.svg)](https://codeclimate.com/github/rubyzip/rubyzip-bzip2)
67
[![Coverage Status](https://img.shields.io/coveralls/rubyzip/rubyzip-bzip2.svg)](https://coveralls.io/r/rubyzip/rubyzip-bzip2?branch=master)
78

rubyzip-bzip2.gemspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ Gem::Specification.new do |spec|
3333
spec.add_dependency 'ffi', '~> 1.0'
3434
spec.add_dependency 'rubyzip', '~> 2.2'
3535

36-
spec.add_development_dependency 'coveralls', '~> 0.7'
3736
spec.add_development_dependency 'guard'
3837
spec.add_development_dependency 'guard-minitest'
3938
spec.add_development_dependency 'minitest', '~> 5.4'
4039
spec.add_development_dependency 'pry', '~> 0.10'
4140
spec.add_development_dependency 'rake', '~> 10.3'
4241
spec.add_development_dependency 'rubocop', '~> 0.79.0'
42+
spec.add_development_dependency 'simplecov', '~> 0.18.0'
43+
spec.add_development_dependency 'simplecov-lcov', '~> 0.8'
4344
end

test/models/zip/bzip2/decompress_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ def file_text
4747
end
4848

4949
def compressed_data
50-
@compressed_data ||= File.open(BZIP2_FILE, &:read)
50+
@compressed_data ||= File.open(BZIP2_FILE, 'rb', &:read)
5151
end
5252
end

test/models/zip/bzip2/libbz2_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,6 @@ def file_text
7878
end
7979

8080
def compressed_data
81-
@compressed_data ||= File.open(BZIP2_FILE, &:read)
81+
@compressed_data ||= File.open(BZIP2_FILE, 'rb', &:read)
8282
end
8383
end

0 commit comments

Comments
 (0)