workflow: add codecov #2086
Workflow file for this run
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
--- | |
name: Limitador | |
on: | |
push: | |
branches: | |
- '*' | |
pull_request: | |
branches: | |
- '*' | |
schedule: | |
- cron: '5 4 * * *' | |
jobs: | |
check: | |
name: Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- uses: abelfodil/protoc-action@v1 | |
with: | |
protoc-version: '3.19.4' | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: check | |
test: | |
name: Test Suite | |
runs-on: ubuntu-latest | |
services: | |
infinispan: | |
image: infinispan/server:11.0.9.Final | |
ports: | |
- 11222:11222 | |
env: | |
USER: username | |
PASS: password | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: supercharge/[email protected] | |
with: | |
redis-version: 5 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- uses: abelfodil/protoc-action@v1 | |
with: | |
protoc-version: '3.19.4' | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --all-features | |
env: | |
LLVM_PROFILE_FILE: "target/coverage/prof/%p-%m.profraw" | |
RUSTFLAGS: "-Cinstrument-coverage" | |
- name: Install grcov | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: grcov | |
- name: Create coverage report | |
run: | | |
grcov \ | |
--source-dir . \ | |
--binary-path target/debug \ | |
--branch \ | |
--excl-start 'mod tests \{' \ | |
--ignore 'tests/*' \ | |
-t lcov \ | |
-o lcov.info \ | |
target/coverage/prof | |
# - name: Install cargo-llvm-cov | |
# uses: taiki-e/install-action@cargo-llvm-cov | |
# - name: Test and Generate code coverage | |
# run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info | |
- name: Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
verbose: true | |
fail_ci_if_error: true | |
fmt: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- run: rustup component add rustfmt | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
clippy: | |
name: Clippy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- run: rustup component add clippy | |
- uses: abelfodil/protoc-action@v1 | |
with: | |
protoc-version: '3.19.4' | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --all-features -- -D warnings | |
bench: | |
name: Bench | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: supercharge/[email protected] | |
with: | |
redis-version: 5 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- uses: abelfodil/protoc-action@v1 | |
with: | |
protoc-version: '3.19.4' | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: bench | |
wasm-build: | |
name: Build for WASM | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: wasm32-unknown-unknown | |
override: true | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --target=wasm32-unknown-unknown --no-default-features --lib --manifest-path ./limitador/Cargo.toml | |
kind: | |
name: Try in kind (Kubernetes in Docker) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- uses: engineerd/[email protected] | |
with: | |
version: v0.11.1 | |
skipClusterCreation: true | |
- run: | | |
./limitador-server/script/kind-setup.sh | |
ips=$(kubectl get nodes -lkubernetes.io/hostname!=kind-control-plane -ojsonpath='{.items[*].status.addresses[?(@.type=="InternalIP")].address}') | |
port=$(kubectl -n default get service kuard -ojsonpath='{.spec.ports[?(@.name=="envoy-http")].nodePort}') | |
curl "http://${ips[0]}:${port}" |