Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ci for tests #4

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
updates:
# Enable version updates for github-actions
- package-ecosystem: "github-actions"
# Look for a `Dockerfile` in the `root` directory
directory: "/"
# Check for updates once a month
schedule:
interval: "monthly"
67 changes: 67 additions & 0 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Quality Check
on:
pull_request:
branches:
- "**"

permissions:
contents: read
pull-requests: write

jobs:
format:
name: Check Code Formatting
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
- name: Check formatting
run: cargo fmt -- --check
test:
name: Test and coverage
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: "-A warnings"
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Install Protoc
uses: arduino/setup-protoc@v3
- name: Run tests with coverage
run: |
RPC_URLS=${{ secrets.RPC_URLS }} cargo llvm-cov --release --workspace --summary-only --remap-path-prefix --json > coverage.json
- name: Generate coverage summary
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
# Read JSON and convert it to Markdown table using jq
echo "<details><summary>Coverage report</summary>" > coverage.md
echo "" >> coverage.md
echo "Filename | Lines Covered (%) | Functions Covered (%) " >> coverage.md
echo "--- | --- | --- " >> coverage.md
jq -r '
.data[0].files as $files | $files[] |
[
.filename,
(.summary.lines.percent * 100|round / 100),
(.summary.functions.percent * 100 |round / 100)
] |
@tsv |
gsub("\t"; " | ")
' coverage.json >> coverage.md
echo "" >> coverage.md
echo "</details>" >> coverage.md
- name: Add reactions
uses: peter-evans/create-or-update-comment@v4
with:
body-path: coverage.md
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
Loading