Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port banches to criterion and test benches in CI #352

Merged
merged 5 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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