-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
228 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,228 @@ | ||
name: CI-Gradle-canary | ||
# This build exists to test compatibility of the plugin produces with the latest Gradle version | ||
# This is checking and reporting about the user perspective of consuming this plugin | ||
# This also indirectly tests against JVM updates as well but that is not considered the main focus | ||
# | ||
# So I'm calling this a canary as it provides an early warning after a new official Gradle release | ||
# of consumer issues. We do not test release candidates or against any Gradle builds that are not | ||
# an official release as there is no maintenance capacity to keep uptodate with daily issues from | ||
# doing this not any reason to thing doing this will improve the quality of the plugin. | ||
# | ||
# Gradle publishes public data to in this area to help with automation: | ||
# https://services.gradle.org/versions/ | ||
# https://raw.githubusercontent.com/gradle/gradle/master/released-versions.json | ||
|
||
## TODO build project test, using newer Gradle versions, setup matrix of useful version | ||
## TODO run deprecation test turn on warnings, collect output to summary | ||
## TODO emit compile log output warnings to summary | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
GRADLE_TARGET_ENABLE_integrationTest: | ||
description: 'Run with integrationTest ?' | ||
default: true | ||
type: boolean | ||
schedule: | ||
# setup weekly canary build | ||
- cron: '45 4 * * 6' | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
# Maintenance update as necessary the expected latest Gradle version supports the JVM matrix listed | ||
os: [ubuntu-latest] | ||
jvm: ['8', '11', '17', '21'] | ||
gradle: [ | ||
'latest', | ||
'8', | ||
'8.5', # JDK21 | ||
'7', | ||
'7.6', | ||
'7.3', # JDK11 | ||
'6', | ||
'5', | ||
'5.6' | ||
] | ||
exclude: | ||
- jvm: 21 | ||
gradle: 7 | ||
- jvm: 21 | ||
gradle: 7.6 | ||
- jvm: 21 | ||
gradle: 7.3 | ||
- jvm: 21 | ||
gradle: 6 | ||
- jvm: 21 | ||
gradle: 5 | ||
- jvm: 21 | ||
gradle: 5.6 | ||
- jvm: 17 | ||
gradle: 6 | ||
- jvm: 17 | ||
gradle: 5 | ||
- jvm: 17 | ||
gradle: 5.6 | ||
fail-fast: false | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Matrix Check | ||
run: | | ||
## Disable runs requesting invalid matrix (done via 'strategy.matrix.exclude' GHA setting) | ||
# jvm=21 only latest 8.5 | ||
# jvm=17 only latest 8.5 7 7.6 7.3 | ||
# jvm=11 only latest 8.5 7 7.6 7.3 6 5 5.6 | ||
# jvm=8 only latest 8.5 7 7.6 7.3 6 5 5.6 | ||
# Resolve all values to actual value | ||
# Remove duplicates (and alias runs) | ||
if [ -z "${{ matrix.os }}" ] | ||
then | ||
echo "$0: matrix.os is not setup" 1>&2 | ||
exit 1 | ||
fi | ||
if [ -z "${{ matrix.jvm }}" ] | ||
then | ||
echo "$0: matrix.jvm is not setup" 1>&2 | ||
exit 1 | ||
fi | ||
if [ -z "${{ matrix.gradle }}" ] | ||
then | ||
echo "$0: matrix.gradle is not setup" 1>&2 | ||
exit 1 | ||
fi | ||
- name: Version | ||
run: | | ||
if [ -z "${GRADLE_TARGET_ENABLE_integrationTest}" ] && [ -n "${{ github.event.schedule }}" ]; then | ||
# force this on for schedule build | ||
# "${{ github.event.schedule }}" == "45 4 18 * *" | ||
# $GITHUB_EVENT_NAME == "schedule" | ||
echo "GRADLE_TARGET_ENABLE_integrationTest=true" >> $GITHUB_ENV | ||
fi | ||
target_plugin="org.unbroken-dome.xjc" | ||
target_group=$(grep "^group=" gradle.properties | cut -d'=' -f2-) | ||
target_artifact="gradle-xjc-plugin" | ||
target_version=$(grep "^version=" gradle.properties | cut -d'=' -f2-) | ||
echo "target_plugin=$target_plugin" >> $GITHUB_ENV | ||
echo "target_group=$target_group" >> $GITHUB_ENV | ||
echo "target_artifact=$target_artifact" >> $GITHUB_ENV | ||
echo "target_version=$target_version" >> $GITHUB_ENV | ||
- name: Gradle Version | ||
run: | | ||
# | ||
curl -s "https://raw.githubusercontent.com/gradle/gradle/master/released-versions.json" > released-versions.json | ||
# Only supporting 5.6 or newer | ||
GRADLE_ALL_VERSIONS=$(jq '.finalReleases[].version' -r released-versions.json | sort -rn | tr '\n' ' ' | sed -e 's# 5.5.1.*##') | ||
echo "GRADLE_ALL_VERSIONS=GRADLE_ALL_VERSIONS" | ||
GRADLE_CANARY_VERSION=$(jq '.finalReleases[].version' -r released-versions.json | sort -rn | head -n1) | ||
echo "GRADLE_CANARY_VERSION=$GRADLE_CANARY_VERSION" | ||
regex_transform=$(echo -ne "${{ matrix.gradle }}" | sed -e 's#\.#\\\0#g') | ||
GRADLE_MATRIX_VERSION=$(jq '.finalReleases[].version' -r released-versions.json | sort -rn | egrep -- "^${regex_transform}" | head -n1 | tr -d '\r\n') | ||
echo "GRADLE_MATRIX_VERSION=GRADLE_MATRIX_VERSION" | ||
echo "GRADLE_ALL_VERSIONS=GRADLE_ALL_VERSIONS" >> $GITHUB_ENV | ||
echo "GRADLE_CANARY_VERSION=$GRADLE_CANARY_VERSION" >> $GITHUB_ENV | ||
java -version | ||
gradlew -v | ||
which gradlew | ||
JAVA_VERSION=$(java -version 2>&1 | sed -e 's#\n#<br/>#g') | ||
GRADLE_VERSION=$(gradlew -v 2>&1 | sed -e 's#\n#<br/>#g') | ||
cat <<EOF >> $GITHUB_STEP_SUMMARY | ||
Gradle Version $GRADLE_CANARY_VERSION (${{ matrix.gradle }}) JDK ${{ matrix.jdk }} | ||
| Package | Details | | ||
| ------- | ------- | | ||
| Java | $JAVA_VERSION | | ||
| Gradle | $GRADLE_VERSION | | ||
Available versions $GRADLE_ALL_VERSIONS | ||
EOF | ||
- name: Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: temurin | ||
java-version: ${{ matrix.jvm }} | ||
|
||
- name: Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties', '**/gradle.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Gradle - setup | ||
uses: gradle/gradle-build-action@v2 | ||
|
||
- name: Gradle - build | ||
run: ./gradlew build | ||
|
||
- name: Gradle - check | ||
run: echo ./gradlew check | ||
|
||
- name: Gradle - integrationTest | ||
if: ${{ vars.GRADLE_TARGET_ENABLE_integrationTest == 'true' || inputs.GRADLE_TARGET_ENABLE_integrationTest }} | ||
run: echo ./gradlew "-Dorg.unbrokendome.gradle.plugins.xjc.testutil.GradleVersions=${GRADLE_CANARY_VERSION}" integrationTest | ||
|
||
- name: Gradle - asciidoctor | ||
run: echo ./gradlew asciidoctor | ||
|
||
- name: Gradle - dokka | ||
run: echo ./gradlew dokka | ||
|
||
- name: Gradle - publish | ||
run: echo ./gradlew publish | ||
|
||
- name: Upload - prepare | ||
if: ${{ matrix.os == 'ubuntu-latest' }} | ||
shell: bash | ||
run: | | ||
mkdir dist; | ||
for dir in $(find . -type d -path "*/build/repo"); | ||
do | ||
cp -a "$dir" "dist/"; | ||
done | ||
find "dist" -type f -exec ls -ld {} \; | ||
du -s "dist" | ||
mkdir -p build/gh-pages | ||
[ -d build/reports/tests ] && cp -a build/reports/tests build/gh-pages/ | ||
[ -d build/asciidoc/html5 ] && cp -a build/asciidoc/html5/* build/gh-pages/ | ||
[ -d build/dokka ] && cp -a build/dokka build/gh-pages/ | ||
mkdir -p build/gh-pages/maven2 | ||
cp -a build/repo/* build/gh-pages/maven2/ | ||
ls -lad build/gh-pages | ||
du -s build/gh-pages | ||
- name: Upload - java${{ matrix.jvm }}-gradle${{ matrix.gradle }}-github-pages | ||
uses: actions/upload-pages-artifact@main | ||
with: | ||
name: java${{ matrix.jvm }}-github-pages | ||
path: build/gh-pages/ | ||
retention-days: 1 | ||
|
||
- name: Upload - perform | ||
uses: actions/upload-artifact@v3 | ||
if: ${{ matrix.os == 'ubuntu-latest' }} | ||
with: | ||
name: java${{ matrix.jvm }}-${{ env.target_group }}-${{ env.target_artifact }}-${{ env.target_version }}-artifacts | ||
path: dist/repo/* | ||
if-no-files-found: error |