Skip to content

Update gradle to 8.4 #101

Update gradle to 8.4

Update gradle to 8.4 #101

Workflow file for this run

name: 'Validate and publish'
on:
workflow_dispatch:
push:
branches: [ master, releases/** ]
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
pull_request:
branches: [ master, releases/** ]
env:
# Enable local build caching and disable daemon
GRADLE_OPTS: -Dorg.gradle.caching=true -Dorg.gradle.daemon=false
jobs:
configuration:
name: Configure build
runs-on: ubuntu-latest
outputs:
is_pr: ${{ steps.configuration.outputs.is_pr }}
is_fork_pr: ${{ steps.configuration.outputs.is_fork_pr }}
is_release: ${{ steps.configuration.outputs.is_release }}
publish_version: ${{ steps.get_publish_version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v3
# we need to fetch tags in order for the Axion plugin to properly determine the current snapshot version
- name: Fetch all tags
run: git fetch --prune --unshallow --tags --force
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: '8'
java-package: jdk
architecture: x64
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- id: get_publish_version
name: Extract publish version
run: |
echo 'run gradle warmup'
./gradlew
echo 'set version'
echo "version=`./gradlew cV -q -Prelease.quiet`" >> $GITHUB_OUTPUT
- id: configuration
name: Configure
run: |
echo "is_pr=${{ github.event_name == 'pull_request' || '' }}" >> $GITHUB_OUTPUT
echo "is_fork_pr=${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository || '' }}" >> $GITHUB_OUTPUT
echo "is_release=${{ !endsWith(steps.get_publish_version.outputs.version, '-SNAPSHOT') || '' }}" >> $GITHUB_OUTPUT
- name: Print summary
run: |
[[ '${{ steps.configuration.outputs.is_pr }}' ]] && echo "Running on a pull-request (${{ steps.configuration.outputs.is_fork_pr && 'from a fork' || 'internal' }})." >> $GITHUB_STEP_SUMMARY
[[ '${{ steps.configuration.outputs.is_pr }}' ]] && exit 0
echo "Publish version is ${{ steps.get_publish_version.outputs.version }} (${{ steps.configuration.outputs.is_release && 'RELEASE' || 'SNAPSHOT' }} version)." >> $GITHUB_STEP_SUMMARY
- name: Fail build in case of configuration inconsistency
if: ${{ steps.configuration.outputs.is_fork_pr && !steps.configuration.outputs.is_pr || steps.configuration.outputs.is_release && !startsWith(github.ref, 'refs/tags/v') }}
run: |
echo 'Failed to configure workflow.'
exit 1
validation:
name: Validate Gradle wrapper
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v3
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
compile:
name: Compile sources
needs: validation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: '8'
java-package: jdk
architecture: x64
distribution: 'temurin'
- name: Compile sources
uses: gradle/gradle-build-action@v2
with:
arguments: clean testClasses
test:
name: Run tests
needs: compile
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: '8'
java-package: jdk
architecture: x64
distribution: 'temurin'
- name: Run tests
uses: gradle/gradle-build-action@v2
with:
arguments: test
- name: Create JUnit HTML test report artifact
# don't run this step only if workflow was cancelled
if: ${{ success() || failure() }}
uses: actions/upload-artifact@v3
with:
name: junit-html-test-report
path: build/reports/tests/test
- name: Create JUnit XML test report artifact
# don't run this step only if workflow was cancelled
if: ${{ success() || failure() }}
uses: actions/upload-artifact@v3
with:
name: junit-xml-test-report
path: build/test-results/test
publish_test_results_overview:
name: Publish test results overview
# don't run this job only if workflow was cancelled
if: ${{ success() || failure() }}
concurrency: gh-pages-test-results
needs: test
runs-on: ubuntu-latest
steps:
- name: Download XML test results artifact
uses: actions/download-artifact@v3
with:
name: junit-xml-test-report
path: junit-xml-test-report
- name: Publish summary
uses: EnricoMi/publish-unit-test-result-action@v2
with:
junit_files: junit-xml-test-report/**/*.xml
check_name: Test results overview
publish_html_test_report:
name: Publish HTML test report
needs: [ test, configuration ]
# don't run this job only if workflow was cancelled, or we're running on a fork PR
if: ${{ !needs.configuration.outputs.is_fork_pr && (success() || failure()) }}
runs-on: ubuntu-latest
outputs:
test_report_url: ${{ steps.generate_report_url.outputs.test_report_url }}
steps:
- name: Download XML test results artifact
uses: actions/download-artifact@v3
with:
name: junit-html-test-report
path: junit-html-test-report
- name: Generate report path
id: generate_report_path
run: echo 'test_report_path=test-results/${{ github.run_id }}/${{ github.run_attempt }}' >> $GITHUB_OUTPUT
- name: Publish report to Github Pages
uses: peaceiris/actions-gh-pages@v3
if: ${{ always() }}
with:
external_repository: fingo/results-xactus
deploy_key: ${{ secrets.XACTUS_RESULTS_TOKEN }}
publish_dir: ./junit-html-test-report
destination_dir: ${{ steps.generate_report_path.outputs.test_report_path }}
keep_files: true
- name: Generate report URL
id: generate_report_url
run: echo 'test_report_url=https://fingo.github.io/results-xactus/${{ steps.generate_report_path.outputs.test_report_path }}' >> $GITHUB_OUTPUT
- name: Place report URL in the summary
run: |
echo 'Link to the HTML test report: <${{ steps.generate_report_url.outputs.test_report_url }}>' >> $GITHUB_STEP_SUMMARY
publish:
name: Publish artifacts
needs: [ test, configuration ]
if: ${{ !needs.configuration.outputs.is_pr }}
runs-on: ubuntu-latest
outputs:
artifact_url: ${{ steps.publication_configuration.outputs.artifact_url }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: '8'
java-package: jdk
architecture: x64
distribution: 'temurin'
- name: Configure publication
id: publication_configuration
run: |
echo 'ORG_GRADLE_PROJECT_version=${{ needs.configuration.outputs.publish_version }}' >> $GITHUB_ENV
echo 'ORG_GRADLE_PROJECT_ossrhUserName=${{ secrets.OSSRH_USERNAME }}' >> $GITHUB_ENV
echo 'ORG_GRADLE_PROJECT_ossrhPassword=${{ secrets.OSSRH_TOKEN }}' >> $GITHUB_ENV
if [[ '${{ needs.configuration.outputs.is_release }}' ]]
then
echo 'ORG_GRADLE_PROJECT_pgpSecretKeyPassword=${{ secrets.MAVEN_GPG_PASSPHRASE }}' >> $GITHUB_ENV
echo 'ORG_GRADLE_PROJECT_pgpSecretKey<<EOF' >> $GITHUB_ENV
echo "${{ secrets.MAVEN_GPG_PRIVATE_KEY }}" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
fi
echo 'arguments=${{ needs.configuration.outputs.is_release && 'publishToSonatype closeAndReleaseSonatypeStagingRepository' || 'publishToSonatype' }}' >> $GITHUB_OUTPUT
echo 'artifact_url=${{ format(needs.configuration.outputs.is_release && 'https://repo.maven.apache.org/maven2/info/fingo/xactus/xactus/{0}/' || 'https://oss.sonatype.org/content/repositories/snapshots/info/fingo/xactus/xactus/{0}/', needs.configuration.outputs.publish_version) }}' >> $GITHUB_OUTPUT
- name: Publish
uses: gradle/gradle-build-action@v2
with:
arguments: -i ${{ steps.publication_configuration.outputs.arguments }}
- name: Place artifact URL in the summary
run: |
echo "Published artifact URL: ${{ steps.publication_configuration.outputs.artifact_url }}" >> $GITHUB_STEP_SUMMARY
slack:
needs: [ test, publish, publish_html_test_report, configuration ]
# don't run this job only if we're running on a fork PR
if: ${{ !needs.configuration.outputs.is_fork_pr && always() }}
name: Send out Slack notification
runs-on: ubuntu-latest
steps:
- name: Send Slack message
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.XPATH_SLACK_URL }}
SLACK_COLOR: ${{job.status}}
SLACK_ICON: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
SLACK_USERNAME: Github
SLACK_TITLE: Reports
SLACK_MESSAGE: |
*HTML test report*
${{ needs.publish_html_test_report.outputs.test_report_url }}
*Artifact URL*
${{ needs.publish.outputs.artifact_url }}
_Usually artifacts and test results become available with a delay (usually up to a few minutes, but sometimes it may take longer)._