Skip to content

Commit

Permalink
Merge pull request #780 from robstoll/adjust-codecov-reporting
Browse files Browse the repository at this point in the history
don't upload coverage for push && branch != master
  • Loading branch information
robstoll authored Jan 10, 2021
2 parents 55cd2b6 + 89583b4 commit 623158a
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/workflows/bbc-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:

- name: Upload windows build code coverage
uses: codecov/codecov-action@v1
if: ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'master') }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: bbc
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/bc-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:

- name: Upload windows build code coverage
uses: codecov/codecov-action@v1
if: ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'master') }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: bc
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:

- name: Upload windows build code coverage
uses: codecov/codecov-action@v1
if: ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'master') }}
env:
JAVA_VERSION: ${{ matrix.java_version }}
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ jobs:

- name: Upload windows build code coverage
uses: codecov/codecov-action@v1
if: ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'master') }}
env:
JAVA_VERSION: ${{ matrix.java_version }}
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class IterableAnyAssertionsSpec : Spek({
) = expect.contains(a)


//TODO move to an own spec
private fun getContainsSequencePair() =
"asSequence().${Sequence<*>::asIterable.name}().$contains" to Companion::containsInAnyOrderEntrySequence

Expand All @@ -80,7 +81,7 @@ class IterableAnyAssertionsSpec : Spek({
private fun containsNullableEntrySequence(
expect: Expect<Iterable<Double?>>,
a: (Expect<Double>.() -> Unit)?
) = expect._logic.changeSubject.unreported { it.asSequence() }.asIterable().contains(a)
) = expect._logic.changeSubject.unreported { it.asSequence() }.asIterable { contains(a) }.asIterable()
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class AnyAssertionsSpec : ch.tutteli.atrium.specs.integration.AnyAssertionsSpec(

getAndImmediatePair(),
getAndLazyPair(),
"* ", "- ","(i) "
"* ", "- ", "(i) "
) {

companion object : WithAsciiReporter() {
Expand All @@ -70,23 +70,33 @@ class AnyAssertionsSpec : ch.tutteli.atrium.specs.integration.AnyAssertionsSpec(
expect.isA<SuperType>()

@Suppress("RemoveExplicitTypeArguments")
private fun isASuperType(expect: Expect<out Any?>, assertionCreator: Expect<SuperType>.() -> Unit): Expect<SuperType> =
private fun isASuperType(
expect: Expect<out Any?>,
assertionCreator: Expect<SuperType>.() -> Unit
): Expect<SuperType> =
expect.isA<SuperType> { assertionCreator() }

@Suppress("RemoveExplicitTypeArguments")
private fun isASubTypeFeature(expect: Expect<out Any?>): Expect<SubType> =
expect.isA<SubType>()

@Suppress("RemoveExplicitTypeArguments")
private fun isASubType(expect: Expect<out Any?>, assertionCreator: Expect<SubType>.() -> Unit): Expect<SubType> =
private fun isASubType(
expect: Expect<out Any?>,
assertionCreator: Expect<SubType>.() -> Unit
): Expect<SubType> =
expect.isA<SubType> { assertionCreator() }

private fun getAndImmediatePair(): Pair<String, Expect<Int>.() -> Expect<Int>> =
"non existing in infix" to { e: Expect<Int> -> e }
"and o" to { e: Expect<Int> ->
e and o
}

private val andLazyName: KFunction2<Expect<Int>, Expect<Int>.() -> Unit, Expect<Int>> = Expect<Int>::and
private fun getAndLazyPair(): Pair<String, Expect<Int>.(Expect<Int>.() -> Unit) -> Expect<Int>> =
andLazyName.name to Expect<Int>::and
andLazyName.name to { e: Expect<Int>, assertionCreator: Expect<Int>.() -> Unit ->
e and { assertionCreator() }
}

private fun notToBeNullFeature(expect: Expect<Int?>) =
expect notToBeNull o
Expand All @@ -97,17 +107,29 @@ class AnyAssertionsSpec : ch.tutteli.atrium.specs.integration.AnyAssertionsSpec(
private fun isNoneOfInt(expect: Expect<Int>, expected: Int, otherValues: Array<out Int>): Expect<Int> =
expect isNoneOf values(expected, *otherValues)

private fun isNoneOfIntNullable(expect: Expect<Int?>, expected: Int?, otherValues: Array<out Int?>): Expect<Int?> =
private fun isNoneOfIntNullable(
expect: Expect<Int?>,
expected: Int?,
otherValues: Array<out Int?>
): Expect<Int?> =
expect isNoneOf values(expected, *otherValues)

private fun isNoneOfDataClass(expect: Expect<DataClass>, expected: DataClass, otherValues: Array<out DataClass>): Expect<DataClass> =
private fun isNoneOfDataClass(
expect: Expect<DataClass>,
expected: DataClass,
otherValues: Array<out DataClass>
): Expect<DataClass> =
expect isNoneOf values(expected, *otherValues)

private fun isNoneOfDataClassNullable(expect: Expect<DataClass?>, expected: DataClass?, otherValues: Array<out DataClass?>): Expect<DataClass?> =
private fun isNoneOfDataClassNullable(
expect: Expect<DataClass?>,
expected: DataClass?,
otherValues: Array<out DataClass?>
): Expect<DataClass?> =
expect isNoneOf values(expected, *otherValues)

private fun because(expect: Expect<String>, reason: String, assertionCreator: Expect<String>.() -> Unit) =
expect because of(reason) { assertionCreator() }
expect because of(reason) { assertionCreator() }

private fun becauseOfInt(expect: Expect<Int>, reason: String, assertionCreator: Expect<Int>.() -> Unit) =
expect because of(reason) { assertionCreator() }
Expand All @@ -130,7 +152,7 @@ class AnyAssertionsSpec : ch.tutteli.atrium.specs.integration.AnyAssertionsSpec(
a1.isA<Int> {}
a1 isNoneOf values(1, 2)
a1 isNotIn listOf(1, 1.2)
a1 because of ("hello") { toBe(1) }
a1 because of("hello") { toBe(1) }

a1b toBe 1
a1b toBe 1.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class IterableAnyAssertionsSpec : Spek({
private fun containsNullableEntrySequence(
expect: Expect<Iterable<Double?>>,
a: (Expect<Double>.() -> Unit)?
) = expect._logic.changeSubject.unreported { it.asSequence() } asIterable o contains a
) = expect._logic.changeSubject.unreported { it.asSequence() } asIterable { it contains a } asIterable o
}

@Suppress("unused", "UNUSED_VALUE")
Expand Down

0 comments on commit 623158a

Please sign in to comment.