Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix semantic tag lookup on Java 21 #370

Merged
merged 2 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 72 additions & 39 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ jobs:
(bin/yard stats -c | grep "100.00% documented")
bin/validate_yard_links

openhab-matrix:
openhab-snapshot-date:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"
outputs:
openhab_matrix: |
["3.4.5", "4.0.4", "4.1.3", "4.2.3", "4.3.0.M5", "4.3.0-SNAPSHOT"]
["3.4.5", "4.0.4", "4.1.3", "4.2.3", "4.3.0", "5.0.0-SNAPSHOT"]
snapshot_date: |
${{ steps.snapshot-date.outputs.SNAPSHOT_DATE }}
steps:
Expand All @@ -81,20 +81,34 @@ jobs:
echo SNAPSHOT_DATE=$(date -u +-%Y%m%d) >> $GITHUB_OUTPUT

openhab-setup:
needs: openhab-matrix
needs: openhab-snapshot-date
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"
strategy:
matrix:
openhab_version: ${{ fromJson(needs.openhab-matrix.outputs.openhab_matrix) }}
include:
- java_version: 11
openhab_version: 3.4.5
- java_version: 17
openhab_version: 4.0.4
- java_version: 17
openhab_version: 4.1.3
- java_version: 17
openhab_version: 4.2.3
- java_version: 17
openhab_version: 4.3.0
- java_version: 21
openhab_version: 4.3.0
- java_version: 21
openhab_version: 5.0.0-SNAPSHOT
steps:
- uses: actions/checkout@v4
- name: Cache openHAB setup
id: cache
uses: actions/cache@v4
with:
path: tmp/
key: openHAB-setup-${{ matrix.openhab_version }}${{ endsWith(matrix.openhab_version, 'SNAPSHOT') && needs.openhab-matrix.outputs.snapshot_date || '' }}
key: openHAB-setup-${{ matrix.openhab_version }}${{ endsWith(matrix.openhab_version, 'SNAPSHOT') && needs.openhab-snapshot-date.outputs.snapshot_date || '' }}-java-${{ matrix.java_version }}
- uses: ruby/setup-ruby@v1
if: steps.cache.outputs.cache-hit != 'true'
with:
Expand All @@ -103,7 +117,7 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: ${{ startsWith(matrix.openhab_version, '4.') && '17' || '11' }}
java-version: ${{ matrix.java_version }}
java-package: jre
- name: Setup openHAB
if: steps.cache.outputs.cache-hit != 'true'
Expand All @@ -114,98 +128,117 @@ jobs:
uses: actions/upload-artifact@v4
if: steps.cache.outputs.cache-hit != 'true' && failure()
with:
name: openHAB-setup-logs-${{ matrix.openhab_version }}
name: openHAB-setup-logs-${{ matrix.openhab_version }}-java-${{ matrix.java_version }}
path: |
tmp/openhab/userdata/logs
tmp/karaf.log
retention-days: 2

