Use GitHub Actions for CI.

Test on a range of supported Ruby and JRuby versions for TZInfo v1 and
v2, head versions of Ruby and JRuby and the head version of TZInfo.

TZInfo v1 supports Ruby 1.8.7. TZInfo v1 and v2 support JRuby 1.7.
Neither of these versions are tested due to incompatibilies with old
timestamps.
This commit is contained in:
Phil Ross 2021-11-08 18:23:41 +00:00
parent e1303384d9
commit 6e11b6eec0
4 changed files with 85 additions and 2 deletions

73
.github/workflows/tests.yml vendored Normal file
View File

@ -0,0 +1,73 @@
name: Tests
on: [push, pull_request]
jobs:
test:
name: ${{ matrix.ruby }} with TZInfo ${{ matrix.tzinfo }}${{ matrix.name_suffix }}
strategy:
matrix:
ruby: ['1.9.3', '3.0', jruby-9.0, jruby-9.3]
tzinfo: [v1, v2]
name_suffix: ['']
experimental: [false]
include:
- ruby: '3.0'
tzinfo: head
name_suffix: ' (experimental)'
experimental: true
- ruby: head
tzinfo: v1
name_suffix: ' (experimental)'
experimental: true
- ruby: jruby-head
tzinfo: v1
name_suffix: ' (experimental)'
experimental: true
- ruby: head
tzinfo: v2
name_suffix: ' (experimental)'
experimental: true
- ruby: jruby-head
tzinfo: v2
name_suffix: ' (experimental)'
experimental: true
fail-fast: false
runs-on: ubuntu-20.04
continue-on-error: ${{ matrix.experimental }}
env:
TZINFO_GEM: ${{ matrix.tzinfo }}
steps:
- uses: actions/checkout@v2
- if: startsWith(matrix.ruby, 'jruby-9.0')
uses: philr/setup-ruby@legacy-v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- if: ${{ !startsWith(matrix.ruby, 'jruby-9.0') }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: ruby --version
- run: gem --version
- run: bundle --version
- id: determine_tzdata_version
name: Determine tzdata version
run: echo "::set-output name=tzdata_version::`ruby -r bundler/setup -r tzinfo/data -e 'puts TZInfo::Data::Version::TZDATA'`"
- id: determine_os_version
name: Determine OS version
run: |
echo "::set-output name=os::`lsb_release -si`"
echo "::set-output name=os_version::`lsb_release -sr`"
- name: Cache tzdb
uses: actions/cache@v2
with:
path: tzdb
key: tzdb-${{ steps.determine_os_version.outputs.os }}-${{ steps.determine_os_version.outputs.os_version }}-${{ steps.determine_tzdata_version.outputs.tzdata_version }}
restore-keys: |
tzdb-${{ steps.determine_os_version.outputs.os }}-${{ steps.determine_os_version.outputs.os_version }}-
- run: bundle exec rake test
env:
TESTOPTS: --verbose
- run: bundle exec rake tzdb:clean:other

10
Gemfile
View File

@ -2,6 +2,16 @@ source "https://rubygems.org"
gemspec
tzinfo_gem = ENV['TZINFO_GEM']
if tzinfo_gem == 'v1'
gem 'tzinfo', '~> 1'
elsif tzinfo_gem == 'v2'
gem 'tzinfo', '~> 2'
elsif tzinfo_gem == 'head'
gem 'tzinfo', :git => 'https://github.com/tzinfo/tzinfo.git'
end
group :test do
gem 'rake'
gem 'minitest', '~> 5.0'

View File

@ -1,7 +1,7 @@
TZInfo::Data - Timezone Data for TZInfo
=======================================
[![RubyGems](https://img.shields.io/gem/v/tzinfo-data)](https://rubygems.org/gems/tzinfo-data)
[![RubyGems](https://img.shields.io/gem/v/tzinfo-data)](https://rubygems.org/gems/tzinfo-data) [![Tests](https://github.com/tzinfo/tzinfo-data/workflows/Tests/badge.svg?branch=master&event=push)](https://github.com/tzinfo/tzinfo-data/actions?query=workflow%3ATests+branch%3Amaster+event%3Apush)
TZInfo::Data is the public domain [IANA Time Zone Database](https://www.iana.org/time-zones)
packaged as a set of Ruby modules for use with [TZInfo](https://tzinfo.github.io).

View File

@ -415,7 +415,7 @@ directory tzdb_path => TZDB_DIR
attempt = 1
begin
puts "Downloading #{url}"
URI.open(url) do |http|
URI.parse(url).open do |http|
File.open(temp_path, 'wb') do |temp_file|
copy_stream(http, temp_file)
end