Skip to content

chore(release): dotpromptz-handlebars 0.1.9 #886

chore(release): dotpromptz-handlebars 0.1.9

chore(release): dotpromptz-handlebars 0.1.9 #886

Workflow file for this run

# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
name: Java checks
on:
push:
branches:
- main
pull_request:
branches: [ main ]
jobs:
check-paths:
runs-on: ubuntu-latest
outputs:
any_changed: ${{ steps.changed-files.outputs.any_changed }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: |
java/**
spec/**
.github/workflows/java.yml
format-check:
needs: check-paths
if: needs.check-paths.outputs.any_changed == 'true'
runs-on: ubuntu-latest
name: Java Format Check
steps:
- uses: actions/checkout@v6
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: '21'
distribution: 'temurin'
- name: Download google-java-format
run: |
mkdir -p .cache
curl -fL "https://github.com/google/google-java-format/releases/download/v1.27.0/google-java-format-1.27.0-all-deps.jar" \
-o .cache/google-java-format.jar
- name: Check Java formatting
run: |
JAVA_FILES=$(find java -name "*.java" -type f)
if [ -n "${JAVA_FILES}" ]; then
echo "Checking formatting for Java files..."
java -jar .cache/google-java-format.jar --dry-run --set-exit-if-changed ${JAVA_FILES}
echo "✅ All Java files are properly formatted."
else
echo "No Java files found."
fi
tests:
runs-on: ubuntu-latest
needs: [check-paths, format-check]
if: needs.check-paths.outputs.any_changed == 'true'
strategy:
matrix:
java-version: ['17', '21', '23', '24']
fail-fast: false
name: Java ${{ matrix.java-version }} Tests
steps:
- uses: actions/checkout@v6
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v5
with:
java-version: ${{ matrix.java-version }}
distribution: 'temurin'
- name: Setup Bazel
uses: bazel-contrib/setup-bazel@0.18.0
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}-java${{ matrix.java-version }}
repository-cache: true
cache-save: true
- name: Run Tests
run: |
bazel test \
--java_runtime_version=local_jdk \
--tool_java_runtime_version=local_jdk \
--test_output=errors \
//java/com/google/dotprompt/...
java-checks-all:
if: always()
needs: [format-check, tests]
runs-on: ubuntu-latest
steps:
- name: Check overall status
run: |
if [[ "${NEEDS_FORMAT_CHECK_RESULT}" == "failure" || "${NEEDS_TESTS_RESULT}" == "failure" ]]; then
echo "Java checks failed"
exit 1
fi
echo "Java checks passed or were skipped"
exit 0
env:
NEEDS_FORMAT_CHECK_RESULT: ${{ needs.format-check.result }}
NEEDS_TESTS_RESULT: ${{ needs.tests.result }}