Skip to content

[Gradle Release Plugin] - new version commit: 'bigdata-test-0.1.4-SN… #32

[Gradle Release Plugin] - new version commit: 'bigdata-test-0.1.4-SN…

[Gradle Release Plugin] - new version commit: 'bigdata-test-0.1.4-SN… #32

Workflow file for this run

name: Release
on:
push:
branches:
- master
workflow_dispatch:
inputs:
gradle_args:
description: "Extra Gradle args for the release run, for example: --stacktrace --debug"
required: false
default: ""
type: string
skip_tests:
description: "Skip Docker verification and all test tasks, and run the release directly"
required: false
default: false
type: boolean
permissions:
contents: write
concurrency:
group: release-master
cancel-in-progress: false
jobs:
release:
if: github.event_name == 'workflow_dispatch' || !contains(github.event.head_commit.message, '[Gradle Release Plugin]')
runs-on: ubuntu-latest
env:
GRADLE_OPTS: -Dorg.gradle.daemon=false
EXTRA_GRADLE_ARGS: ${{ github.event.inputs.gradle_args || '' }}
SKIP_TESTS: ${{ github.event.inputs.skip_tests || 'false' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: false
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Verify Docker environment
if: env.SKIP_TESTS != 'true'
run: |
docker version
docker info
- name: Run Spark big data matrix tests
if: env.SKIP_TESTS != 'true'
run: |
./gradlew --no-configuration-cache :example:spark:sparkBigDataMatrixTest --stacktrace --debug
- name: Collect and print Spark diagnostics on failure
if: failure() && env.SKIP_TESTS != 'true'
run: |
set +e
diagnostics_dir="build/github-diagnostics"
mkdir -p "${diagnostics_dir}/docker" "${diagnostics_dir}/spark"
echo "::group::Docker containers"
docker ps -a | tee "${diagnostics_dir}/docker/containers.txt"
echo "::endgroup::"
echo "::group::Docker images"
docker images | tee "${diagnostics_dir}/docker/images.txt"
echo "::endgroup::"
mapfile -t container_ids < <(docker ps -aq)
for container_id in "${container_ids[@]}"; do
container_name="$(docker inspect --format '{{.Name}}' "${container_id}" 2>/dev/null | sed 's#^/##')"
if [ -z "${container_name}" ]; then
container_name="${container_id}"
fi
safe_name="$(printf '%s' "${container_name}" | tr -c 'A-Za-z0-9_.-' '_')"
docker inspect "${container_id}" > "${diagnostics_dir}/docker/${safe_name}.inspect.json" 2>&1
docker logs "${container_id}" > "${diagnostics_dir}/docker/${safe_name}.stdout-stderr.log" 2>&1
done
echo "::group::Spark container log files"
if [ -d example/spark/build/bigdata-test-container-logs ]; then
find example/spark/build/bigdata-test-container-logs -type f -print | sort
else
echo "No Spark container log directory found."
fi
echo "::endgroup::"
if [ -d example/spark/build/bigdata-test-container-logs ]; then
while IFS= read -r log_file; do
echo "::group::${log_file}"
sed -n '1,400p' "${log_file}"
line_count="$(wc -l < "${log_file}")"
if [ "${line_count}" -gt 400 ]; then
echo "... truncated first 400 lines from ${line_count} total lines ..."
echo "--- tail ---"
tail -n 400 "${log_file}"
fi
echo "::endgroup::"
done < <(find example/spark/build/bigdata-test-container-logs -type f -print | sort)
cp -a example/spark/build/bigdata-test-container-logs "${diagnostics_dir}/spark/container-logs"
fi
echo "::group::Spark test XML results"
if [ -d example/spark/build/test-results ]; then
while IFS= read -r result_file; do
echo "--- ${result_file} ---"
sed -n '1,240p' "${result_file}"
done < <(find example/spark/build/test-results -type f -name '*.xml' -print | sort)
else
echo "No Spark test result directory found."
fi
echo "::endgroup::"
cp -a example/spark/build/test-results "${diagnostics_dir}/spark/test-results" 2>/dev/null || true
cp -a example/spark/build/reports/tests "${diagnostics_dir}/spark/test-reports" 2>/dev/null || true
- name: Upload test reports and container logs
if: failure() && env.SKIP_TESTS != 'true'
uses: actions/upload-artifact@v4
with:
name: test-diagnostics-${{ github.run_id }}-${{ github.run_attempt }}
path: |
**/build/reports/tests/
**/build/test-results/
**/build/reports/problems/
**/build/bigdata-test-container-logs/
build/github-diagnostics/
if-no-files-found: ignore
retention-days: 14
- name: Write signing key
env:
SIGNING_KEY_ASC: ${{ secrets.SIGNING_KEY_ASC }}
run: |
printf '%s' "$SIGNING_KEY_ASC" > "$RUNNER_TEMP/signing-key.asc"
- name: Run release
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGNING_KEY_FILE: ${{ runner.temp }}/signing-key.asc
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
run: |
skip_test_args=""
if [ "$SKIP_TESTS" = "true" ]; then
skip_test_args="-x test -x sparkBigDataMatrixTest -x sparkApacheDepsApacheHmsTest -x sparkApacheDepsApacheHmsKerberosTest -x sparkApacheDepsClouderaHmsTest -x sparkApacheDepsClouderaHmsKerberosTest -x sparkClouderaDepsApacheHmsTest -x sparkClouderaDepsApacheHmsKerberosTest -x sparkClouderaDepsClouderaHmsTest -x sparkClouderaDepsClouderaHmsKerberosTest"
fi
./gradlew --no-configuration-cache release --stacktrace --info $skip_test_args $EXTRA_GRADLE_ARGS