Skip to content

Commit

Permalink
up munit version and change leak test params (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
kovstas committed Jun 1, 2024
1 parent 9143613 commit 3a53f42
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 97 deletions.
152 changes: 61 additions & 91 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build
on:
push:
branches: [ main ]
tags: ["*"]
tags: [ "*" ]
paths-ignore:
- '**/*.md'
pull_request:
Expand All @@ -16,44 +16,30 @@ jobs:
name: Build and Test
strategy:
matrix:
os: [ubuntu-22.04]
scala: [3.4.2, 2.12.19, 2.13.14]
java: [temurin@17]
project: [rootJS, root, rootNative]
os: [ ubuntu-latest ]
scala: [ 2.12, 2.13, 3 ]
java: [ temurin@17 ]
project: [ rootJS, root, rootNative ]
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Download Java (temurin@17)
id: download-java-temurin-17
if: matrix.java == 'temurin@17'
uses: typelevel/download-java@v1
with:
distribution: temurin
java-version: 17

- name: Setup Java (temurin@17)
id: setup-java-temurin-17
if: matrix.java == 'temurin@17'
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
distribution: jdkfile
distribution: temurin
java-version: 17
jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }}
cache: sbt

- name: Cache sbt
uses: actions/cache@v2
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
- name: sbt update
if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false'
run: sbt +update

- name: Install brew formulae (ubuntu)
if: (matrix.project == 'rootNative') && startsWith(matrix.os, 'ubuntu')
Expand Down Expand Up @@ -84,7 +70,7 @@ jobs:

- name: Upload target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ matrix.project }}
path: targets.tar
Expand All @@ -95,122 +81,106 @@ jobs:
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
strategy:
matrix:
os: [ ubuntu-22.04 ]
scala: [ 2.13.14 ]
os: [ ubuntu-latest ]
java: [ temurin@17 ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Download Java (temurin@17)
id: download-java-temurin-17
if: matrix.java == 'temurin@17'
uses: typelevel/download-java@v1
with:
distribution: temurin
java-version: 17

- name: Setup Java (temurin@17)
id: setup-java-temurin-17
if: matrix.java == 'temurin@17'
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
distribution: jdkfile
distribution: temurin
java-version: 17
jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }}
cache: sbt

- name: sbt update
if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false'
run: sbt +update

- name: Cache sbt
uses: actions/cache@v2
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Download target directories (3.4.2, rootJS)
uses: actions/download-artifact@v2
- name: Download target directories (3, rootJS)
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.4.2-rootJS
name: target-${{ matrix.os }}-${{ matrix.java }}-3-rootJS

- name: Inflate target directories (3.4.2, rootJS)
- name: Inflate target directories (3, rootJS)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.4.2, root)
uses: actions/download-artifact@v2
- name: Download target directories (3, root)
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.4.2-root
name: target-${{ matrix.os }}-${{ matrix.java }}-3-root

- name: Inflate target directories (3.4.2, root)
- name: Inflate target directories (3, root)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.4.2, rootNative)
uses: actions/download-artifact@v2
- name: Download target directories (3, rootNative)
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.4.2-rootNative
name: target-${{ matrix.os }}-${{ matrix.java }}-3-rootNative

- name: Inflate target directories (3.4.2, rootNative)
- name: Inflate target directories (3, rootNative)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.12.19, rootJS)
uses: actions/download-artifact@v2
- name: Download target directories (2.12, rootJS)
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.19-rootJS
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12-rootJS

- name: Inflate target directories (2.12.19, rootJS)
- name: Inflate target directories (2.12, rootJS)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.12.19, root)
uses: actions/download-artifact@v2
- name: Download target directories (2.12, root)
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.19-root
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12-root

- name: Inflate target directories (2.12.19, root)
- name: Inflate target directories (2.12, root)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.12.19, rootNative)
uses: actions/download-artifact@v2
- name: Download target directories (2.12, rootNative)
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.19-rootNative
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12-rootNative

- name: Inflate target directories (2.12.19, rootNative)
- name: Inflate target directories (2.12, rootNative)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.13.14, rootJS)
uses: actions/download-artifact@v2
- name: Download target directories (2.13, rootJS)
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.14-rootJS
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-rootJS

- name: Inflate target directories (2.13.14, rootJS)
- name: Inflate target directories (2.13, rootJS)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.13.14, root)
uses: actions/download-artifact@v2
- name: Download target directories (2.13, root)
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.14-root
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-root

- name: Inflate target directories (2.13.14, root)
- name: Inflate target directories (2.13, root)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.13.14, rootNative)
uses: actions/download-artifact@v2
- name: Download target directories (2.13, rootNative)
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.14-rootNative
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-rootNative

- name: Inflate target directories (2.13.14, rootNative)
- name: Inflate target directories (2.13, rootNative)
run: |
tar xf targets.tar
rm targets.tar
Expand Down
3 changes: 3 additions & 0 deletions .sbtopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-J-Xms2g
-J-Xmx4g
-J-XX:MaxMetaspaceSize=512m
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ThisBuild / scalacOptions ++= scalaOptions(scalaVersion.value)

ThisBuild / libraryDependencies ++= Seq(
"co.fs2" %% "fs2-core" % "3.10.2",
"org.scalameta" %% "munit" % "0.7.29" % Test,
"org.scalameta" %% "munit" % "1.0.0" % Test,
"org.typelevel" %% "cats-effect-testkit" % "3.5.4" % Test
)

Expand Down
10 changes: 5 additions & 5 deletions src/test/scala/dev/kovstas/fs2throttler/MemoryLeakSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ class MemoryLeakSpec extends FunSuite {
override def munitFlakyOK = true

case class LeakTestParams(
warmupIterations: Int = 5,
samplePeriod: FiniteDuration = 3.seconds,
monitorPeriod: FiniteDuration = 60.seconds,
warmupIterations: Int = 3,
samplePeriod: FiniteDuration = 1.seconds,
monitorPeriod: FiniteDuration = 20.seconds,
limitTotalBytesIncreasePerSecond: Long = 700000,
limitConsecutiveIncreases: Int = 10
)
Expand Down Expand Up @@ -139,14 +139,14 @@ class MemoryLeakSpec extends FunSuite {
Stream
.range(0, 1000000)
.covary[IO]
.through(Throttler.throttle(100, 100.millis, Enforcing))
.through(Throttler.throttle(100, 10.millis, Enforcing))
}

leakTest("Throttler.throttle shaping") {
Stream
.range(0, 1000000)
.covary[IO]
.through(Throttler.throttle(100, 100.millis, Shaping))
.through(Throttler.throttle(100, 10.millis, Shaping))
}

}

0 comments on commit 3a53f42

Please sign in to comment.