-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Emit warnings when using deprecated inputs / actions (#139)
Fixes #108
- Loading branch information
Showing
27 changed files
with
2,597 additions
and
1,859 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,105 @@ | ||
# Deprecation upgrade guide | ||
|
||
As these actions evolve, certain inputs, behaviour and usages are deprecated for removal. | ||
Deprecated functionality will be fully supported during the current major release, and will be | ||
removed in the next major release. | ||
Users will receive a deprecation warning when they rely on deprecated functionality, | ||
prompting them to update their workflows. | ||
|
||
## Deprecated in v3.x | ||
|
||
### The action `gradle/gradle-build-action` has been replaced by `gradle/actions/setup-gradle` | ||
|
||
The `gradle-build-action` action has evolved, so that the core functionality is now to configure the | ||
Gradle environment for GitHub Actions. For clarity and consistency with other action (eg `setup-java`, `setup-node`), the `gradle-build-action` has been replaced by the `setup-gradle` action. | ||
|
||
As of `v3.x`, the `setup-gradle` and `gradle-build-action` actions are functionally identical, | ||
and are released with the same versions. | ||
|
||
To convert your workflows, simply replace: | ||
``` | ||
uses: gradle/gradle-build-action@v3 | ||
``` | ||
with | ||
``` | ||
uses: gradle/actions/setup-gradle@v3 | ||
``` | ||
|
||
### Using the action to execute Gradle via the `arguments` parameter is deprecated | ||
|
||
The core functionality of the `setup-gradle` (and `gradle-build-action`) actions is to configure your | ||
Gradle environment for GitHub Actions. Once the action has run, any subsequent Gradle executions will | ||
benefit from caching, reporting and other features of the action. | ||
|
||
Using the `arguments` parameter to execute Gradle directly is not necessary to benefit from this action. | ||
This input is deprecated, and will be removed in the `v4` major release of the action. | ||
|
||
To convert your workflows, replace any steps using the `arguments` parameter with 2 steps: one to `setup-gradle` and another that runs your Gradle build. | ||
|
||
For example, if your workflow looks like this: | ||
|
||
``` | ||
steps: | ||
- name: Assemble the project | ||
uses: gradle/actions/setup-gradle@v3 | ||
with: | ||
arguments: 'assemble' | ||
- name: Run the tests | ||
uses: gradle/actions/setup-gradle@v3 | ||
with: | ||
arguments: 'test' | ||
- name: Run build in a subdirectory | ||
uses: gradle/actions/setup-gradle@v3 | ||
with: | ||
build-root-directory: another-build | ||
arguments: 'build' | ||
``` | ||
|
||
Then replace this with a single call to `setup-gradle` together with separate `run` steps to execute your build. | ||
|
||
``` | ||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v3 | ||
- name: Assemble the project | ||
run: ./gradlew assemble | ||
- name: Run the tests | ||
run: ./gradlew test | ||
- name: Run build in a subdirectory | ||
working-directory: another-build | ||
run: ./gradlew build | ||
``` | ||
|
||
Using the action in this way gives you more control over how Gradle is executed, while still giving you | ||
all of the benefits of the `setup-gradle` action. | ||
|
||
The `arguments` parameter is scheduled to be removed in `setup-gradle@v4`. | ||
|
||
Note: if you are using the `gradle-build-action`, [see here](#the-action-gradlegradle-build-action-has-been-replaced-by-gradleactionssetup-gradle) for more details on how to migrate. | ||
|
||
### The `build-scan-terms-of-service` input parameters have been renamed | ||
|
||
With recent releases of the `com.gradle.develocity` plugin, key input parameters have been renamed. | ||
- `build-scan-terms-of-service-url` is now `build-scan-terms-of-use-url` | ||
- `build-scan-terms-of-service-agree` is now `build-scan-terms-of-use-agree` | ||
|
||
The standard URL for the terms of use has also changed to https://gradle.com/help/legal-terms-of-use | ||
|
||
To convert your workflows, change: | ||
``` | ||
build-scan-publish: true | ||
build-scan-terms-of-service-url: "https://gradle.com/terms-of-service" | ||
build-scan-terms-of-service-agree: "yes" | ||
``` | ||
|
||
to this: | ||
``` | ||
build-scan-publish: true | ||
build-scan-terms-of-use-url: "https://gradle.com/help/legal-terms-of-use" | ||
build-scan-terms-of-use-agree: "yes" | ||
``` | ||
These deprecated build-scan parameters are scheduled to be removed in `setup-gradle@v4` and `dependency-submission@v4`. |
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
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
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
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
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
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
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
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
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
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,54 @@ | ||
import * as core from '@actions/core' | ||
import {getActionId} from './configuration' | ||
|
||
const DEPRECATION_UPGRADE_PAGE = 'https://github.com/gradle/actions/blob/main/docs/deprecation-upgrade-guide.md' | ||
const recordedDeprecations: Deprecation[] = [] | ||
|
||
export class Deprecation { | ||
constructor(readonly message: string) {} | ||
|
||
getDocumentationLink(): string { | ||
const deprecationAnchor = this.message | ||
.toLowerCase() | ||
.replace(/[^\w\s-]|_/g, '') | ||
.replace(/ /g, '-') | ||
return `${DEPRECATION_UPGRADE_PAGE}#${deprecationAnchor}` | ||
} | ||
} | ||
|
||
export function recordDeprecation(message: string): void { | ||
if (!recordedDeprecations.some(deprecation => deprecation.message === message)) { | ||
recordedDeprecations.push(new Deprecation(message)) | ||
} | ||
} | ||
|
||
export function getDeprecations(): Deprecation[] { | ||
return recordedDeprecations | ||
} | ||
|
||
export function emitDeprecationWarnings(): void { | ||
if (recordedDeprecations.length > 0) { | ||
core.warning( | ||
`This job uses deprecated functionality from the '${getActionId()}' action. Consult the Job Summary for more details.` | ||
) | ||
for (const deprecation of recordedDeprecations) { | ||
core.info(`DEPRECATION: ${deprecation.message}. See ${deprecation.getDocumentationLink()}`) | ||
} | ||
} | ||
} | ||
|
||
export function saveDeprecationState(): void { | ||
core.saveState('deprecations', JSON.stringify(recordedDeprecations)) | ||
} | ||
|
||
export function restoreDeprecationState(): void { | ||
const stringRep = core.getState('deprecations') | ||
if (stringRep === '') { | ||
return | ||
} | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
JSON.parse(stringRep).forEach((obj: any) => { | ||
recordedDeprecations.push(new Deprecation(obj.message)) | ||
}) | ||
} |
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
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
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
Oops, something went wrong.