Unverified Commit 173b6ae5 authored by daz's avatar daz
Browse files

Improve testing for dependency graph failures

- Update test to use input param
- Rename Job to indicate expected failure
parent a01f794d
Loading
Loading
Loading
Loading
+18 −16
Changes for .github/workflows/integ-test-dependency-graph-failures.yml: 18 added lines, 16 removed lines.
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ env:
  GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true

jobs:
  unsupported-gradle-version-failure:
  unsupported-gradle-version-warning:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout sources
@@ -30,16 +30,19 @@ jobs:
      with:
        gradle-version: 7.0.1
        dependency-graph: generate
        dependency-graph-continue-on-failure: false
        dependency-graph-continue-on-failure: true
    - 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"
        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-warning:
  unsupported-gradle-version-failure:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout sources
@@ -51,23 +54,19 @@ jobs:
      with:
        gradle-version: 7.0.1
        dependency-graph: generate
        dependency-graph-continue-on-failure: true
        dependency-graph-continue-on-failure: false
    - 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"
        if gradle help; then
          echo "Expected build to fail with Gradle 7.0.1"
          exit 1
        fi

  insufficient-permissions-failure:
  insufficient-permissions-warning:
    runs-on: ubuntu-latest
    permissions:
      contents: read
    continue-on-error: true
    steps:
    - name: Checkout sources
      uses: actions/checkout@v4
@@ -77,15 +76,17 @@ jobs:
      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
      # TODO unclear how to check for failure in post action
      # This test is primarily for demonstration: it's unclear how to check for warnings emitted in the post-action

  insufficient-permissions-warning:
  SHOULD_FAIL-insufficient-permissions-failure:
    runs-on: ubuntu-latest
    permissions:
      contents: read
    continue-on-error: true
    steps:
    - name: Checkout sources
      uses: actions/checkout@v4
@@ -95,7 +96,8 @@ jobs:
      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
      # TODO unclear how to check for warning in post action
      # This test is primarily for demonstration: it's unclear how to check for a failure in the post-action