From 3044a0ce2bd57b1b03523958b5e40e4d753066d8 Mon Sep 17 00:00:00 2001 From: Cody Cutrer Date: Mon, 16 Dec 2024 12:44:53 -0700 Subject: [PATCH 1/2] Fix semantic tag lookup on Java 21 See also https://github.com/jruby/jruby/issues/8526 Signed-off-by: Cody Cutrer --- lib/openhab/core/items/semantics.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/openhab/core/items/semantics.rb b/lib/openhab/core/items/semantics.rb index e5c4ccf28..73aada1df 100644 --- a/lib/openhab/core/items/semantics.rb +++ b/lib/openhab/core/items/semantics.rb @@ -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 From ff7c23cb75ca7f24cfd78312b68862d52fd62ea4 Mon Sep 17 00:00:00 2001 From: Jimmy Tanagra Date: Mon, 16 Dec 2024 11:40:50 +1000 Subject: [PATCH 2/2] Update CI to openHAB 5 Re-arrange the matrix to use includes instead of excludes, and run 4.3 against Java 17 _and_ 21. Also now that it's easier to list our exact configurations, run older openHABs with the JRuby version they shipped with. Signed-off-by: Jimmy Tanagra Signed-off-by: Cody Cutrer --- .github/workflows/ci.yml | 111 +++++++++++++++++++++++++-------------- 1 file changed, 72 insertions(+), 39 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 08f214e76..dda9d3c41 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: @@ -81,12 +81,26 @@ 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 @@ -94,7 +108,7 @@ jobs: 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: @@ -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' @@ -114,47 +128,56 @@ 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 @@ -162,42 +185,52 @@ jobs: 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 @@ -205,7 +238,7 @@ jobs: 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