Skip to content

Commit

Permalink
Merge pull request #687 from johnnyshields/master-fix-tests-windows
Browse files Browse the repository at this point in the history
Master: Fix tests on Windows, add Ruby 3.3, and cleanup CI
  • Loading branch information
pitbulk authored Jul 9, 2024
2 parents e827926 + 0f8da70 commit 6e33ed3
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 34 deletions.
52 changes: 49 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,57 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-latest]
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]
os:
- ubuntu-20.04
- macos-latest
- windows-latest
ruby-version:
- 2.1
- 2.2
- 2.3
- 2.4
- 2.5
- 2.6
- 2.7
- 3.0
- 3.1
- 3.2
- 3.3
- jruby-9.1
- jruby-9.2
- jruby-9.3
- jruby-9.4
- truffleruby
exclude:
- os: macos-latest
ruby-version: 2.1
- os: macos-latest
ruby-version: 2.2
- os: macos-latest
ruby-version: 2.3
- os: macos-latest
ruby-version: 2.4
- os: macos-latest
ruby-version: 2.5
- os: macos-latest
ruby-version: jruby-9.1
- os: macos-latest
ruby-version: jruby-9.2
- os: windows-latest
ruby-version: 2.1
- os: windows-latest
ruby-version: jruby-9.1
- os: windows-latest
ruby-version: jruby-9.2
- os: windows-latest
ruby-version: jruby-9.3
- os: windows-latest
ruby-version: jruby-9.4
- os: windows-latest
ruby-version: truffleruby
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Ruby SAML Changelog

### 1.17.0
* [#687](https://github.com/SAML-Toolkits/ruby-saml/pull/687) Add CI coverage for Ruby 3.3 and Windows.
* [#673](https://github.com/SAML-Toolkits/ruby-saml/pull/673) Add `Settings#sp_cert_multi` paramter to facilitate SP certificate and key rotation.
* [#673](https://github.com/SAML-Toolkits/ruby-saml/pull/673) Support multiple simultaneous SP decryption keys via `Settings#sp_cert_multi` parameter.
* [#673](https://github.com/SAML-Toolkits/ruby-saml/pull/673) Deprecate `Settings#certificate_new` parameter.
Expand Down
24 changes: 2 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,10 @@ We created a demo project for Rails 4 that uses the latest version of this libra

The following Ruby versions are covered by CI testing:

* 2.1.x
* 2.2.x
* 2.3.x
* 2.4.x
* 2.5.x
* 2.6.x
* 2.7.x
* 3.0.x
* 3.1
* 3.2
* JRuby 9.1.x
* JRuby 9.2.x
* JRuby 9.3.X
* JRuby 9.4.0
* Ruby (MRI) 2.1 to 3.3
* JRuby 9.1 to 9.4
* TruffleRuby (latest)

In addition, the following may work but are untested:

* 1.8.7
* 1.9.x
* 2.0.x
* JRuby 1.7.x
* JRuby 9.0.x

## Adding Features, Pull Requests

* Fork the repository
Expand Down
24 changes: 15 additions & 9 deletions lib/onelogin/ruby-saml/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,26 @@ def self.parse_duration(duration, timestamp=Time.now.utc)
matches = duration.match(DURATION_FORMAT)

if matches.nil?
raise Exception.new("Invalid ISO 8601 duration")
raise StandardError.new("Invalid ISO 8601 duration")
end

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

durYears, durMonths, durDays, durHours, durMinutes, durSeconds, durWeeks =
matches[2..8].map { |match| match ? sign * match.tr(',', '.').to_f : 0.0 }

initial_datetime = Time.at(timestamp).utc.to_datetime
final_datetime = initial_datetime.next_year(durYears)
final_datetime = final_datetime.next_month(durMonths)
final_datetime = final_datetime.next_day((7*durWeeks) + durDays)
final_timestamp = final_datetime.to_time.utc.to_i + (durHours * 3600) + (durMinutes * 60) + durSeconds
return final_timestamp
matches[2..8].map do |match|
if match
match = match.tr(',', '.').gsub(/\.0*\z/, '')
sign * (match.include?('.') ? match.to_f : match.to_i)
else
0
end
end

datetime = Time.at(timestamp).utc.to_datetime
datetime = datetime.next_year(durYears)
datetime = datetime.next_month(durMonths)
datetime = datetime.next_day((7*durWeeks) + durDays)
datetime.to_time.utc.to_i + (durHours * 3600) + (durMinutes * 60) + durSeconds
end

# Return a properly formatted x509 certificate
Expand Down

0 comments on commit 6e33ed3

Please sign in to comment.