Skip to content

Commit

Permalink
Port banches to criterion and test benches in CI (#352)
Browse files Browse the repository at this point in the history
* Port benches to criterion

Signed-off-by: sagudev <[email protected]>

* join all CI jobs and test benches

Signed-off-by: sagudev <[email protected]>

* Remove unstable rustfmt options

Signed-off-by: sagudev <[email protected]>

* Name `cargo test benches`

* long variable names

Signed-off-by: sagudev <[email protected]>

---------

Signed-off-by: sagudev <[email protected]>
  • Loading branch information
sagudev authored Aug 19, 2024
1 parent b16bee1 commit ccf2aad
Show file tree
Hide file tree
Showing 8 changed files with 329 additions and 496 deletions.
91 changes: 28 additions & 63 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,89 +7,55 @@ on:
workflow_dispatch:
merge_group:
types: [checks_requested]

jobs:
linux-ci:
name: Linux
runs-on: ubuntu-latest
test:
name: ${{ format('{0} {1}', matrix.platform.target, matrix.features)}}
runs-on: ${{ matrix.platform.os }}
env:
RUST_BACKTRACE: 1
strategy:
matrix:
features: ["", "force-inprocess", "memfd", "async"]
platform:
- { target: aarch64-apple-darwin, os: macos-14 }
- { target: x86_64-apple-darwin, os: macos-13 }
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
- { target: x86_64-pc-windows-msvc, os: windows-latest }
- { target: i686-pc-windows-msvc, os: windows-latest }
features: ["", "force-inprocess", "async"]
include:
- features: "windows-shared-memory-equality"
platform: { target: x86_64-pc-windows-msvc, os: windows-latest }
- features: "windows-shared-memory-equality"
platform: { target: i686-pc-windows-msvc, os: windows-latest }
- features: "memfd"
platform: { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@nightly
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- name: rustfmt
run: cargo fmt --check

- name: clippy
run: cargo clippy --features "${{ matrix.features }}"

- name: Cargo build
run: cargo build --features "${{ matrix.features }}"

- name: Cargo test
run: cargo test --features "${{ matrix.features }}"
env:
RUST_BACKTRACE: 1

mac-ci:
name: macOS
runs-on: macos-latest
strategy:
matrix:
features: ["", "force-inprocess", "async"]

steps:
- uses: actions/checkout@v3

- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@nightly

- name: Cargo build
run: cargo build --features "${{ matrix.features }}"
run: cargo clippy --features "${{ matrix.features }}" --target ${{ matrix.platform.target }}

- name: Cargo test
run: cargo test --features "${{ matrix.features }}"
env:
RUST_BACKTRACE: 1

windows-ci:
name: Windows
runs-on: windows-latest
strategy:
matrix:
features: ["", "--features force-inprocess", "--features windows-shared-memory-equality", "--features async"]
target: ["x86_64-pc-windows-msvc", "i686-pc-windows-msvc"]

steps:
- uses: actions/checkout@v3

- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@nightly
with:
targets: ${{ matrix.target }}
run: cargo test --features "${{ matrix.features }}" --target ${{ matrix.platform.target }}

- name: Cargo build
run: cargo build ${{ matrix.features }} --target ${{ matrix.target }}

- name: Cargo test
run: cargo test ${{ matrix.features }} --target ${{ matrix.target }}
env:
RUST_BACKTRACE: 1
- name: Cargo test benches
run: cargo test --benches --features "${{ matrix.features }}" --target ${{ matrix.platform.target }}

build_result:
name: Result
runs-on: ubuntu-latest
if: always()
needs:
- "linux-ci"
- "mac-ci"
- "windows-ci"
- "test"

steps:
- name: Success
Expand All @@ -98,4 +64,3 @@ jobs:
- name: Failure
run: exit 1
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')

13 changes: 13 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ license = "MIT OR Apache-2.0"
repository = "https://github.com/servo/ipc-channel"
edition = "2021"

[[bench]]
name = "platform"
harness = false

[[bench]]
name = "ipc"
harness = false

[[bench]]
name = "ipc_receiver_set"
harness = false

[features]
force-inprocess = []
memfd = ["sc"]
Expand Down Expand Up @@ -34,6 +46,7 @@ tempfile = "3.4"
[dev-dependencies]
crossbeam-utils = "0.8"
static_assertions = "1.1.0"
criterion = { version = "0.5", features = ["html_reports"] }

[target.'cfg(target_os = "windows")'.dependencies.windows]
version = "0.58.0"
Expand Down
Loading

0 comments on commit ccf2aad

Please sign in to comment.