workflow: add performance workflow and persist performance data
diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml new file mode 100644 index 0000000..5c7ed41 --- /dev/null +++ b/.github/workflows/performance.yml
@@ -0,0 +1,57 @@ +# +# Copyright (c) 2026 Eclipse Foundation and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0 which is available at +# http://www.eclipse.org/legal/epl-2.0, +# or the Eclipse Distribution License v. 1.0 which is available at +# http://www.eclipse.org/org/documents/edl-v10.php. +# +# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause +# + +name: Performance + +on: + schedule: + # Runs every Thursday at 4:35 AM UTC (avoid peak hours for better performance results) + - cron: '35 4 * * 4' + workflow_dispatch: + +jobs: + performance: + name: Run JMH performance tests + runs-on: ubuntu-latest + + steps: + - name: Checkout for performance + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + - name: Set up compile JDK + uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 + with: #Compile java needs to be the highest to ensure proper compilation of the multi-release jar + distribution: 'temurin' + java-version: 17 + cache: 'maven' + - name: Compile API + run: | + mvn -U -C clean install --file api/pom.xml + - name: Run JMH performance tests + run: | + cd perf + mvn -U -B clean package + java -jar target/jsonp-jmh.jar -rf json -rff jmh-result.json + - name: Persist JMH results + uses: benchmark-action/github-action-benchmark@52576c92bccf6ac60c8223ec7eb2565637cae9ba # v1.22.1 + with: + name: Java JMH Benchmark + tool: 'jmh' + output-file-path: perf/jmh-result.json + github-token: ${{ secrets.GITHUB_TOKEN }} + + # Enable deployment to GitHub Pages for continuous line graphs + auto-push: true + comment-on-alert: true # Creates a comment if performance degrades + fail-on-alert: true # Fails the workflow run on regression + alert-threshold: '200%' # Triggers an alert if execution time doubles \ No newline at end of file
diff --git a/.gitignore b/.gitignore index 2858421..32c3c0a 100644 --- a/.gitignore +++ b/.gitignore
@@ -25,5 +25,6 @@ # Java noise *.class *err_pid*.log +dependency-reduced-pom.xml .envrc
diff --git a/perf/src/main/java/jakarta/json/jmh/FactoryTest.java b/perf/src/main/java/jakarta/json/jmh/FactoryTest.java index adff5de..9513520 100644 --- a/perf/src/main/java/jakarta/json/jmh/FactoryTest.java +++ b/perf/src/main/java/jakarta/json/jmh/FactoryTest.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2026 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2026 Contributors to the Eclipse Foundation * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at
diff --git a/perf/src/main/java/jakarta/json/jmh/ThreadTest.java b/perf/src/main/java/jakarta/json/jmh/ThreadTest.java deleted file mode 100644 index a58b84c..0000000 --- a/perf/src/main/java/jakarta/json/jmh/ThreadTest.java +++ /dev/null
@@ -1,3 +0,0 @@ -public class ThreadTest { - -}
diff --git a/perf/src/main/java/jakarta/json/jmh/provider/NoopJsonProvider.java b/perf/src/main/java/jakarta/json/jmh/provider/NoopJsonProvider.java index 333ba81..92ceec3 100644 --- a/perf/src/main/java/jakarta/json/jmh/provider/NoopJsonProvider.java +++ b/perf/src/main/java/jakarta/json/jmh/provider/NoopJsonProvider.java
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2026 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2026 Contributors to the Eclipse Foundation * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -13,7 +13,7 @@ * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 */ -package jakarta.json.jmh; +package jakarta.json.jmh.provider; import jakarta.json.JsonArray; import jakarta.json.JsonArrayBuilder;