rspec:
needs: [openhab-matrix, openhab-setup]
needs: [openhab-snapshot-date, openhab-setup]
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"
strategy:
matrix:
openhab_version: ${{ fromJson(needs.openhab-matrix.outputs.openhab_matrix) }}
jruby_version: ["jruby-9.3.10.0", "jruby-9.4.9.0"]
exclude:
- openhab_version: 4.0.4
jruby_version: jruby-9.3.10.0
- openhab_version: 4.1.3
jruby_version: jruby-9.3.10.0
- openhab_version: 4.2.3
jruby_version: jruby-9.3.10.0
- openhab_version: 4.3.0.M5
jruby_version: jruby-9.3.10.0
- openhab_version: 4.3.0-SNAPSHOT
include:
- java_version: 11
jruby_version: jruby-9.3.10.0
openhab_version: 3.4.5
- java_version: 17
jruby_version: jruby-9.4.2.0
openhab_version: 4.0.4
- java_version: 17
jruby_version: jruby-9.4.5.0
openhab_version: 4.1.3
- java_version: 17
jruby_version: jruby-9.4.6.0
openhab_version: 4.2.3
- java_version: 17
jruby_version: jruby-9.4.9.0
openhab_version: 4.3.0
- java_version: 21
jruby_version: jruby-9.4.9.0
openhab_version: 4.3.0
- java_version: 21
jruby_version: jruby-9.4.9.0
openhab_version: 5.0.0-SNAPSHOT
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.jruby_version }}
bundler-cache: true
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: ${{ startsWith(matrix.openhab_version, '4.') && '17' || '11' }}
java-version: ${{ matrix.java_version }}
java-package: jre
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.jruby_version }}
bundler-cache: true
- name: Restore openHAB setup
uses: actions/cache@v4
with:
path: tmp/
key: openHAB-setup-${{ matrix.openhab_version }}${{ endsWith(matrix.openhab_version, 'SNAPSHOT') && needs.openhab-matrix.outputs.snapshot_date || '' }}
key: openHAB-setup-${{ matrix.openhab_version }}${{ endsWith(matrix.openhab_version, 'SNAPSHOT') && needs.openhab-snapshot-date.outputs.snapshot_date || '' }}-java-${{ matrix.java_version }}
- name: RSpec
run: bin/rspec --format progress --format html --out rspec.html
timeout-minutes: 6
- name: Upload openHAB Logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: RSpec-logs-${{ matrix.openhab_version }}-${{ matrix.jruby_version }}
name: RSpec-logs-${{ matrix.openhab_version }}-${{ matrix.jruby_version }}-java-${{ matrix.java_version }}
path: tmp/openhab/userdata/logs
retention-days: 2
- name: Upload RSpec results
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: RSpec-results-openHAB-${{ matrix.openhab_version }}-jruby-${{ matrix.jruby_version }}
name: RSpec-results-openHAB-${{ matrix.openhab_version }}-jruby-${{ matrix.jruby_version }}-java-${{ matrix.java_version }}
path: rspec.html

cucumber:
needs: [openhab-matrix, openhab-setup]
needs: [openhab-snapshot-date, openhab-setup]
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip')"
strategy:
matrix:
openhab_version: ${{ fromJson(needs.openhab-matrix.outputs.openhab_matrix) }}
exclude:
- openhab_version: 3.4.5
include:
- java_version: 17
openhab_version: 4.0.4
- java_version: 17
openhab_version: 4.1.3
- java_version: 17
openhab_version: 4.2.3
- java_version: 17
openhab_version: 4.3.0
- java_version: 21
openhab_version: 4.3.0
- java_version: 21
openhab_version: 5.0.0-SNAPSHOT
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: ${{ matrix.java_version }}
java-package: jre
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true
rubygems: 3.4.22
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: ${{ startsWith(matrix.openhab_version, '4.') && '17' || '11' }}
java-package: jre
- name: Restore openHAB setup
uses: actions/cache@v4
with:
path: tmp/
key: openHAB-setup-${{ matrix.openhab_version }}${{ endsWith(matrix.openhab_version, 'SNAPSHOT') && needs.openhab-matrix.outputs.snapshot_date || '' }}
key: openHAB-setup-${{ matrix.openhab_version }}${{ endsWith(matrix.openhab_version, 'SNAPSHOT') && needs.openhab-snapshot-date.outputs.snapshot_date || '' }}-java-${{ matrix.java_version }}
- name: Cucumber
run: bin/rake features
timeout-minutes: 4
- name: Upload openHAB Logs
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: Cucumber-logs-openHAB-${{ matrix.openhab_version }}
name: Cucumber-logs-openHAB-${{ matrix.openhab_version }}-java-${{ matrix.java_version }}
path: |
tmp/openhab/userdata/logs
tmp/karaf.log
Expand Down
4 changes: 3 additions & 1 deletion lib/openhab/core/items/semantics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,9 @@ def lookup(id, locale = java.util.Locale.default)

# @deprecated OH3.4 missing registry
if Provider.registry
tag_class = service.get_by_label_or_synonym(id, locale).first ||
tag = service.get_by_label_or_synonym(id, locale)
tag = nil if tag&.empty?
tag_class = tag&.first ||
Provider.registry.get_tag_class_by_id(id)
return unless tag_class

Expand Down
Loading