Skip to content

Commit

Permalink
Use GitHub Actions for CI.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
philr committed Nov 8, 2021
1 parent e130338 commit 6e11b6e
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 2 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 10 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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).
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6e11b6e

Please sign in to comment.