generated from cloudwego/.github
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
uses grcov for code coverage; also add integration test code; add git…
…hub actions Change-Id: If2ccf470a3139c53745a05bd65d6cb1cdeaf02f9
- Loading branch information
xiaosong yang
committed
Mar 27, 2024
1 parent
a88d2ca
commit 0bf85de
Showing
10 changed files
with
350 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env sh | ||
|
||
if [ "${NO_RUN}" != "1" ] && [ "${NO_RUN}" != "true" ]; then | ||
|
||
set -ex | ||
|
||
CARGO=cargo | ||
if [ "${CROSS}" = "1" ]; then | ||
export CARGO_NET_RETRY=5 | ||
export CARGO_NET_TIMEOUT=10 | ||
|
||
cargo install cross | ||
CARGO=cross | ||
fi | ||
|
||
# If a test crashes, we want to know which one it was. | ||
export RUST_TEST_THREADS=1 | ||
export RUST_BACKTRACE=1 | ||
|
||
# test monoio mod | ||
cd "${PROJECT_DIR}"/monolake | ||
|
||
# only enable legacy driver | ||
"${CARGO}" test --target "${TARGET}" --no-default-features --features "async-cancel,bytes,legacy,macros,utils" | ||
"${CARGO}" test --target "${TARGET}" --no-default-features --features "async-cancel,bytes,legacy,macros,utils" --release | ||
|
||
if [ "${TARGET}" = "x86_64-unknown-linux-gnu" ] || [ "${TARGET}" = "i686-unknown-linux-gnu" ]; then | ||
# only enabled uring driver | ||
"${CARGO}" test --target "${TARGET}" --no-default-features --features "async-cancel,bytes,iouring,macros,utils" | ||
"${CARGO}" test --target "${TARGET}" --no-default-features --features "async-cancel,bytes,iouring,macros,utils" --release | ||
fi | ||
|
||
if [ "${TARGET}" != "aarch64-unknown-linux-gnu" ] && [ "${TARGET}" != "armv7-unknown-linux-gnueabihf" ] && | ||
[ "${TARGET}" != "riscv64gc-unknown-linux-gnu" ] && [ "${TARGET}" != "s390x-unknown-linux-gnu" ]; then | ||
# enable uring+legacy driver | ||
"${CARGO}" test --target "${TARGET}" | ||
"${CARGO}" test --target "${TARGET}" --release | ||
fi | ||
|
||
if [ "${CHANNEL}" == "nightly" ] && ( [ "${TARGET}" = "x86_64-unknown-linux-gnu" ] || [ "${TARGET}" = "i686-unknown-linux-gnu" ] ); then | ||
"${CARGO}" test --target "${TARGET}" --all-features | ||
"${CARGO}" test --target "${TARGET}" --all-features --release | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
paths-ignore: | ||
- '**.md' | ||
- '**.png' | ||
pull_request: | ||
paths-ignore: | ||
- '**.md' | ||
- '**.png' | ||
|
||
env: | ||
TOOLCHAIN_PROFILE: minimal | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v2 | ||
- name: Install toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: ${{ env.TOOLCHAIN_PROFILE }} | ||
toolchain: ${{ matrix.target == 'i686-pc-windows-gnu' && format('{0}-i686-pc-windows-gnu', matrix.channel) || matrix.channel }} | ||
target: ${{ matrix.target }} | ||
override: true | ||
components: rustfmt, clippy | ||
- name: Cache | ||
uses: Swatinem/rust-cache@v1 | ||
- name: Run cargo fmt | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: fmt | ||
args: --all -- --check | ||
- name: Run cargo check with no default features | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: check | ||
args: --no-default-features | ||
- name: Run cargo clippy | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: clippy | ||
args: -- -D warnings | ||
- env: | ||
CHANNEL: ${{ matrix.channel }} | ||
CROSS: ${{ !startsWith(matrix.target, 'x86_64') && contains(matrix.target, 'linux') && '1' || '0' }} | ||
TARGET: ${{ matrix.target }} | ||
OS: ${{ matrix.os }} | ||
PROJECT_DIR: ${{ github.workspace }} | ||
NO_RUN: ${{ matrix.no_run }} | ||
run: sh .github/workflows/ci.sh | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
target: [ | ||
x86_64-unknown-linux-gnu, | ||
i686-unknown-linux-gnu, | ||
aarch64-unknown-linux-gnu, | ||
armv7-unknown-linux-gnueabihf, | ||
riscv64gc-unknown-linux-gnu, | ||
s390x-unknown-linux-gnu, | ||
# mips64-unknown-linux-muslabi64, | ||
# loongarch64-unknown-linux-gnu, | ||
|
||
x86_64-apple-darwin, | ||
aarch64-apple-darwin, | ||
|
||
x86_64-pc-windows-gnu, | ||
x86_64-pc-windows-msvc, | ||
i686-pc-windows-gnu, | ||
i686-pc-windows-msvc, | ||
] | ||
channel: [stable, nightly] | ||
include: | ||
- target: x86_64-unknown-linux-gnu | ||
os: ubuntu-latest | ||
- target: i686-unknown-linux-gnu | ||
os: ubuntu-latest | ||
- target: aarch64-unknown-linux-gnu | ||
os: ubuntu-latest | ||
- target: armv7-unknown-linux-gnueabihf | ||
os: ubuntu-latest | ||
- target: riscv64gc-unknown-linux-gnu | ||
os: ubuntu-latest | ||
- target: s390x-unknown-linux-gnu | ||
os: ubuntu-latest | ||
# - target: mips64-unknown-linux-muslabi64 | ||
# os: ubuntu-latest | ||
# - target: loongarch64-unknown-linux-gnu | ||
# os: ubuntu-latest | ||
|
||
- target: x86_64-apple-darwin | ||
os: macos-latest | ||
- target: aarch64-apple-darwin | ||
os: macos-14 | ||
|
||
- target: x86_64-pc-windows-msvc | ||
os: windows-latest | ||
- target: x86_64-pc-windows-gnu | ||
os: windows-latest | ||
- target: i686-pc-windows-msvc | ||
os: windows-latest | ||
- target: i686-pc-windows-gnu | ||
os: windows-latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Code Coverage | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths-ignore: | ||
- '**.md' | ||
- '**.png' | ||
|
||
env: | ||
RUST_TOOLCHAIN: nightly | ||
TOOLCHAIN_PROFILE: minimal | ||
|
||
jobs: | ||
coverage: | ||
name: Run cargo coverage | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v2 | ||
- name: Install toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: ${{ env.TOOLCHAIN_PROFILE }} | ||
toolchain: ${{ env.RUST_TOOLCHAIN }} | ||
override: true | ||
components: llvm-tools-preview | ||
- name: Install grcov | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: install | ||
args: grcov | ||
- name: Cache | ||
uses: Swatinem/rust-cache@v1 | ||
- name: Run cargo test | ||
run: sudo bash -c "ulimit -Sl 512 && ulimit -Hl 512 && sudo -u runner RUSTUP_TOOLCHAIN=nightly RUSTFLAGS="-Cinstrument-coverage" LLVM_PROFILE_FILE="coverage-%p-%m.profraw" /home/runner/.cargo/bin/cargo test --all-features" | ||
- name: Run grcov | ||
run: grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "*cargo*" -o lcov.info | ||
- name: Upload coverage | ||
run: bash <(curl -s https://codecov.io/bash) -f lcov.info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
.idea | ||
.swp | ||
*.pem | ||
*.profraw | ||
|
||
/examples/certs | ||
/docs/cloudwego.github.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.