generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve dependency graph failure handling (#1036)
One goal for the original dependency-graph support was to minimize it's impact on existing workflows, by operating transparently and not impacting the build outcome. This meant that any failures in dependency-graph generation or submission were logged as warnings, but did not cause the workflow to fail. However, in some cases the primary purpose of a workflow is to generate and submit a dependency graph: in these cases it is desirable to have the workflow fail when this process breaks. This PR introduces a new `dependency-graph-continue-on-failure` parameter, which when `false` will enable the latter behaviour. It also adds test coverage for different failures in dependency graph generation and submission. Fixes #1034 Fixes #997
- Loading branch information
Showing
17 changed files
with
302 additions
and
25 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
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
103 changes: 103 additions & 0 deletions
103
.github/workflows/integ-test-dependency-graph-failures.yml
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,103 @@ | ||
name: Test dependency graph | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
cache-key-prefix: | ||
type: string | ||
runner-os: | ||
type: string | ||
default: '["ubuntu-latest"]' | ||
download-dist: | ||
type: boolean | ||
default: false | ||
|
||
env: | ||
DOWNLOAD_DIST: ${{ inputs.download-dist }} | ||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: dependency-graph-${{ inputs.cache-key-prefix }} | ||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true | ||
|
||
jobs: | ||
unsupported-gradle-version-warning: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
- name: Download distribution if required | ||
uses: ./.github/actions/download-dist | ||
- name: Setup Gradle for dependency-graph generate | ||
uses: ./ | ||
with: | ||
gradle-version: 7.0.1 | ||
dependency-graph: generate | ||
dependency-graph-continue-on-failure: true | ||
- name: Run with unsupported Gradle version | ||
working-directory: .github/workflow-samples/groovy-dsl | ||
run: | | ||
if gradle help | grep -q 'warning::Dependency Graph is not supported for Gradle 7.0.1. No dependency snapshot will be generated.'; | ||
then | ||
echo "Got the expected warning" | ||
else | ||
echo "Did not get the expected warning" | ||
exit 1 | ||
fi | ||
unsupported-gradle-version-failure: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
- name: Download distribution if required | ||
uses: ./.github/actions/download-dist | ||
- name: Setup Gradle for dependency-graph generate | ||
uses: ./ | ||
with: | ||
gradle-version: 7.0.1 | ||
dependency-graph: generate | ||
dependency-graph-continue-on-failure: false | ||
- name: Run with unsupported Gradle version | ||
working-directory: .github/workflow-samples/groovy-dsl | ||
run: | | ||
if gradle help; then | ||
echo "Expected build to fail with Gradle 7.0.1" | ||
exit 1 | ||
fi | ||
insufficient-permissions-warning: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
- name: Download distribution if required | ||
uses: ./.github/actions/download-dist | ||
- name: Setup Gradle for dependency-graph generate | ||
uses: ./ | ||
with: | ||
dependency-graph: generate-and-submit | ||
dependency-graph-continue-on-failure: true | ||
- name: Run with insufficient permissions | ||
working-directory: .github/workflow-samples/groovy-dsl | ||
run: ./gradlew help | ||
# This test is primarily for demonstration: it's unclear how to check for warnings emitted in the post-action | ||
|
||
SHOULD_FAIL-insufficient-permissions-failure: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
continue-on-error: true | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
- name: Download distribution if required | ||
uses: ./.github/actions/download-dist | ||
- name: Setup Gradle for dependency-graph generate | ||
uses: ./ | ||
with: | ||
dependency-graph: generate-and-submit | ||
dependency-graph-continue-on-failure: false | ||
- name: Run with insufficient permissions | ||
working-directory: .github/workflow-samples/groovy-dsl | ||
run: ./gradlew help | ||
# This test is primarily for demonstration: it's unclear how to check for a failure in the post-action |
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
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.