From 86316020a55e1a65f7a673a58daaac2a96216912 Mon Sep 17 00:00:00 2001 From: Franz Busch Date: Thu, 11 Jul 2024 12:23:24 +0200 Subject: [PATCH] [GHA] Benchmark job (#2780) --- .github/workflows/pull_request.yml | 4 +- .github/workflows/reusable_pull_request.yml | 42 ++++++++++++++++++- ...reBenchmarks.NIOAsyncChannel.init.p90.json | 0 .../NIOPosixBenchmarks.TCPEcho.p90.json | 0 ...sixBenchmarks.TCPEchoAsyncChannel.p90.json | 0 ...reBenchmarks.NIOAsyncChannel.init.p90.json | 3 ++ .../NIOPosixBenchmarks.TCPEcho.p90.json | 3 ++ ...sixBenchmarks.TCPEchoAsyncChannel.p90.json | 3 ++ 8 files changed, 53 insertions(+), 2 deletions(-) rename Benchmarks/Thresholds/{main => nightly-main}/NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json (100%) rename Benchmarks/Thresholds/{main => nightly-main}/NIOPosixBenchmarks.TCPEcho.p90.json (100%) rename Benchmarks/Thresholds/{main => nightly-main}/NIOPosixBenchmarks.TCPEchoAsyncChannel.p90.json (100%) create mode 100644 Benchmarks/Thresholds/nightly-next/NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json create mode 100644 Benchmarks/Thresholds/nightly-next/NIOPosixBenchmarks.TCPEcho.p90.json create mode 100644 Benchmarks/Thresholds/nightly-next/NIOPosixBenchmarks.TCPEchoAsyncChannel.p90.json diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 5ebeeca100..b2e62dbd26 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -7,4 +7,6 @@ on: jobs: call-reusable-pull-request-workflow: name: Checks - uses: ./.github/workflows/reusable_pull_request.yml \ No newline at end of file + uses: ./.github/workflows/reusable_pull_request.yml + with: + benchmarks_linux_package_path: "Benchmarks" \ No newline at end of file diff --git a/.github/workflows/reusable_pull_request.yml b/.github/workflows/reusable_pull_request.yml index 751da8ec64..f6ae37340f 100644 --- a/.github/workflows/reusable_pull_request.yml +++ b/.github/workflows/reusable_pull_request.yml @@ -7,6 +7,14 @@ on: type: boolean description: "Boolean to enable the unit tests linux job. Defaults to true." default: true + benchmarks_linux_enabled: + type: boolean + description: "Boolean to enable the benchmarks linux job. Defaults to true." + default: true + benchmarks_linux_package_path: + type: string + description: "Path to the package containing the benchmarks. Defaults to the repository root." + default: "." api_breakage_check_enabled: type: boolean description: "Boolean to enable the API breakage check job. Defaults to true." @@ -40,7 +48,7 @@ jobs: swift: - image: swift:5.8-jammy - image: swift:5.9-jammy - - image: swift:5.10-noble + - image: swift:5.10-jammy - image: swiftlang/swift:nightly-6.0-jammy - image: swiftlang/swift:nightly-main-jammy container: @@ -51,6 +59,38 @@ jobs: uses: actions/checkout@v4 - name: Run tests run: swift test + + benchmarks-linux: + name: Benchmarks + if: ${{ inputs.benchmarks_linux_enabled }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + swift: + - image: swift:5.8-jammy + swift_version: "5.8" + - image: swift:5.9-jammy + swift_version: "5.9" + - image: swift:5.10-jammy + swift_version: "5.10" + - image: swiftlang/swift:nightly-6.0-jammy + swift_version: "nightly-next" + - image: swiftlang/swift:nightly-main-jammy + swift_version: "nightly-main" + container: + image: ${{ matrix.swift.image }} + timeout-minutes: 20 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Run tests + env: + PACKAGE_PATH: ${{ inputs.benchmarks_linux_package_path }} + SWIFT_VERSION: ${{ matrix.swift.swift_version }} + run: | + apt-get update -y -q && apt-get install -y -q libjemalloc-dev + swift package --package-path ${PACKAGE_PATH} --disable-sandbox benchmark baseline check --check-absolute-path ${PACKAGE_PATH}/Thresholds/${SWIFT_VERSION}/ api-breakage-check: name: API breakage check diff --git a/Benchmarks/Thresholds/main/NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json b/Benchmarks/Thresholds/nightly-main/NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json similarity index 100% rename from Benchmarks/Thresholds/main/NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json rename to Benchmarks/Thresholds/nightly-main/NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json diff --git a/Benchmarks/Thresholds/main/NIOPosixBenchmarks.TCPEcho.p90.json b/Benchmarks/Thresholds/nightly-main/NIOPosixBenchmarks.TCPEcho.p90.json similarity index 100% rename from Benchmarks/Thresholds/main/NIOPosixBenchmarks.TCPEcho.p90.json rename to Benchmarks/Thresholds/nightly-main/NIOPosixBenchmarks.TCPEcho.p90.json diff --git a/Benchmarks/Thresholds/main/NIOPosixBenchmarks.TCPEchoAsyncChannel.p90.json b/Benchmarks/Thresholds/nightly-main/NIOPosixBenchmarks.TCPEchoAsyncChannel.p90.json similarity index 100% rename from Benchmarks/Thresholds/main/NIOPosixBenchmarks.TCPEchoAsyncChannel.p90.json rename to Benchmarks/Thresholds/nightly-main/NIOPosixBenchmarks.TCPEchoAsyncChannel.p90.json diff --git a/Benchmarks/Thresholds/nightly-next/NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json b/Benchmarks/Thresholds/nightly-next/NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json new file mode 100644 index 0000000000..4a3c90c5f3 --- /dev/null +++ b/Benchmarks/Thresholds/nightly-next/NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json @@ -0,0 +1,3 @@ +{ + "mallocCountTotal" : 12 +} diff --git a/Benchmarks/Thresholds/nightly-next/NIOPosixBenchmarks.TCPEcho.p90.json b/Benchmarks/Thresholds/nightly-next/NIOPosixBenchmarks.TCPEcho.p90.json new file mode 100644 index 0000000000..c6a93680d0 --- /dev/null +++ b/Benchmarks/Thresholds/nightly-next/NIOPosixBenchmarks.TCPEcho.p90.json @@ -0,0 +1,3 @@ +{ + "mallocCountTotal" : 108 +} diff --git a/Benchmarks/Thresholds/nightly-next/NIOPosixBenchmarks.TCPEchoAsyncChannel.p90.json b/Benchmarks/Thresholds/nightly-next/NIOPosixBenchmarks.TCPEchoAsyncChannel.p90.json new file mode 100644 index 0000000000..361ee44ab6 --- /dev/null +++ b/Benchmarks/Thresholds/nightly-next/NIOPosixBenchmarks.TCPEchoAsyncChannel.p90.json @@ -0,0 +1,3 @@ +{ + "mallocCountTotal" : 165000 +}