mirror of
https://github.com/gradle/actions.git
synced 2026-09-10 19:28:33 +08:00
Provide information about outdated Gradle versions in the job summary
This commit is contained in:
@@ -1,9 +1,20 @@
|
||||
import dedent from 'dedent'
|
||||
import * as github from '@actions/github'
|
||||
import {afterEach, describe, expect, it} from '@jest/globals'
|
||||
import {afterEach, beforeEach, describe, expect, it, jest} from '@jest/globals'
|
||||
|
||||
import {BuildResult} from '../../src/build-results'
|
||||
import {jobMarker, renderSummaryTable} from '../../src/job-summary'
|
||||
import {SupportStatus} from '../../src/gradle-support-status'
|
||||
|
||||
const mockSupportStatusOf = jest.fn<(gradleVersion: string) => SupportStatus | undefined>()
|
||||
jest.unstable_mockModule('../../src/gradle-support-status', () => ({
|
||||
supportStatusOf: mockSupportStatusOf
|
||||
}))
|
||||
|
||||
const {jobMarker, renderSummaryTable} = await import('../../src/job-summary')
|
||||
|
||||
beforeEach(() => {
|
||||
mockSupportStatusOf.mockReturnValue('active')
|
||||
})
|
||||
|
||||
const MATRIX_INPUT_ENV = 'INPUT_WORKFLOW-JOB-CONTEXT'
|
||||
|
||||
@@ -185,6 +196,53 @@ describe('renderSummaryTable', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('Gradle version support status', () => {
|
||||
it('marks an outdated version and adds a details section', () => {
|
||||
mockSupportStatusOf.mockReturnValue('eol')
|
||||
const table = renderSummaryTable([successfulHelpBuild])
|
||||
expect(table.trim()).toBe(dedent`
|
||||
<table>
|
||||
<tr>
|
||||
<th>Gradle Root Project</th>
|
||||
<th>Requested Tasks</th>
|
||||
<th>Gradle Version</th>
|
||||
<th>Build Outcome</th>
|
||||
<th>Build Scan®</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>root</td>
|
||||
<td>help</td>
|
||||
<td align='center'>8.0 <span title="End-of-life: no longer receives bug fixes or security fixes">:warning:</span></td>
|
||||
<td align='center'>:white_check_mark:</td>
|
||||
<td><a href="https://scans.gradle.com/s/abc123" rel="nofollow" target="_blank"><img src="https://img.shields.io/badge/Build%20Scan%C2%AE-06A0CE?logo=Gradle" alt="Build Scan published" /></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h4>:warning: This Job uses an outdated Gradle version</h4>
|
||||
<details>
|
||||
<summary>Gradle release end-of-life policy</summary>
|
||||
<p>For major versions, Gradle will backport critical fixes and security fixes to the last minor in the
|
||||
previous major version. As such, each major Gradle release causes:</p>
|
||||
<ul>
|
||||
<li>The previous major version becomes maintenance only. It will only receive critical bug fixes
|
||||
and security fixes.</li>
|
||||
<li>The major version before the previous one to become end-of-life (EOL), and that release line
|
||||
will not receive any new fixes.</li>
|
||||
</ul>
|
||||
<a href="https://docs.gradle.org/current/userguide/feature_lifecycle.html#eol_support" target="_blank">Gradle feature lifecycle</a>
|
||||
</details>
|
||||
`);
|
||||
})
|
||||
it('marks a maintenance-only version', () => {
|
||||
mockSupportStatusOf.mockReturnValue('maintenance')
|
||||
const table = renderSummaryTable([successfulHelpBuild])
|
||||
expect(table).toContain(
|
||||
`<td align='center'>8.0 <span title="Maintenance only: receives critical bug fixes and security fixes only">:information_source:</span></td>`
|
||||
)
|
||||
expect(table).toContain('This Job uses an outdated Gradle version')
|
||||
})
|
||||
})
|
||||
|
||||
describe('jobMarker', () => {
|
||||
const original = process.env[MATRIX_INPUT_ENV]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user