Skip to content

Commit

Permalink
0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
al8n committed May 24, 2024
1 parent 7c7fb77 commit dab17d2
Show file tree
Hide file tree
Showing 22 changed files with 2,006 additions and 184 deletions.
24 changes: 24 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
codecov:
require_ci_to_pass: false

ignore:
- benchmark/

coverage:
status:
project: # Overall project status
default:
target: auto
if_not_found: success
only_pulls: false
patch: # Status for the patch in pull requests
default:
target: auto
if_not_found: success
only_pulls: true
changes: false # Whether to comment on the coverage changes in pull requests

comment:
layout: "header, diff, files, footer"
behavior: default
require_changes: false
64 changes: 64 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Benchmark

on:
push:
branches:
- main
paths-ignore:
- 'README'
- 'COPYRIGHT'
- 'LICENSE-*'
- '**.md'
- '**.txt'
pull_request:
paths-ignore:
- 'README'
- 'COPYRIGHT'
- 'LICENSE-*'
- '**.md'
- '**.txt'

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -Dwarnings
RUST_BACKTRACE: 1
nightly: nightly
stable: stable

jobs:
benchmark:
name: benchmark
strategy:
matrix:
os:
- ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Cache cargo build and registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-test-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-test-
- name: Install Rust
# --no-self-update is necessary because the windows environment cannot self-update rustup.exe.
run: rustup update stable --no-self-update && rustup default stable
- name: Cache ~/.cargo
uses: actions/cache@v3
with:
path: ~/.cargo
key: ${{ runner.os }}-coverage-dotcargo
- name: Run test
run: |
cd benchmark
cargo bench
- name: Upload benchmark results
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: benchmark/target/criterion
99 changes: 15 additions & 84 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ on:
- '**.md'
- '**.txt'

workflow_dispatch:

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -Dwarnings
Expand Down Expand Up @@ -63,7 +65,7 @@ jobs:
- name: Install cargo-hack
run: cargo install cargo-hack
- name: Apply clippy lints
run: cargo hack clippy --each-feature
run: cargo hack clippy --each-feature --exclude-no-default-features

# Run tests on some extra platforms
cross:
Expand Down Expand Up @@ -104,13 +106,13 @@ jobs:
run: |
cargo install cross
cross build --target ${{ matrix.target }}
if: matrix.target != 'wasm32-unknown-unknown'
# # WASM support
# - name: cargo build --target ${{ matrix.target }}
# run: |
# rustup target add ${{ matrix.target }}
# cargo build --features js --target ${{ matrix.target }}
# if: matrix.target == 'wasm32-unknown-unknown'
if: matrix.target != 'wasm32-unknown-unknown' && matrix.target != 'wasm32-wasi'
# WASM support
- name: cargo build --target ${{ matrix.target }}
run: |
rustup target add ${{ matrix.target }}
cargo build --target ${{ matrix.target }}
if: matrix.target == 'wasm32-unknown-unknown' || matrix.target == 'wasm32-wasi'
# - name: cargo build --target ${{ matrix.target }}
# run: |
# rustup target add ${{ matrix.target }}
Expand Down Expand Up @@ -149,7 +151,7 @@ jobs:
path: ~/.cargo
key: ${{ runner.os }}-coverage-dotcargo
- name: Run build
run: cargo hack build --feature-powerset
run: cargo hack build --feature-powerset --exclude-no-default-features

test:
name: test
Expand Down Expand Up @@ -183,16 +185,14 @@ jobs:
path: ~/.cargo
key: ${{ runner.os }}-coverage-dotcargo
- name: Run test
run: cargo hack test --feature-powerset
run: cargo hack test --tests --feature-powerset --exclude-no-default-features --exclude-all-features

sanitizer:
name: sanitizer
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand All @@ -210,8 +210,6 @@ jobs:
run: rustup update $nightly && rustup default $nightly
- name: Install rust-src
run: rustup component add rust-src
- name: Install cargo-hack
run: cargo install cargo-hack
- name: ASAN / LSAN / TSAN
run: ci/sanitizer.sh

Expand All @@ -236,8 +234,6 @@ jobs:
key: ${{ runner.os }}-miri-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-miri-
- name: Install cargo-hack
run: cargo install cargo-hack
- name: Miri
run: ci/miri.sh
loom:
Expand All @@ -263,71 +259,8 @@ jobs:
${{ runner.os }}-loom-
- name: Install Rust
run: rustup update $nightly && rustup default $nightly
- name: Install cargo-hack
run: cargo install cargo-hack
- name: Loom tests
run: RUSTFLAGS="--cfg loom -Dwarnings" cargo hack test --test loom

