Skip to content

Merge pull request #99 from okx/release/v0.1.0 #231

Merge pull request #99 from okx/release/v0.1.0

Merge pull request #99 from okx/release/v0.1.0 #231

Workflow file for this run

name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "*" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
env:
CODE_COV_VAL: '0'
steps:
- name: Clone main repository
uses: actions/checkout@v4
- uses: moonrepo/setup-rust@v1
with:
components: rustfmt
cache: false
name: Setup Rust Toolchain
- uses: Swatinem/rust-cache@v2
name: Cache Rust Dependencies
- run: export RUSTFLAGS="-D warnings" && cargo build
name: Run build scripts
- name: Check Format
run: cargo fmt --check
working-directory: .
- name: Run Clippy
run: rustup component add clippy && cargo clippy
working-directory: .
- name: Install dependencies
run: sudo apt-get install -y musl-tools
- name: Install tarpaulin
run: cargo install cargo-tarpaulin
- name: Run tests with coverage
run: |
cargo tarpaulin --lib --out Html --output-dir target/debug/tarpaulin/ -- --nocapture > test.log
LAST_LINE=$( tail -n 1 test.log)
CODE_COV=$(echo "$LAST_LINE" | cut -d '%' -f 1)
echo "CODE_COV: $CODE_COV"
COLOR=$(
float=$(echo "$CODE_COV" | bc)
threshold=80.0
if (( $(echo "$float > $threshold" | bc -l) )); then
echo "brightgreen"
else
echo "yellow"
fi
)
echo "COLOR: $COLOR"
sh ./scripts/gen_svg.sh $COLOR $CODE_COV
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./target/debug/tarpaulin/
publish_branch: gh-pages