Skip to content

Commit

Permalink
Merge pull request #1 from lapla-cogito/bench
Browse files Browse the repository at this point in the history
add benchmarks and measurement CI
  • Loading branch information
lapla-cogito authored Nov 29, 2024
2 parents e7e5ed8 + d113ed1 commit aae5e0a
Show file tree
Hide file tree
Showing 7 changed files with 763 additions and 1 deletion.
14 changes: 14 additions & 0 deletions .github/actions/cache_cargo/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: cache_cargo
description: cache .cargo directory
runs:
using: composite
steps:
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
19 changes: 19 additions & 0 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: run benchmarks

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]

jobs:
bench:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust-toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run bench
run: cargo bench
55 changes: 55 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: CI for rustregex

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]

jobs:
build-cache:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache cargo
uses: ./.github/actions/cache_cargo
- name: build
run: cargo build

cargo-fmt:
needs: build-cache
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust-toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Cache cargo
uses: ./.github/actions/cache_cargo
- name: Run rustfmt
run: cargo fmt --all -- --check

cargo-test:
needs: build-cache
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust-toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache cargo
uses: ./.github/actions/cache_cargo
- name: Run clippy
uses: giraffate/clippy-action@v1
with:
reporter: 'github-pr-review'
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Run tests
run: cargo test
Loading

0 comments on commit aae5e0a

Please sign in to comment.