-
Notifications
You must be signed in to change notification settings - Fork 3
Update CI workflows for consistency and performance #19
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
Changes from 1 commit
f37e768
095db4a
7beb53a
20afd03
67a1237
0d0ca3e
080974b
35adcd2
aeb060f
7150c32
e00982f
294c49f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "tasks": { | ||
| "build": "cargo build --release" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,17 +17,17 @@ jobs: | |
| name: Run Benchmarks | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Rust | ||
| uses: actions-rs/toolchain@v1 | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| profile: minimal | ||
| toolchain: stable | ||
| override: true | ||
|
|
||
| - name: Cache dependencies | ||
| uses: actions/cache@v3 | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.cargo/registry | ||
|
|
@@ -36,22 +36,19 @@ jobs: | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
|
|
||
| - name: Install cargo-criterion | ||
| uses: actions-rs/[email protected] | ||
| with: | ||
| crate: cargo-criterion | ||
| version: latest | ||
| use-tool-cache: true | ||
| run: cargo install cargo-criterion | ||
| working-directory: . | ||
|
|
||
| - name: Run benchmarks | ||
| uses: actions-rs/cargo@v1 | ||
| with: | ||
| command: criterion | ||
| run: cargo criterion | ||
| working-directory: . | ||
|
|
||
| - name: Create benchmark results directory | ||
| run: mkdir -p target/criterion | ||
| working-directory: . | ||
|
|
||
| - name: Upload benchmark results | ||
| uses: actions/upload-artifact@v3 | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: benchmark-results | ||
| path: target/criterion | ||
|
|
@@ -65,9 +62,10 @@ jobs: | |
| echo "Generated on $(date)" >> benchmark-report/README.md | ||
| echo "## Summary" >> benchmark-report/README.md | ||
| find target/criterion -name "*/new/estimates.json" -exec cat {} \; | jq -r '.mean | { command: .point_estimate, lower_bound: .confidence_interval.lower_bound, upper_bound: .confidence_interval.upper_bound }' >> benchmark-report/README.md || echo "No benchmark results found" >> benchmark-report/README.md | ||
| working-directory: . | ||
|
|
||
| - name: Upload benchmark report | ||
| uses: actions/upload-artifact@v3 | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: benchmark-report | ||
| path: benchmark-report | ||
|
|
@@ -81,3 +79,4 @@ jobs: | |
| cargo criterion --baseline main | ||
| git checkout ${{ github.sha }} | ||
| cargo criterion --baseline main | ||
| working-directory: . | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,18 +15,18 @@ jobs: | |
| name: Sanity Checks | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Rust | ||
| uses: actions-rs/toolchain@v1 | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| profile: minimal | ||
| toolchain: stable | ||
| override: true | ||
| components: rustfmt, clippy | ||
|
|
||
| - name: Cache dependencies | ||
| uses: actions/cache@v3 | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.cargo/registry | ||
|
|
@@ -35,33 +35,29 @@ jobs: | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
|
|
||
| - name: Check formatting | ||
| uses: actions-rs/cargo@v1 | ||
| with: | ||
| command: fmt | ||
| args: --all -- --check | ||
| run: cargo fmt --all -- --check | ||
| working-directory: . | ||
|
|
||
| - name: Run clippy | ||
| uses: actions-rs/cargo@v1 | ||
| with: | ||
| command: clippy | ||
| args: -- -D warnings | ||
| run: cargo clippy -- -D warnings | ||
| working-directory: . | ||
|
|
||
| unit-tests: | ||
| name: Unit Tests | ||
| needs: sanity-check | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Rust | ||
| uses: actions-rs/toolchain@v1 | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| profile: minimal | ||
| toolchain: stable | ||
| override: true | ||
|
|
||
| - name: Cache dependencies | ||
| uses: actions/cache@v3 | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.cargo/registry | ||
|
|
@@ -70,27 +66,25 @@ jobs: | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
|
|
||
| - name: Run unit tests | ||
| uses: actions-rs/cargo@v1 | ||
| with: | ||
| command: test | ||
| args: --lib --bins | ||
| run: cargo test --lib --bins | ||
| working-directory: . | ||
|
|
||
| e2e-tests: | ||
| name: End-to-End Tests | ||
| needs: unit-tests | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Rust | ||
| uses: actions-rs/toolchain@v1 | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| profile: minimal | ||
| toolchain: stable | ||
| override: true | ||
|
|
||
| - name: Cache dependencies | ||
| uses: actions/cache@v3 | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.cargo/registry | ||
|
|
@@ -99,46 +93,37 @@ jobs: | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
|
|
||
| - name: Build binary | ||
| uses: actions-rs/cargo@v1 | ||
| with: | ||
| command: build | ||
| args: --release | ||
| run: cargo build --release | ||
| working-directory: . | ||
|
|
||
| - name: Run e2e tests | ||
| uses: actions-rs/cargo@v1 | ||
| with: | ||
| command: test | ||
| args: --test main | ||
| run: cargo test --test main | ||
| working-directory: . | ||
|
|
||
| code-coverage: | ||
| name: Code Coverage | ||
| needs: [unit-tests, e2e-tests] | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Rust | ||
| uses: actions-rs/toolchain@v1 | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| profile: minimal | ||
| toolchain: stable | ||
| override: true | ||
|
|
||
| - name: Install cargo-tarpaulin | ||
| uses: actions-rs/[email protected] | ||
| with: | ||
| crate: cargo-tarpaulin | ||
| version: latest | ||
| use-tool-cache: true | ||
| run: cargo install cargo-tarpaulin | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (performance): Consider caching the installation for cargo-tarpaulin. Replacing the actions-based install with a direct cargo command improves simplicity, but installing cargo-tarpaulin every run could impact performance. Evaluate if caching the installed binary is feasible to reduce CI time. Suggested implementation: Ensure that the cache key is updated if you ever change the version of cargo-tarpaulin being installed, |
||
| working-directory: . | ||
|
|
||
| - name: Generate coverage report | ||
| uses: actions-rs/cargo@v1 | ||
| with: | ||
| command: tarpaulin | ||
| args: --out Xml --output-dir coverage | ||
| run: cargo tarpaulin --out Xml --output-dir coverage | ||
| working-directory: . | ||
|
|
||
| - name: Upload coverage to Codecov | ||
| uses: codecov/codecov-action@v3 | ||
| uses: codecov/codecov-action@v4 | ||
| with: | ||
| directory: ./coverage/ | ||
| fail_ci_if_error: true | ||
| fail_ci_if_error: true | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (performance): Evaluate caching for cargo-criterion installation.
Similar to other installation steps, running cargo install for cargo-criterion on each workflow execution may slow down builds. Consider whether caching the result of this installation could lead to overall performance improvements.
Suggested implementation:
Ensure that the cache key is appropriate for your project. If you later add custom flags or the version of cargo-criterion changes, update the key to force cache refresh.