Skip to content

go

go #23

Workflow file for this run

name: dev-crates
on:
push:
paths:
- 'crates/**'
branches-ignore:
- 'master'
jobs:
test:
name: crates
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy, rustfmt
- uses: taiki-e/install-action@nextest
- name: crates/types lint
# add packages as args to -p option
run: |
cargo fmt -p pg -p types -p httpclient -- --check
cargo clippy -p pg -p types -p httpclient -- -Dwarnings
working-directory: crates/types
- name: install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: crates/types unit tests
# add packages as args to -p option
run: cargo test -p pg -p types -p httpclient
- name: crates/types coverage report and fail coverage under ${{ env.MIN_CODE_COV }}%
run: |
make rust-coverage RUST_PKG=types
echo "MIN_CODE_COV=$(yq .crates.types.min_code_cov project.yaml)" >> $GITHUB_ENV
echo "CURR_CODE_COV=$(make rust-coverage-percent RUST_PKG=types)" >> $GITHUB_ENV
if [[ ${{ env.CURR_CODE_COV }} -lt ${{ env.MIN_CODE_COV }} ]]; then
echo 'coverage dropped below ${{ env.MIN_CODE_COV }}: ${{ env.CURR_CODE_COV }}%'
exit 1
fi
- name: crates/pg coverage report and fail coverage under ${{ env.MIN_CODE_COV }}%
run: |
make rust-coverage RUST_PKG=pg
echo "MIN_CODE_COV=$(yq .crates.pg.min_code_cov project.yaml)" >> $GITHUB_ENV
if [[ ${{ env.CURR_CODE_COV }} -lt ${{ env.MIN_CODE_COV }} ]]; then
echo 'coverage dropped below ${{ env.MIN_CODE_COV }}: ${{ env.CURR_CODE_COV }}%'
exit 1
fi
- name: crates/httpclient coverage report and fail coverage under ${{ env.MIN_CODE_COV }}%
run: |
make rust-coverage RUST_PKG=httpclient
echo "MIN_CODE_COV=$(yq .crates.httpclient.min_code_cov project.yaml)" >> $GITHUB_ENV
if [[ ${{ env.CURR_CODE_COV }} -lt ${{ env.MIN_CODE_COV }} ]]; then
echo 'coverage dropped below ${{ env.MIN_CODE_COV }}: ${{ env.CURR_CODE_COV }}%'
exit 1
fi