chore: setup ci for testing with docker compose #75
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: Rust CI | |
on: | |
push: | |
branches: | |
- main | |
- sepolia-db | |
pull_request: | |
branches: | |
- main | |
- sepolia-db | |
jobs: | |
fmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: Swatinem/rust-cache@v2 | |
- name: Setup toolchain | |
run: rustup toolchain install stable | |
- name: Install dependencies | |
run: cargo fetch | |
- name: Install coverage tool | |
run: cargo install cargo-tarpaulin | |
- name: Check code formatting | |
run: cargo fmt -- --check | |
clippy: | |
needs: [fmt] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: Swatinem/rust-cache@v2 | |
- name: Run Clippy | |
run: cargo clippy --all-targets --all-features -- -D warnings | |
tests: | |
needs: [fmt, clippy] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: Swatinem/rust-cache@v2 | |
- name: Setup test env | |
uses: hoverkraft-tech/[email protected] | |
with: | |
compose-file: "./docker-compose.test.yml" | |
- name: Install required tools | |
run: cargo install cargo-llvm-cov | |
- run: chmod +x scripts/run-coverage.sh | |
- name: Run tests | |
run: scripts/run-coverage.sh | |
- name: Report code coverage | |
uses: zgosalvez/github-actions-report-lcov@v4 | |
with: | |
coverage-files: lcov.info | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
update-comment: true |