Unverified Commit 62557f36 authored by daz's avatar daz
Browse files

Enable wrapper validation with setup-gradle action

parent 33741bd2
Loading
Loading
Loading
Loading
+2
Changes for .github/workflows/ci-integ-test.yml: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -183,3 +183,5 @@ jobs:
  wrapper-validation:
    needs: [determine-suite, build-distribution]
    uses: ./.github/workflows/integ-test-wrapper-validation.yml
    with:
      runner-os: '["ubuntu-latest"]'
+31 −5
Changes for .github/workflows/integ-test-wrapper-validation.yml: 31 added lines, 5 removed lines.
Original line number Diff line number Diff line
name: Test sample Kotlin DSL project
name: Test wrapper validation

on:
  workflow_call:
    inputs:
      runner-os:
        type: string
        default: '["ubuntu-latest", "windows-latest", "macos-latest"]'

jobs:
  # Integration test for successful validation of wrappers
  test-setup-gradle-validation:
    strategy:
      fail-fast: false
      matrix:
        os: ${{fromJSON(inputs.runner-os)}}
    runs-on: ${{ matrix.os }}
    steps:
    - name: Checkout sources
      uses: actions/checkout@v4
    - name: Initialize integ-test
      uses: ./.github/actions/init-integ-test

    - name: Run wrapper-validation-action
      id: setup-gradle
      uses: ./setup-gradle
      with:
        validate-wrappers: true
      continue-on-error: true

    - name: Check failure
      run: |
        if [ "${{ steps.setup-gradle.outcome}}" != "failure" ] ; then
          echo "Expected validation to fail, but it didn't"
          exit 1
        fi

  test-validation-success:
    name: 'Test: Validation success'
    runs-on: ubuntu-latest
    steps:
    - name: Checkout sources
@@ -33,9 +61,7 @@ jobs:
          exit 1
        fi

  # Integration test for failing validation of wrappers
  test-validation-error:
    name: 'Test: Validation error'
    runs-on: ubuntu-latest
    steps:
    - name: Checkout sources
+8
Changes for setup-gradle/action.yml: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -100,6 +100,14 @@ inputs:
    description: Indicate that you agree to the Build Scan® terms of use. This input value must be "yes".
    required: false

  # Wrapper validation configuration
  validate-wrappers:
    description: |
      When 'true', the action will perform the 'wrapper-validation' action automatically.
      If the wrapper checksums are not valid, the action will fail.
    required: false
    default: false

  # DEPRECATED ACTION INPUTS
  build-scan-terms-of-service-url:
    description: The URL to the Build Scan® terms of use. This input must be set to 'https://gradle.com/terms-of-service'.
+4
Changes for sources/src/configuration.ts: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -261,6 +261,10 @@ export class GradleExecutionConfig {
    }
}

export function doValidateWrappers(): boolean {
    return getBooleanInput('validate-wrappers')
}

// Internal parameters
export function getJobMatrix(): string {
    return core.getInput('workflow-job-context')
+2 −2
Changes for sources/src/dependency-graph.ts: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ import type {PullRequestEvent} from '@octokit/webhooks-types'
import * as path from 'path'
import fs from 'fs'

import {PostActionJobFailure} from './errors'
import {JobFailure} from './errors'
import {DependencyGraphConfig, DependencyGraphOption, getGithubToken, getWorkspaceDirectory} from './configuration'

const DEPENDENCY_GRAPH_PREFIX = 'dependency-graph_'
@@ -208,7 +208,7 @@ function markProcessed(dependencyGraphFile: string): void {

function warnOrFail(config: DependencyGraphConfig, option: String, error: unknown): void {
    if (!config.getDependencyGraphContinueOnFailure()) {
        throw new PostActionJobFailure(error)
        throw new JobFailure(error)
    }

    core.warning(`Failed to ${option} dependency graph. Will continue.\n${String(error)}`)
Loading