# valgrind
valgrind:
name: valgrind
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache cargo build and registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ubuntu-latest-valgrind-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
ubuntu-latest-valgrind-
- name: Install Rust ${{ env.stable }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.stable }}
override: true
- name: Install Valgrind
run: |
sudo apt-get update -y
sudo apt-get install -y valgrind
# Compile tests
# - name: cargo build foo
# run: cargo build --bin foo
# working-directory: integration

# Run with valgrind
# - name: Run valgrind foo
# run: valgrind --error-exitcode=1 --leak-check=full --show-leak-kinds=all ./target/debug/foo
# working-directory: integration

docs:
name: docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache cargo build and registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ubuntu-latest-docs-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
ubuntu-latest-docs-
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.nightly }}
override: true
- name: "doc --lib --all-features"
run: cargo doc --lib --no-deps --all-features
env:
RUSTFLAGS: --cfg docsrs
RUSTDOCFLAGS: --cfg docsrs -Dwarnings
run: cargo test --tests --features loom

coverage:
name: coverage
Expand All @@ -339,9 +272,7 @@ jobs:
- cross
- test
- sanitizer
- miri
- loom
- docs
steps:
- uses: actions/checkout@v3
- name: Install latest nightly
Expand All @@ -367,9 +298,9 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: tarpaulin
args: --all-features --run-types tests --run-types doctests --workspace --out xml
args: --run-types tests --run-types doctests --workspace --out xml
- name: Upload to codecov.io
uses: codecov/codecov-action@v3.1.1
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
58 changes: 58 additions & 0 deletions .github/workflows/loc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: loc

on:
push:
branches:
- main
paths-ignore:
- 'README.md'
- 'COPYRIGHT'
- 'LICENSE*'
- '**.md'
- '**.txt'
- 'art'
pull_request:
paths-ignore:
- 'README.md'
- 'COPYRIGHT'
- 'LICENSE*'
- '**.md'
- '**.txt'
- 'art'
workflow_dispatch:

jobs:
loc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install Rust
run: |
rustup update stable && rustup default stable
rustup component add clippy
rustup component add rustfmt
- name: Install tokeit
run: |
cargo install tokeit --force
- name: Count total lines of code
run: |
tokeit
- name: Upload total loc to GitHub Gist
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GIST_PAT }}
script: |
const fs = require('fs');
const output = fs.readFileSync('tokeit.json', 'utf8');
const gistId = '327b2a8aef9003246e45c6e47fe63937';
await github.rest.gists.update({
gist_id: gistId,
files: {
"objectpool": {
content: output
}
}
});
7 changes: 3 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# UNRELEASED

# 0.1.2 (January 6th, 2022)

FEATURES
# CHANGELOG

## 0.1.0

## UNRELEASED
43 changes: 16 additions & 27 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,37 +1,26 @@
[package]
name = "template-rs"
version = "0.1.6"
name = "objectpool"
version = "0.1.0"
edition = "2021"
repository = "https://github.com/al8n/template-rs"
homepage = "https://github.com/al8n/template-rs"
documentation = "https://docs.rs/template-rs"
description = "A template for creating Rust open-source repo on GitHub"
license = "MIT/Apache-2.0"
rust-version = "1.73"

[[bench]]
path = "benches/foo.rs"
name = "foo"
harness = false
repository = "https://github.com/al8n/objectpool"
homepage = "https://github.com/al8n/objectpool"
documentation = "https://docs.rs/objectpool"
description = "Yet another lock-free object pool, support no_std"
license = "MIT OR Apache-2.0"
rust-version = "1.56"
keywords = ["atomic", "object-pool", "lockfree-object-pool", "non-blocking", "lock-free"]
categories = ["concurrency", "memory-management", "data-structures", "development-tools", "no-std"]
exclude = ["benchmark"]

[features]
default = []
default = ["std"]
alloc = ["crossbeam-queue/alloc"]
std = ["crossbeam-queue/default"]

[dependencies]
crossbeam-queue = { version = "0.3", default-features = false }

[dev-dependencies]
criterion = "0.5"
tempfile = "3"

[profile.bench]
opt-level = 3
debug = false
codegen-units = 1
lto = 'thin'
incremental = false
debug-assertions = false
overflow-checks = false
rpath = false
loom = { version = "0.7", optional = true }

[package.metadata.docs.rs]
all-features = true
Expand Down
Loading

0 comments on commit dab17d2

Please sign in to comment.