Skip to content

Commit

Permalink
Merge branch 'add-ci'
Browse files Browse the repository at this point in the history
  • Loading branch information
connortsui20 committed Jan 9, 2025
2 parents b46b5ad + 68e12f9 commit 18ecd40
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 51 deletions.
23 changes: 23 additions & 0 deletions .github/DOCS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Github config and workflows

In this folder there is configuration for codecoverage, dependabot, and ci
workflows that check the library more deeply than the default configurations.

This folder can be or was merged using a --allow-unrelated-histories merge
strategy from <https://github.com/jonhoo/rust-ci-conf/> which provides a
reasonably sensible base for writing your own ci on. By using this strategy
the history of the CI repo is included in your repo, and future updates to
the CI can be merged later.

To perform this merge run:

```shell
git remote add ci https://github.com/jonhoo/rust-ci-conf.git
git fetch ci
git merge --allow-unrelated-histories ci/main
```

An overview of the files in this project is available at:
<https://www.youtube.com/watch?v=xUH-4y92jPg&t=491s>, which contains some
rationale for decisions and runs through an example of solving minimal version
and OpenSSL issues.
4 changes: 3 additions & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Taken from https://github.com/jonhoo/rust-ci-conf/blob/main/.github/workflows/check.yml

# This workflow runs whenever a PR is opened or updated, or a commit is pushed to main. It runs
# several checks:
# - fmt: checks that the code is formatted according to rustfmt
Expand Down Expand Up @@ -112,7 +114,7 @@ jobs:
# https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability
strategy:
matrix:
msrv: ["1.56.1"] # 2021 edition requires 1.56
msrv: ["1.63.0"] # socket2 package requires 1.63 or newer
name: ubuntu / ${{ matrix.msrv }}
steps:
- uses: actions/checkout@v4
Expand Down
96 changes: 49 additions & 47 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Taken from https://github.com/jonhoo/rust-ci-conf/blob/main/.github/workflows/test.yml

# This is the main CI workflow that runs the test suite on all pushes to main and all pull requests.
# It runs the following jobs:
# - required: runs the test suite on ubuntu with stable and beta rust toolchains
Expand Down Expand Up @@ -107,50 +109,50 @@ jobs:
run: cargo generate-lockfile
- name: cargo test
run: cargo test --locked --all-features --all-targets
coverage:
# use llvm-cov to build and collect coverage and outputs in a format that
# is compatible with codecov.io
#
# note that codecov as of v4 requires that CODECOV_TOKEN from
#
# https://app.codecov.io/gh/<user or org>/<project>/settings
#
# is set in two places on your repo:
#
# - https://github.com/jonhoo/guardian/settings/secrets/actions
# - https://github.com/jonhoo/guardian/settings/secrets/dependabot
#
# (the former is needed for codecov uploads to work with Dependabot PRs)
#
# PRs coming from forks of your repo will not have access to the token, but
# for those, codecov allows uploading coverage reports without a token.
# it's all a little weird and inconvenient. see
#
# https://github.com/codecov/feedback/issues/112
#
# for lots of more discussion
runs-on: ubuntu-latest
name: ubuntu / stable / coverage
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install stable
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: cargo install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: cargo generate-lockfile
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- name: cargo llvm-cov
run: cargo llvm-cov --locked --all-features --lcov --output-path lcov.info
- name: Record Rust version
run: echo "RUST=$(rustc --version)" >> "$GITHUB_ENV"
- name: Upload to codecov.io
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: OS,RUST
# coverage:
# # use llvm-cov to build and collect coverage and outputs in a format that
# # is compatible with codecov.io
# #
# # note that codecov as of v4 requires that CODECOV_TOKEN from
# #
# # https://app.codecov.io/gh/<user or org>/<project>/settings
# #
# # is set in two places on your repo:
# #
# # - https://github.com/jonhoo/guardian/settings/secrets/actions
# # - https://github.com/jonhoo/guardian/settings/secrets/dependabot
# #
# # (the former is needed for codecov uploads to work with Dependabot PRs)
# #
# # PRs coming from forks of your repo will not have access to the token, but
# # for those, codecov allows uploading coverage reports without a token.
# # it's all a little weird and inconvenient. see
# #
# # https://github.com/codecov/feedback/issues/112
# #
# # for lots of more discussion
# runs-on: ubuntu-latest
# name: ubuntu / stable / coverage
# steps:
# - uses: actions/checkout@v4
# with:
# submodules: true
# - name: Install stable
# uses: dtolnay/rust-toolchain@stable
# with:
# components: llvm-tools-preview
# - name: cargo install cargo-llvm-cov
# uses: taiki-e/install-action@cargo-llvm-cov
# - name: cargo generate-lockfile
# if: hashFiles('Cargo.lock') == ''
# run: cargo generate-lockfile
# - name: cargo llvm-cov
# run: cargo llvm-cov --locked --all-features --lcov --output-path lcov.info
# - name: Record Rust version
# run: echo "RUST=$(rustc --version)" >> "$GITHUB_ENV"
# - name: Upload to codecov.io
# uses: codecov/codecov-action@v5
# with:
# fail_ci_if_error: true
# token: ${{ secrets.CODECOV_TOKEN }}
# env_vars: OS,RUST
13 changes: 10 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,25 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
async-channel = "2.3"
async-channel = "2.3.1"
core_affinity = "0.8"
derivative = "2.2"
libc = "0.2"
rand = "0.8"
scc = "2.1"
tokio = { version = "1.39", features = ["macros", "rt", "sync", "time"] }
tokio-uring = "0.5"
zipf = "7.0"

# Pin version "1.27" for a missing method.
tokio = { version = "1.27", features = ["macros", "rt", "sync", "time"] }

# Pin more recent versions for `-Zminimal-versions`.
bitflags = "1.1" # For tokio-uring -> io-uring -> bitflags.
proc-macro2 = "1.0.60" # For a missing feature.
slab = "0.4.4" # For a missing method.

[dev-dependencies]
tokio = { version = "1.39", features = ["full"] }
tokio = { version = "1.27", features = ["full"] }

[profile.dev]
panic = "abort"
Expand Down

0 comments on commit 18ecd40

Please sign in to comment.