Skip to content

Commit 6e33ed3

Browse files
authored
Merge pull request #687 from johnnyshields/master-fix-tests-windows
Master: Fix tests on Windows, add Ruby 3.3, and cleanup CI
2 parents e827926 + 0f8da70 commit 6e33ed3

File tree

4 files changed

+67
-34
lines changed

4 files changed

+67
-34
lines changed

.github/workflows/test.yml

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,57 @@ jobs:
88
strategy:
99
fail-fast: false
1010
matrix:
11-
os: [ubuntu-20.04, macos-latest]
12-
ruby-version: [2.1.9, 2.2.10, 2.3.8, 2.4.6, 2.5.8, 2.6.6, 2.7.2, 3.0.1, 3.1, 3.2, jruby-9.1.17.0, jruby-9.2.17.0, jruby-9.3.2.0, jruby-9.4.0.0, truffleruby]
11+
os:
12+
- ubuntu-20.04
13+
- macos-latest
14+
- windows-latest
15+
ruby-version:
16+
- 2.1
17+
- 2.2
18+
- 2.3
19+
- 2.4
20+
- 2.5
21+
- 2.6
22+
- 2.7
23+
- 3.0
24+
- 3.1
25+
- 3.2
26+
- 3.3
27+
- jruby-9.1
28+
- jruby-9.2
29+
- jruby-9.3
30+
- jruby-9.4
31+
- truffleruby
32+
exclude:
33+
- os: macos-latest
34+
ruby-version: 2.1
35+
- os: macos-latest
36+
ruby-version: 2.2
37+
- os: macos-latest
38+
ruby-version: 2.3
39+
- os: macos-latest
40+
ruby-version: 2.4
41+
- os: macos-latest
42+
ruby-version: 2.5
43+
- os: macos-latest
44+
ruby-version: jruby-9.1
45+
- os: macos-latest
46+
ruby-version: jruby-9.2
47+
- os: windows-latest
48+
ruby-version: 2.1
49+
- os: windows-latest
50+
ruby-version: jruby-9.1
51+
- os: windows-latest
52+
ruby-version: jruby-9.2
53+
- os: windows-latest
54+
ruby-version: jruby-9.3
55+
- os: windows-latest
56+
ruby-version: jruby-9.4
57+
- os: windows-latest
58+
ruby-version: truffleruby
1359
runs-on: ${{ matrix.os }}
1460
steps:
15-
- uses: actions/checkout@v2
61+
- uses: actions/checkout@v4
1662
- name: Set up Ruby ${{ matrix.ruby-version }}
1763
uses: ruby/setup-ruby@v1
1864
with:

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Ruby SAML Changelog
22

33
### 1.17.0
4+
* [#687](https://github.com/SAML-Toolkits/ruby-saml/pull/687) Add CI coverage for Ruby 3.3 and Windows.
45
* [#673](https://github.com/SAML-Toolkits/ruby-saml/pull/673) Add `Settings#sp_cert_multi` paramter to facilitate SP certificate and key rotation.
56
* [#673](https://github.com/SAML-Toolkits/ruby-saml/pull/673) Support multiple simultaneous SP decryption keys via `Settings#sp_cert_multi` parameter.
67
* [#673](https://github.com/SAML-Toolkits/ruby-saml/pull/673) Deprecate `Settings#certificate_new` parameter.

README.md

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,10 @@ We created a demo project for Rails 4 that uses the latest version of this libra
2222

2323
The following Ruby versions are covered by CI testing:
2424

25-
* 2.1.x
26-
* 2.2.x
27-
* 2.3.x
28-
* 2.4.x
29-
* 2.5.x
30-
* 2.6.x
31-
* 2.7.x
32-
* 3.0.x
33-
* 3.1
34-
* 3.2
35-
* JRuby 9.1.x
36-
* JRuby 9.2.x
37-
* JRuby 9.3.X
38-
* JRuby 9.4.0
25+
* Ruby (MRI) 2.1 to 3.3
26+
* JRuby 9.1 to 9.4
3927
* TruffleRuby (latest)
4028

41-
In addition, the following may work but are untested:
42-
43-
* 1.8.7
44-
* 1.9.x
45-
* 2.0.x
46-
* JRuby 1.7.x
47-
* JRuby 9.0.x
48-
4929
## Adding Features, Pull Requests
5030

5131
* Fork the repository

lib/onelogin/ruby-saml/utils.rb

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,26 @@ def self.parse_duration(duration, timestamp=Time.now.utc)
6969
matches = duration.match(DURATION_FORMAT)
7070

7171
if matches.nil?
72-
raise Exception.new("Invalid ISO 8601 duration")
72+
raise StandardError.new("Invalid ISO 8601 duration")
7373
end
7474

7575
sign = matches[1] == '-' ? -1 : 1
7676

7777
durYears, durMonths, durDays, durHours, durMinutes, durSeconds, durWeeks =
78-
matches[2..8].map { |match| match ? sign * match.tr(',', '.').to_f : 0.0 }
79-
80-
initial_datetime = Time.at(timestamp).utc.to_datetime
81-
final_datetime = initial_datetime.next_year(durYears)
82-
final_datetime = final_datetime.next_month(durMonths)
83-
final_datetime = final_datetime.next_day((7*durWeeks) + durDays)
84-
final_timestamp = final_datetime.to_time.utc.to_i + (durHours * 3600) + (durMinutes * 60) + durSeconds
85-
return final_timestamp
78+
matches[2..8].map do |match|
79+
if match
80+
match = match.tr(',', '.').gsub(/\.0*\z/, '')
81+
sign * (match.include?('.') ? match.to_f : match.to_i)
82+
else
83+
0
84+
end
85+
end
86+
87+
datetime = Time.at(timestamp).utc.to_datetime
88+
datetime = datetime.next_year(durYears)
89+
datetime = datetime.next_month(durMonths)
90+
datetime = datetime.next_day((7*durWeeks) + durDays)
91+
datetime.to_time.utc.to_i + (durHours * 3600) + (durMinutes * 60) + durSeconds
8692
end
8793

8894
# Return a properly formatted x509 certificate

0 commit comments

Comments
 (0)