Skip to content

Test

Test #234

Workflow file for this run

name: CI
on:
push:
branches:
- 'main'
- 'multi-os'
paths-ignore:
- '.github/**/*.md'
pull_request:
branches:
- 'main'
paths-ignore:
- '.github/**/*.md'
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
java: [ '21', '25' ]
os: [ 'macos-26', 'ubuntu-24.04', 'windows-2025' ]
include:
- primary: false
- java: '21'
os: 'ubuntu-24.04'
primary: true
name: Build (Java ${{ matrix.java }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
# typical duration is ~15min, set twice the amount as limit (default is 6h)
timeout-minutes: 30
steps:
- name: Set up line endings
if: runner.os == 'Windows'
run: |
git config --global core.autocrlf false
git config --global core.eol crlf
- name: Checkout
uses: actions/checkout@v7
- name: Set up Cache
uses: actions/cache@v6
with:
path: |
~/.m2/repository
!~/.m2/repository/org/openhab
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up Java ${{ matrix.java }}
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
- name: Build
id: build
# this target includes spotless, build, test, itest
# (spotless done with build - will add 1 min, but build is faster than sat)
run: >-
java .github/java/MavenBuildRunner.java
--heading "Building all projects"
--log-file "${{ runner.temp }}/build-log-java-${{ matrix.java }}-${{ matrix.os }}.txt"
verify -B -T 1.5C -U
-DskipChecks
env:
MAVEN_OPTS: >-
-Xmx2g
-Dmaven.wagon.http.retryHandler.count=5
-Dmaven.wagon.httpconnectionManager.ttlSeconds=25
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
- name: Upload Build Log
if: ${{ !cancelled() && ((steps.build.outcome == 'success') || (steps.build.outcome == 'failure')) }}
uses: actions/upload-artifact@v7
with:
path: ${{ runner.temp }}/build-log-java-${{ matrix.java }}-${{ matrix.os }}.txt
archive: false
- name: Verify Clean Working Tree
if: ${{ !cancelled() }}
shell: bash
run: |
changes=$(git status --porcelain=v1 --untracked-files=all)
if [[ -n "$changes" ]]; then
count=$(printf '%s\n' "$changes" | wc -l)
count=${count//[[:space:]]/}
else
count=0
fi
echo "Found $count changed files."
echo "::group::Changed files ($count)"
printf '%s\n' "${changes:-No changed files found.}"
echo "::endgroup::"
if [[ -n "$changes" ]]; then
echo "::error::Build changed or created $count file(s)"
exit 1
fi
checks:
strategy:
fail-fast: false
matrix:
type: [ 'SAT', 'JavaDoc' ]
java: [ '21' ]
os: [ 'ubuntu-24.04' ]
name: ${{matrix.type}}
runs-on: ${{ matrix.os }}
# typical duration is ~15min, set twice the amount as limit (default is 6h)
timeout-minutes: 30
env:
MAVEN_OPTS: >-
-Xmx4g
-Dmaven.wagon.http.retryHandler.count=5
-Dmaven.wagon.httpconnectionManager.ttlSeconds=25
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Cache
uses: actions/cache@v6
with:
path: |
~/.m2/repository
!~/.m2/repository/org/openhab
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up Java ${{ matrix.java }}
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
- name: JavaDoc
if: ${{ matrix.type == 'javadoc' }}
id: javadoc
run: >-
java .github/java/MavenBuildRunner.java
--heading "Building JavaDoc"
-B -T 1.25C -U
install javadoc:javadoc javadoc:aggregate
-Dspotless.check.skip=true -Dmaven.test.skip -Dfeatures.verify.skip=true -DskipChecks
- name: Upload JavaDoc
if: ${{ !cancelled() && matrix.type == 'javadoc' && (steps.javadoc.outcome == 'success') }}
uses: actions/upload-artifact@v7
with:
name: javadoc
path: target/site/apidocs/
- name: Register Problem Matchers
if: ${{ matrix.type == 'sat' }}
run: |
echo "::add-matcher::.github/openhab-compile-problems.json"
- name: Static Code Analysis
if: ${{ !cancelled() && matrix.type == 'sat' }}
id: sat
run: >-
java .github/java/MavenBuildRunner.java
--heading "Running Static Code Analysis"
-B -T 1.25C -U
install
-Dspotless.check.skip=true -Dmaven.test.skip -Dfeatures.verify.skip=true
- name: Upload SAT Summary Report
if: ${{ !cancelled() && matrix.type == 'sat' && ((steps.sat.outcome == 'success') || (steps.sat.outcome == 'failure')) }}
uses: actions/upload-artifact@v7
with:
path: target/summary_report.html
archive: false
- name: Report SAT Errors as Annotations
if: ${{ !cancelled() && matrix.type == 'sat' && ((steps.sat.outcome == 'success') || (steps.sat.outcome == 'failure')) }}
uses: ghys/checkstyle-github-action@main
with:
title: CheckStyle Violations
path: '**/checkstyle-result.xml'
mode: inline
- name: Remove Label
if: ${{ always() && github.event.label.name == 'rebuild' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR: ${{ github.event.number }}
run: |
gh pr edit $PR --remove-label rebuild