diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ecad562 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,38 @@ +on: [push] + +name: test and publish + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + override: true + - uses: actions-rs/cargo@v1 + with: + command: test + args: --all-features --lib --no-fail-fast + env: + CARGO_INCREMENTAL: '0' + RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' + RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' + - id: coverage + uses: actions-rs/grcov@v0.1 + - name: Coveralls upload + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: ${{ steps.coverage.outputs.report }} + publish: + if: ${{ contains(github.ref, 'refs/tags/v') && needs.test.result == 'success' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions-rs/toolchain@v1 + - uses: actions-rs/cargo@v1 + with: + command: publish + args: --token ${{ CRATES_IO_TOKEN }} diff --git a/README.md b/README.md index 708b9ab..aebd9c2 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ +![MIT licensed](https://img.shields.io/github/license/dedefer/tokio_schedule?style=for-the-badge) +[![Version](https://img.shields.io/crates/v/tokio_schedule?style=for-the-badge)](https://crates.io/crates/tokio_schedule/) +![Code Coverage](https://img.shields.io/coveralls/github/dedefer/tokio_schedule/main?style=for-the-badge) +![Downloads](https://img.shields.io/crates/d/tokio_schedule?style=for-the-badge) + This crate provides a library for scheduling periodic tasks. It is inspired by python's [schedule](https://pypi.org/project/schedule/) lib and provides similar API. It is built on tokio (version 1) and chrono lib diff --git a/src/lib.rs b/src/lib.rs index a971052..45a5b1b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -125,7 +125,7 @@ pub trait Job: Sized + Sync { func().await; }}; - Pin::from(Box::new(fut)) + Box::pin(fut) } }