Skip to content

Commit

Permalink
Fix init script for failure
Browse files Browse the repository at this point in the history
  • Loading branch information
bigdaz committed Jan 12, 2024
1 parent e401e90 commit b87c1cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ class BaseInitScriptTest extends Specification {

static final TestGradleVersion GRADLE_3_X = new TestGradleVersion(GradleVersion.version('3.5.1'), 7, 9)
static final TestGradleVersion GRADLE_4_X = new TestGradleVersion(GradleVersion.version('4.10.3'), 7, 10)
static final TestGradleVersion GRADLE_5_1 = new TestGradleVersion(GradleVersion.version('5.1.1'), 8, 12)
static final TestGradleVersion GRADLE_5_X = new TestGradleVersion(GradleVersion.version('5.6.4'), 8, 12)
static final TestGradleVersion GRADLE_6_NO_BUILD_SERVICE = new TestGradleVersion(GradleVersion.version('6.5.1'), 8, 14)
static final TestGradleVersion GRADLE_6_X = new TestGradleVersion(GradleVersion.version('6.9.4'), 8, 15)
static final TestGradleVersion GRADLE_7_0 = new TestGradleVersion(GradleVersion.version('7.0.1'), 8, 19)
static final TestGradleVersion GRADLE_7_X = new TestGradleVersion(GradleVersion.version('7.6.2'), 8, 19)
static final TestGradleVersion GRADLE_8_0 = new TestGradleVersion(GradleVersion.version('8.0.2'), 8, 19)
static final TestGradleVersion GRADLE_8_X = new TestGradleVersion(GradleVersion.version('8.5'), 8, 19)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import static org.junit.Assume.assumeTrue
class TestDependencyGraph extends BaseInitScriptTest {
def initScript = 'gradle-build-action.github-dependency-graph.init.gradle'

static final List<TestGradleVersion> NO_DEPENDENCY_GRAPH_VERSIONS = [GRADLE_3_X, GRADLE_4_X]
static final List<TestGradleVersion> NO_DEPENDENCY_GRAPH_VERSIONS = [GRADLE_3_X, GRADLE_4_X, GRADLE_5_1, GRADLE_7_0]
static final List<TestGradleVersion> DEPENDENCY_GRAPH_VERSIONS = ALL_VERSIONS - NO_DEPENDENCY_GRAPH_VERSIONS

def "does not produce dependency graph when not enabled"() {
Expand Down Expand Up @@ -48,15 +48,15 @@ class TestDependencyGraph extends BaseInitScriptTest {
testGradleVersion << [GRADLE_8_X]
}

def "warns and produces no dependency graph when enabled for older Gradle versions"() {
def "fails build when enabled for older Gradle versions"() {
assumeTrue testGradleVersion.compatibleWithCurrentJvm

when:
def result = run(['help'], initScript, testGradleVersion.gradleVersion, [], envVars)
def result = runAndFail(['help'], initScript, testGradleVersion.gradleVersion, [], envVars)

then:
assert !reportsDir.exists()
assert result.output.contains("::warning::Dependency Graph is not supported")
assert result.output.contains("GitHubDependencyGraphPlugin is not supported for ${testGradleVersion}")

where:
testGradleVersion << NO_DEPENDENCY_GRAPH_VERSIONS
Expand Down

0 comments on commit b87c1cd

Please sign in to comment.