mirror of
https://github.com/gradle/actions.git
synced 2026-08-29 19:28:23 +08:00
95 lines
3.4 KiB
YAML
95 lines
3.4 KiB
YAML
name: Test Gradle support status reporting
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
cache-key-prefix:
|
|
type: string
|
|
default: '0'
|
|
skip-dist:
|
|
type: boolean
|
|
default: false
|
|
|
|
env:
|
|
SKIP_DIST: ${{ inputs.skip-dist }}
|
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: gradle-support-status-${{ inputs.cache-key-prefix }}
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
report-outdated-versions:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
maintenance-version: ${{ steps.maintenance-version.outputs.version }}
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
- name: Initialize integ-test
|
|
uses: ./.github/actions/init-integ-test
|
|
|
|
- name: Determine the maintenance-only Gradle version
|
|
id: maintenance-version
|
|
run: |
|
|
version=$(jq -r '
|
|
[.[].version | select(test("^[0-9]+\\.[0-9]+(\\.[0-9]+)?$"))] as $finals
|
|
| ($finals | map(split(".")[0] | tonumber) | max) as $latest
|
|
| [$finals[] | select((split(".")[0] | tonumber) == ($latest - 1))] | first
|
|
' sources/src/wrapper-validation/wrapper-checksums.json)
|
|
echo "Newest release in the maintenance-only line: $version"
|
|
echo "version=$version" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Setup Gradle with an end-of-life version
|
|
uses: ./setup-gradle
|
|
with:
|
|
cache-read-only: false
|
|
gradle-version: '7.6.4'
|
|
- name: Build with the end-of-life version
|
|
id: build-end-of-life
|
|
working-directory: .github/workflow-samples/no-wrapper
|
|
run: gradle help "-DgradleVersionCheck=7.6.4"
|
|
|
|
- name: Setup Gradle with the maintenance-only version
|
|
uses: ./setup-gradle
|
|
with:
|
|
gradle-version: ${{ steps.maintenance-version.outputs.version }}
|
|
- name: Build with the maintenance-only version
|
|
working-directory: .github/workflow-samples/no-wrapper
|
|
run: gradle help "-DgradleVersionCheck=${{ steps.maintenance-version.outputs.version }}"
|
|
|
|
verify-annotations:
|
|
needs: report-outdated-versions
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
actions: read
|
|
steps:
|
|
- name: Check the support-status annotations were emitted
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
MAINTENANCE_VERSION: ${{ needs.report-outdated-versions.outputs.maintenance-version }}
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
job_id=$(gh api \
|
|
"/repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/attempts/${GITHUB_RUN_ATTEMPT}/jobs" \
|
|
--paginate --jq '.jobs[] | select(.name | endswith("report-outdated-versions")) | .id')
|
|
if [ -z "$job_id" ]; then
|
|
echo "Could not find the 'report-outdated-versions' Job in this workflow run"
|
|
exit 1
|
|
fi
|
|
gh api --allow-escape-sequences "/repos/${GITHUB_REPOSITORY}/actions/jobs/${job_id}/logs" > job.log
|
|
|
|
# The runner renders '::warning::'/'::notice::' commands into the log as '##[warning]'/'##[notice]'.
|
|
assert_logged() {
|
|
if ! grep -qF -- "$1" job.log; then
|
|
echo "Expected the Job log to contain: $1"
|
|
echo "Annotations found instead:"
|
|
grep -E '##\[(warning|notice)\]' job.log || echo "(none)"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
assert_logged "##[warning]Gradle 7.6.4 has reached end-of-life"
|
|
assert_logged "##[notice]Gradle ${MAINTENANCE_VERSION} is in maintenance-only support"
|